simple_twitter 2.1.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9efa656f4b989f1702d73b9fc4dcd1526edeb944fd9de450993cea3a359ac980
4
- data.tar.gz: eb2027e3aaf434de6014f8ad60775af313c6a3bc88dfca3ac350dd5ad4798c91
3
+ metadata.gz: 07a8547bff9c7cd57a04a9286f0356d0254144fcaee53fbba5209be5a2f9b1ef
4
+ data.tar.gz: bfcd987e1efab7ea72c86050d661b1e702fd2be902dc2c7d691f2f4b5e601f3e
5
5
  SHA512:
6
- metadata.gz: d7f681333e86714dbf3aba86319761118c002b914f0d45579b9c35bcb0d0937a4a276ee04137c7cc76cdf66ddd25ab057e431420bd3b95b0fa91e411a96925d0
7
- data.tar.gz: 7c0159dbc2da88fed921c25887488b5c81406ebcb4793ff10bf76de8d447cb5d8d61f7954c0c44a0b766e3ee1828d68f6ef9c9fa2812eaf709ab5f705d678579
6
+ metadata.gz: 839a64b8effe471567cb3eedcf83e7d48d06c365bb7fb68fa361f59205111ffd3d04b56ff895b76f8a2865426673f5e1b24cf36a09d5d5c59c30e9f6d0a3aafb
7
+ data.tar.gz: e01225940b9728ab6decb8710eee1694693e7e76a77bc912112a3f92fc1fb548034eb31d22c810883343d862992f5cf4bb088002ff2a9ee94a73699ccfeeb43b
@@ -46,3 +46,24 @@ jobs:
46
46
 
47
47
  - run: bundle exec rspec
48
48
  - run: bundle exec yard --fail-on-warning
49
+
50
+ rbs:
51
+ runs-on: ubuntu-latest
52
+
53
+ steps:
54
+ - uses: actions/checkout@v3
55
+
56
+ - uses: ruby/setup-ruby@v1
57
+ with:
58
+ ruby-version: ruby
59
+ bundler-cache: true
60
+
61
+ - name: bundle update
62
+ run: |
63
+ set -xe
64
+ bundle config path vendor/bundle
65
+ bundle update --jobs $(nproc) --retry 3
66
+
67
+ - run: bundle exec rbs collection install
68
+ - run: bundle exec rbs validate --silent
69
+ - run: bundle exec steep check
data/.gitignore CHANGED
@@ -8,3 +8,4 @@
8
8
  /tmp/
9
9
  Gemfile.lock
10
10
  .env
11
+ .gem_rbs_collection/
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ## Unreleased
2
- https://github.com/yhara/simple_twitter/compare/v2.1.0...main
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
9
+
10
+ ## v2.2.0 (2023-07-24)
11
+ https://github.com/yhara/simple_twitter/compare/v2.1.0...v2.2.0
12
+
13
+ * Add rbs
14
+ * https://github.com/yhara/simple_twitter/pull/21
3
15
 
4
16
  ## v2.1.0 (2023-07-22)
5
17
  https://github.com/yhara/simple_twitter/compare/v2.0.0...v2.1.0
