simple_twitter 2.2.0 → 2.2.1
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 +4 -4
- data/CHANGELOG.md +7 -1
- data/lib/simple_twitter/client.rb +5 -0
- data/lib/simple_twitter/error.rb +3 -0
- data/lib/simple_twitter/version.rb +1 -1
- data/sig/simple_twitter/client.rbs +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 07a8547bff9c7cd57a04a9286f0356d0254144fcaee53fbba5209be5a2f9b1ef
|
4
|
+
data.tar.gz: bfcd987e1efab7ea72c86050d661b1e702fd2be902dc2c7d691f2f4b5e601f3e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 839a64b8effe471567cb3eedcf83e7d48d06c365bb7fb68fa361f59205111ffd3d04b56ff895b76f8a2865426673f5e1b24cf36a09d5d5c59c30e9f6d0a3aafb
|
7
|
+
data.tar.gz: e01225940b9728ab6decb8710eee1694693e7e76a77bc912112a3f92fc1fb548034eb31d22c810883343d862992f5cf4bb088002ff2a9ee94a73699ccfeeb43b
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## Unreleased
|
2
|
-
https://github.com/yhara/simple_twitter/compare/v2.2.
|
2
|
+
https://github.com/yhara/simple_twitter/compare/v2.2.1...main
|
3
|
+
|
4
|
+
## v2.2.1 (2023-07-25)
|
5
|
+
https://github.com/yhara/simple_twitter/compare/v2.2.0...v2.2.1
|
6
|
+
|
7
|
+
* Fix rbs for Nillable args
|
8
|
+
* https://github.com/yhara/simple_twitter/pull/30
|
3
9
|
|
4
10
|
## v2.2.0 (2023-07-24)
|
5
11
|
https://github.com/yhara/simple_twitter/compare/v2.1.0...v2.2.0
|
@@ -40,6 +40,7 @@ module SimpleTwitter
|
|
40
40
|
# @param json [Hash] Send this arg as JSON request body with `Content-Type: application/json` header
|
41
41
|
# @param form [Hash] Send this arg as form-data request body with `Content-Type: multipart/form-data` header
|
42
42
|
# @return [HTTP::Response]
|
43
|
+
# @see https://www.rubydoc.info/github/httprb/http/HTTP/Response HTTP::Response documentation
|
43
44
|
|
44
45
|
# @!method post(url, params: {}, json: {}, form: {})
|
45
46
|
# Call Twitter API with POST method
|
@@ -58,6 +59,7 @@ module SimpleTwitter
|
|
58
59
|
# @param json [Hash] Send this arg as JSON request body with `Content-Type: application/json` header
|
59
60
|
# @param form [Hash] Send this arg as form-data request body with `Content-Type: multipart/form-data` header
|
60
61
|
# @return [HTTP::Response]
|
62
|
+
# @see https://www.rubydoc.info/github/httprb/http/HTTP/Response HTTP::Response documentation
|
61
63
|
|
62
64
|
# @!method put(url, params: {}, json: {}, form: {})
|
63
65
|
# Call Twitter API with PUT method
|
@@ -76,6 +78,7 @@ module SimpleTwitter
|
|
76
78
|
# @param json [Hash] Send this arg as JSON request body with `Content-Type: application/json` header
|
77
79
|
# @param form [Hash] Send this arg as form-data request body with `Content-Type: multipart/form-data` header
|
78
80
|
# @return [HTTP::Response]
|
81
|
+
# @see https://www.rubydoc.info/github/httprb/http/HTTP/Response HTTP::Response documentation
|
79
82
|
|
80
83
|
# @!method delete(url, params: {}, json: {}, form: {})
|
81
84
|
# Call Twitter API with DELETE method
|
@@ -94,6 +97,7 @@ module SimpleTwitter
|
|
94
97
|
# @param json [Hash] Send this arg as JSON request body with `Content-Type: application/json` header
|
95
98
|
# @param form [Hash] Send this arg as form-data request body with `Content-Type: multipart/form-data` header
|
96
99
|
# @return [HTTP::Response]
|
100
|
+
# @see https://www.rubydoc.info/github/httprb/http/HTTP/Response HTTP::Response documentation
|
97
101
|
|
98
102
|
%i[get post put delete].each do |m|
|
99
103
|
class_eval <<~EOD
|
@@ -151,6 +155,7 @@ module SimpleTwitter
|
|
151
155
|
# @return [Hash] parsed json data
|
152
156
|
# @raise [SimpleTwitter::ClientError] Twitter API returned 4xx error
|
153
157
|
# @raise [SimpleTwitter::ServerError] Twitter API returned 5xx error
|
158
|
+
# @see https://www.rubydoc.info/github/httprb/http/HTTP/Response HTTP::Response documentation
|
154
159
|
def parse_response(res)
|
155
160
|
case res.code.to_i / 100
|
156
161
|
when 4
|
data/lib/simple_twitter/error.rb
CHANGED
@@ -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
|
|
@@ -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
|
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]
|