simple_twitter 2.2.0 → 2.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 671c43acc2022139dba5f4f69a76f518fdd46561c7081211a324e3ba1e2d75d5
4
- data.tar.gz: 3f6b0607f128651fbfda09b6911d83a01f9f8bc03c04f714fcc7f67c65ad5c55
3
+ metadata.gz: 28bb8b34b67d38e9a9b5a303afd8f81f862161c41436d4424f221ec19a29f2d7
4
+ data.tar.gz: 76f8aa9bf7039a3e6e51acebf1ef0e6532b1c0f5bd9bba4e42db6ebc113848d1
5
5
  SHA512:
6
- metadata.gz: '029f55ae678e76b578b4fd350694439a253b4f3b9165a6926e709df1b5ac6d1b8bc908a299ab4e0bfb01a1c88a0ad2035c5a5259827323104c73d3816ea1a30e'
7
- data.tar.gz: 2dcb7f62d814e81967ec466a2d746ed89a27c1191a416ceec7de0ffe1f0a4c33f664a0f2337250a76c83cc1cbd5a0371871b0e417f3a00f966ae95d6bcaecddd
6
+ metadata.gz: 78b7dd35126dbc2545768d2d64f3b54d5830889b8dc57ba0e0db27e577c2a93a0c42dfb353370b1d2774d14d4153707ab94a6e5cc077733e0348fe3b55776992
7
+ data.tar.gz: 41ebc4010d50b15905fd140256644e4c864d8a43f416a3d1c6953e43d267847c75b4c85892725662666a5ac8b3728b91d595af21e0fae9e9f466c2b114bba2ba
@@ -30,7 +30,7 @@ jobs:
30
30
  runs-on: ubuntu-latest
31
31
  steps:
32
32
  - name: Checkout
33
- uses: actions/checkout@v3
33
+ uses: actions/checkout@v4
34
34
 
35
35
  - uses: ruby/setup-ruby@v1
36
36
  with:
@@ -31,7 +31,7 @@ jobs:
31
31
  - "3.2"
32
32
 
33
33
  steps:
34
- - uses: actions/checkout@v3
34
+ - uses: actions/checkout@v4
35
35
 
36
36
  - uses: ruby/setup-ruby@v1
37
37
  with:
@@ -51,7 +51,7 @@ jobs:
51
51
  runs-on: ubuntu-latest
52
52
 
53
53
  steps:
54
- - uses: actions/checkout@v3
54
+ - uses: actions/checkout@v4
55
55
 
56
56
  - uses: ruby/setup-ruby@v1
57
57
  with:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  ## Unreleased
2
- https://github.com/yhara/simple_twitter/compare/v2.2.0...main
2
+ https://github.com/yhara/simple_twitter/compare/v2.2.2...main
3
+
4
+ ## v2.2.1 (2023-07-25)
5
+ https://github.com/yhara/simple_twitter/compare/v2.2.1...v2.2.2
6
+
7
+ * [docs] Tweak yard doc
8
+ * https://github.com/yhara/simple_twitter/pull/31
9
+ * Embed filename and line number of the method generated by eval into backtrace
10
+ * https://github.com/yhara/simple_twitter/pull/33
11
+ * Tweak gem description
12
+ * https://github.com/yhara/simple_twitter/pull/34
13
+
14
+ ## v2.2.1 (2023-07-25)
15
+ https://github.com/yhara/simple_twitter/compare/v2.2.0...v2.2.1
16
+
17
+ * Fix rbs for Nillable args
18
+ * https://github.com/yhara/simple_twitter/pull/30
3
19
 
4
20
  ## v2.2.0 (2023-07-24)
5
21
  https://github.com/yhara/simple_twitter/compare/v2.1.0...v2.2.0
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # simple_twitter
2
2
 
3
- Dead simple Twitter API client. Supports both v1 and v2
3
+ Dead simple X (formerly Twitter) API client. Supports both v1 and v2
4
4
 