data/README.md CHANGED
@@ -111,11 +111,12 @@ media = client.post(
111
111
  # :image=>{:image_type=>"image/png", :w=>400, :h=>400}}
112
112
 
113
113
  # Tweet with media
114
- client.post("https://api.twitter.com/2/tweets",
115
- json: {
116
- text: "Test tweet with image",
117
- media: { media_ids: [media[:media_id_string]] },
118
- }
114
+ client.post(
115
+ "https://api.twitter.com/2/tweets",
116
+ json: {
117
+ text: "Test tweet with image",
118
+ media: { media_ids: [media[:media_id_string]] },
119
+ }
119
120
  )
120
121
  ```
121
122
 
data/Steepfile ADDED
@@ -0,0 +1,30 @@
1
+ # D = Steep::Diagnostic
2
+
3
+ target :lib do
4
+ signature "sig"
5
+
6
+ check "lib" # Directory name
7
+ # check "Gemfile" # File name
8
+ # check "app/models/**/*.rb" # Glob
9
+ # ignore "lib/templates/*.rb"
10
+
11
+ # library "pathname" # Standard libraries
12
+ # library "strong_json" # Gems
13
+ library "json"
14
+
15
+ # configure_code_diagnostics(D::Ruby.default) # `default` diagnostics setting (applies by default)
16
+ # configure_code_diagnostics(D::Ruby.strict) # `strict` diagnostics setting
17
+ # configure_code_diagnostics(D::Ruby.lenient) # `lenient` diagnostics setting
18
+ # configure_code_diagnostics(D::Ruby.silent) # `silent` diagnostics setting
19
+ # configure_code_diagnostics do |hash| # You can setup everything yourself
20
+ # hash[D::Ruby::NoMethod] = :information
21
+ # end
22
+ end
23
+
24
+ # target :test do
25
+ # signature "sig", "sig-private"
26
+ #
27
+ # check "test"
28
+ #
29
+ # # library "pathname" # Standard libraries
30
+ # end
@@ -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
@@ -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.1.0"
2
+ VERSION = "2.2.1"
3
3
  end
@@ -0,0 +1,26 @@
1
+ ---
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ revision: aeede7258d020bfd509541e0c8075ce833292409
6
+ remote: https://github.com/ruby/gem_rbs_collection.git
7
+ repo_dir: gems
8
+ path: ".gem_rbs_collection"
9
+ gems:
10
+ - name: http
11
+ version: '5.1'
12
+ source:
13
+ type: git
14
+ name: ruby/gem_rbs_collection
15
+ revision: aeede7258d020bfd509541e0c8075ce833292409
16
+ remote: https://github.com/ruby/gem_rbs_collection.git
17
+ repo_dir: gems
18
+ - name: simple_oauth
19
+ version: '0.3'
20
+ source:
21
+ type: git
22
+ name: ruby/gem_rbs_collection
23
+ revision: aeede7258d020bfd509541e0c8075ce833292409
24
+ remote: https://github.com/ruby/gem_rbs_collection.git
25
+ repo_dir: gems
26
+ gemfile_lock_path: Gemfile.lock
@@ -0,0 +1,30 @@
1
+ # Download sources
2
+ sources:
3
+ - type: git
4
+ name: ruby/gem_rbs_collection
5
+ remote: https://github.com/ruby/gem_rbs_collection.git
6
+ revision: main
7
+ repo_dir: gems
8
+
9
+ # You can specify local directories as sources also.
10
+ # - type: local
11
+ # path: path/to/your/local/repository
12
+
13
+ # A directory to install the downloaded RBSs
14
+ path: .gem_rbs_collection
15
+
16
+ gems:
17
+ # Skip loading rbs gem's RBS.
18
+ # It's unnecessary if you don't use rbs as a library.
19
+ - name: rbs
20
+ ignore: true
21
+
22
+ - name: simple_twitter
23
+ ignore: true
24
+ - name: steep
25
+ ignore: true
26
+ - name: yard
27
+ ignore: true
28
+
29
+ - name: http
30
+ - name: simple_oauth
@@ -0,0 +1,28 @@
1
+ # TypeProf 0.21.3
2
+
3
+ # Classes
4
+ module SimpleTwitter
5
+ class Client
6
+ @bearer_token: string?
7
+ @oauth_params: {consumer_key: string, consumer_secret: string, token: string, token_secret: string}
8
+
9
+ def initialize: (?bearer_token: string?, ?api_key: string?, ?api_secret_key: string?, ?access_token: string?, ?access_token_secret: string?) -> void
10
+
11
+ def get: (String url, params: Hash[Symbol, untyped], json: Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
12
+ def post: (String url, params: Hash[Symbol, untyped], json: Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
13
+ def put: (String url, params: Hash[Symbol, untyped], json: Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
14
+ def delete: (String url, params: Hash[Symbol, untyped], json: Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
15
+
16
+ def get_raw: (String url, params: Hash[Symbol, untyped], json: Hash[Symbol, untyped]) -> HTTP::Response
17
+ def post_raw: (String url, params: Hash[Symbol, untyped], json: Hash[Symbol, untyped]) -> HTTP::Response
18
+ def put_raw: (String url, params: Hash[Symbol, untyped], json: Hash[Symbol, untyped]) -> HTTP::Response
19
+ def delete_raw: (String url, params: Hash[Symbol, untyped], json: Hash[Symbol, untyped]) -> HTTP::Response
20
+
21
+ private
22
+
23
+ def create_http_args: (params: Hash[Symbol, untyped], json: Hash[Symbol, untyped], form: Hash[Symbol, untyped]) -> Hash[Symbol, untyped]
24
+ def http: (Symbol method, String url, Hash[Symbol, String] params) -> HTTP::Client
25
+ def auth_header: (Symbol method, String url, Hash[Symbol, String] params) -> String
26
+ def parse_response: (HTTP::Response res) -> Hash[Symbol, untyped]
27
+ end
28
+ end
@@ -0,0 +1,7 @@
1
+ # TypeProf 0.21.3
2
+
3
+ # Classes
4
+ module SimpleTwitter
5
+ class ClientError < Error
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ # TypeProf 0.21.3
2
+
3
+ # Classes
4
+ module SimpleTwitter
5
+ class Error < StandardError
6
+ attr_reader raw_response: HTTP::Response
7
+ attr_reader body: Hash[Symbol, untyped]
8
+ def initialize: (HTTP::Response raw_response) -> void
9
+ end
10
+ end
@@ -0,0 +1,7 @@
1
+ # TypeProf 0.21.3
2
+
3
+ # Classes
4
+ module SimpleTwitter
5
+ class ServerError < Error
6
+ end
7
+ end
@@ -0,0 +1,6 @@
1
+ # TypeProf 0.21.3
2
+
3
+ # Classes
4
+ module SimpleTwitter
5
+ VERSION: String
6
+ end
@@ -0,0 +1,5 @@
1
+ # TypeProf 0.21.3
2
+
3
+ # Classes
4
+ module SimpleTwitter
5
+ end
@@ -33,6 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency "dotenv"
34
34
  spec.add_development_dependency "rspec"
35
35
  spec.add_development_dependency "rspec-its"
36
+ spec.add_development_dependency "steep"
36
37
  spec.add_development_dependency "webmock"
37
38
  spec.add_development_dependency "yard"
38
39
  end
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.1.0
4
+ version: 2.2.1
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-21 00:00:00.000000000 Z
12
+ date: 2023-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: http
@@ -81,6 +81,20 @@ dependencies:
81
81
  - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: steep
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ">="
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
84
98
  - !ruby/object:Gem::Dependency
85
99
  name: webmock
86
100
  requirement: !ruby/object:Gem::Requirement
@@ -129,6 +143,7 @@ files:
129
143
  - LICENSE.txt
130
144
  - README.md
131
145
  - Rakefile
146
+ - Steepfile
132
147
  - bin/console
133
148
  - bin/setup
134
149
  - lib/simple_twitter.rb
@@ -137,6 +152,14 @@ files:
137
152
  - lib/simple_twitter/error.rb
138
153
  - lib/simple_twitter/server_error.rb
139
154
  - lib/simple_twitter/version.rb
155
+ - rbs_collection.lock.yaml
156
+ - rbs_collection.yaml
157
+ - sig/simple_twitter.rbs
158
+ - sig/simple_twitter/client.rbs
159
+ - sig/simple_twitter/client_error.rbs
160
+ - sig/simple_twitter/error.rbs
161
+ - sig/simple_twitter/server_error.rbs
162
+ - sig/simple_twitter/version.rbs
140
163
  - simple_twitter.gemspec
141
164
  homepage: https://github.com/yhara/simple_twitter
142
165
  licenses: