Unreleased

github.com/yhara/simple_twitter/compare/v2.2.2…main

v2.2.2 (2023-09-11)

github.com/yhara/simple_twitter/compare/v2.2.1…v2.2.2

v2.2.1 (2023-07-25)

github.com/yhara/simple_twitter/compare/v2.2.0…v2.2.1

v2.2.0 (2023-07-24)

github.com/yhara/simple_twitter/compare/v2.1.0…v2.2.0

v2.1.0 (2023-07-22)

github.com/yhara/simple_twitter/compare/v2.0.0…v2.1.0

v2.0.0 (2023-07-17)

github.com/yhara/simple_twitter/compare/v1.0.0…v2.0.0

:bomb: [BREAKING CHANGE] positional args to keywords args

Since v2.0, the positional arguments of the following methods are now keyword arguments.

v1.0 v2.0+
‘SimpleTwitter::Client#get(url, params = {})` ‘SimpleTwitter::Client#get(url, params: {}, json: {})`
‘SimpleTwitter::Client#get_raw(url, params = {})` ‘SimpleTwitter::Client#get_raw(url, params: {}, json: {})`
‘SimpleTwitter::Client#post(url, params = {})` ‘SimpleTwitter::Client#post(url, params: {}, json: {})`
‘SimpleTwitter::Client#post_raw(url, params = {})` ‘SimpleTwitter::Client#post_raw(url, params: {}, json: {})`
‘SimpleTwitter::Client#put(url, params = {})` ‘SimpleTwitter::Client#put(url, params: {}, json: {})`
‘SimpleTwitter::Client#put_raw(url, params = {})` ‘SimpleTwitter::Client#put_raw(url, params: {}, json: {})`
‘SimpleTwitter::Client#delete(url, params = {})` ‘SimpleTwitter::Client#delete(url, params: {}, json: {})`
‘SimpleTwitter::Client#delete_raw(url, params = {})` ‘SimpleTwitter::Client#delete_raw(url, params: {}, json: {})`

Please modify as follows when you upgrade from v1.0 :pray:

Before (v1.0)

client.get("https://api.twitter.com/2/tweets", ids: "1302127884039909376,1369885448319889409")

After (v2.0+)

client.get("https://api.twitter.com/2/tweets", params: { ids: "1302127884039909376,1369885448319889409" })

If only 1 argument was used (e.g. client.get("https://api.twitter.com/2/users/me")), no modification is required.

See more.

:bomb: [BREAKING CHANGE] raise Error when Twitter API returned error

Until v1.0, even if the Twitter API returns an error, Ruby does not throw an error, so it is considered a normal exit.

This is confusing, so when the API returns an error, Ruby also raises an error.

Before (v1.0)

client = SimpleTwitter::Client.new(bearer_token: "dummy")
client.get("https://api.twitter.com/2/users/me")
#=> 
{:title=>"Unsupported Authentication",
 :detail=>
  "Authenticating with OAuth 2.0 Application-Only is forbidden for this endpoint.  Supported authentication types are [OAuth 1.0a User Context, OAuth 2.0 User Context].",
 :type=>"https://api.twitter.com/2/problems/unsupported-authentication",
 :status=>403}

After (v2.0+)

client = SimpleTwitter::Client.new(bearer_token: "dummy")
client.get("https://api.twitter.com/2/users/me")
/path/to/simple_twitter/lib/simple_twitter.rb:96:in `parse_response': Unsupported Authentication (status 403) (SimpleTwitter::ClientError)
        from (eval):6:in `get'
        from (irb):2:in `<main>'
        from ./bin/console:15:in `<main>'

Detailed error details can be obtained as follows

begin
  client = SimpleTwitter::Client.new(bearer_token: "invalid_bearer_token")
  client.get("https://api.twitter.com/2/users/me")
rescue SimpleTwitter::Error => error
  error.raw_response.class
  #=> HTTP::Response

  error.raw_response.code
  #=> 403

  error.body[:title]
  # => "Unsupported Authentication"
end

See more.

Features

Others

v1.0.0 (2021-03-28)

  • initial release