5
5
  [![Gem Version](https://badge.fury.io/rb/simple_twitter.svg)](https://badge.fury.io/rb/simple_twitter)
6
6
  [![test](https://github.com/yhara/simple_twitter/actions/workflows/test.yml/badge.svg)](https://github.com/yhara/simple_twitter/actions/workflows/test.yml)
@@ -2,10 +2,21 @@ module SimpleTwitter
2
2
  # Twitter API Client
3
3
  class Client
4
4
  # @param bearer_token [String] This requires for OAuth 2
5
- # @param api_key [String] This requires for OAuth 1.0a
6
- # @param api_secret_key [String] This requires for OAuth 1.0a
7
- # @param access_token [String] This requires for OAuth 1.0a
8
- # @param access_token_secret [String] This requires for OAuth 1.0a
5
+ # @param api_key [String] API Key (a.k.a Consumer Key). This requires for OAuth 1.0a
6
+ # @param api_secret_key [String] API Secret Key (a.k.a Consumer Secret). This requires for OAuth 1.0a
7
+ # @param access_token [String] Access Token. This requires for OAuth 1.0a
8
+ # @param access_token_secret [String] Access Token Secret. This requires for OAuth 1.0a
9
+ #
10
+ # @example Initialize with OAuth 2
11
+ # client = SimpleTwitter::Client.new(bearer_token: "bearer_token")
12
+ #
13
+ # @example Initialize with OAuth 1.0a
14
+ # client = SimpleTwitter::Client.new(
15
+ # api_key: "api_key",
16
+ # api_secret_key: "api_secret_key",
17
+ # access_token: "access_token",
18
+ # access_token_secret: "access_token_secret",
19
+ # )
9
20
  def initialize(bearer_token: nil,
10
21
  api_key: nil,
11
22
  api_secret_key: nil,
@@ -40,6 +51,7 @@ module SimpleTwitter
40
51
  # @param json [Hash] Send this arg as JSON request body with `Content-Type: application/json` header
41
52
  # @param form [Hash] Send this arg as form-data request body with `Content-Type: multipart/form-data` header
42
53
  # @return [HTTP::Response]
54
+ # @see https://www.rubydoc.info/github/httprb/http/HTTP/Response HTTP::Response documentation
43
55
 
44
56
  # @!method post(url, params: {}, json: {}, form: {})
45
57
  # Call Twitter API with POST method
@@ -58,6 +70,7 @@ module SimpleTwitter
58
70
  # @param json [Hash] Send this arg as JSON request body with `Content-Type: application/json` header
59
71
  # @param form [Hash] Send this arg as form-data request body with `Content-Type: multipart/form-data` header
60
72
  # @return [HTTP::Response]
73
+ # @see https://www.rubydoc.info/github/httprb/http/HTTP/Response HTTP::Response documentation
61
74
 
62
75
  # @!method put(url, params: {}, json: {}, form: {})
63
76
  # Call Twitter API with PUT method
@@ -76,6 +89,7 @@ module SimpleTwitter
76
89
  # @param json [Hash] Send this arg as JSON request body with `Content-Type: application/json` header
77
90
  # @param form [Hash] Send this arg as form-data request body with `Content-Type: multipart/form-data` header
78
91
  # @return [HTTP::Response]
92
+ # @see https://www.rubydoc.info/github/httprb/http/HTTP/Response HTTP::Response documentation
79
93
 
80
94
  # @!method delete(url, params: {}, json: {}, form: {})
81
95
  # Call Twitter API with DELETE method
@@ -94,9 +108,10 @@ module SimpleTwitter
94
108
  # @param json [Hash] Send this arg as JSON request body with `Content-Type: application/json` header
95
109
  # @param form [Hash] Send this arg as form-data request body with `Content-Type: multipart/form-data` header
96
110
  # @return [HTTP::Response]
111
+ # @see https://www.rubydoc.info/github/httprb/http/HTTP/Response HTTP::Response documentation
97
112
 
98
113
  %i[get post put delete].each do |m|
99
- class_eval <<~EOD
114
+ class_eval <<~EOD, __FILE__, __LINE__ + 1
100
115
  def #{m}(url, params: {}, json: {}, form: {})
101
116
  res = #{m}_raw(url, params: params, json: json, form: form)
102
117
  parse_response(res)
@@ -151,6 +166,7 @@ module SimpleTwitter
151
166
  # @return [Hash] parsed json data
152
167
  # @raise [SimpleTwitter::ClientError] Twitter API returned 4xx error
153
168
  # @raise [SimpleTwitter::ServerError] Twitter API returned 5xx error
169
+ # @see https://www.rubydoc.info/github/httprb/http/HTTP/Response HTTP::Response documentation
154
170
  def parse_response(res)
155
171
  case res.code.to_i / 100
156
172
  when 4
@@ -3,13 +3,16 @@ module SimpleTwitter
3
3
  class Error < StandardError
4
4
  # @!attribute [r] raw_response
5
5
  # @return [HTTP::Response] raw error response
6
+ # @see https://www.rubydoc.info/github/httprb/http/HTTP/Response HTTP::Response documentation
6
7
  attr_reader :raw_response
7
8
 
8
9
  # @!attribute [r] body
9
10
  # @return [Hash<Symbol, String>] error response body
11
+ # @see https://developer.twitter.com/en/support/twitter-api/error-troubleshooting error response body format
10
12
  attr_reader :body
11
13
 
12
14
  # @param raw_response [HTTP::Response] raw error response from Twitter API
15
+ # @see https://www.rubydoc.info/github/httprb/http/HTTP/Response HTTP::Response documentation
13
16
  def initialize(raw_response)
14
17
  @raw_response = raw_response
15
18
 
@@ -1,3 +1,3 @@
1
1
  module SimpleTwitter
2
- VERSION = "2.2.0"
2
+ VERSION = "2.2.2"
3
3
  end
@@ -3,10 +3,10 @@
3
3
  # Classes
4
4
  module SimpleTwitter
5
5
  class Client
6
- @bearer_token: string
6
+ @bearer_token: string?
7
7
  @oauth_params: {consumer_key: string, consumer_secret: string, token: string, token_secret: string}
8
8
 
9
- def initialize: (?bearer_token: string, ?api_key: string, ?api_secret_key: string, ?access_token: string, ?access_token_secret: string) -> void
9
+ def initialize: (?bearer_token: string?, ?api_key: string?, ?api_secret_key: string?, ?access_token: string?, ?access_token_secret: string?) -> void
10
10
 
11
11
  def get: (String url, params: Hash[Symbol, untyped], json: Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
12
12
  def post: (String url, params: Hash[Symbol, untyped], json: Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
@@ -6,8 +6,8 @@ Gem::Specification.new do |spec|
6
6
  spec.authors = ["Yutaka HARA", "sue445"]
7
7
  spec.email = ["yutaka.hara+github@gmail.com", "sue445fukuoka@gmail.com"]
8
8
 
9
- spec.summary = "Dead simple client for Twitter API v1/v2"
10
- spec.description = "Dead simple client for Twitter API (supports both v1 and v2)"
9
+ spec.summary = "Dead simple client for X (formerly Twitter) API v1/v2"
10
+ spec.description = "Dead simple client for X (formerly Twitter) API (supports both v1 and v2)"
11
11
  spec.homepage = "https://github.com/yhara/simple_twitter"
12
12
  spec.license = "MIT"
13
13
  spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_twitter
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yutaka HARA
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2023-07-24 00:00:00.000000000 Z
12
+ date: 2023-09-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: http
@@ -123,7 +123,8 @@ dependencies:
123
123
  - - ">="
124
124
  - !ruby/object:Gem::Version
125
125
  version: '0'
126
- description: Dead simple client for Twitter API (supports both v1 and v2)
126
+ description: Dead simple client for X (formerly Twitter) API (supports both v1 and
127
+ v2)
127
128
  email:
128
129
  - yutaka.hara+github@gmail.com
129
130
  - sue445fukuoka@gmail.com
@@ -188,5 +189,5 @@ requirements: []
188
189
  rubygems_version: 3.4.10
189
190
  signing_key:
190
191
  specification_version: 4
191
- summary: Dead simple client for Twitter API v1/v2
192
+ summary: Dead simple client for X (formerly Twitter) API v1/v2
192
193
  test_files: []