x 0.8.1 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +10 -0
- data/bin/console +10 -0
- data/bin/setup +6 -0
- data/lib/x/client.rb +2 -1
- data/lib/x/connection.rb +12 -3
- data/lib/x/oauth_authenticator.rb +4 -8
- data/lib/x/redirect_handler.rb +1 -1
- data/lib/x/request_builder.rb +10 -5
- data/lib/x/response_handler.rb +12 -8
- data/lib/x/version.rb +1 -1
- data/sig/x.rbs +16 -13
- metadata +8 -8
- data/.rubocop.yml +0 -54
- data/Gemfile +0 -18
- data/Rakefile +0 -23
- data/Steepfile +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e2906018cf3e05342abe1bc6c938f3d1b3cf9d1d84c3813a96a11b693fbe0960
|
4
|
+
data.tar.gz: f84f47e1a9ea06b101712ae1f9fd7198d71b2cbc7487a654b8442dd13e3244e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c98c3ea7e22d0b023a328207c9599dca0f74b54d5ed05eea04378c5c2ed5a2803799b7dcafa54d041d3b7dac8b3e08c8559d4cacb03b2419796368fa153401e
|
7
|
+
data.tar.gz: 36c0faa98a5f6657a88ce770924e2669f91fcea2985b38f1c82dc0766d0c5a5cf6a4b0342d4684f5b679b41dc76f5fa94b791a6468b6f0514c28f6d70864b41a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,15 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.9.1] - 2023-10-06
|
4
|
+
|
5
|
+
- Allow successful empty responses (06bf7db)
|
6
|
+
- Update default User-Agent string (296b36a)
|
7
|
+
- Move query parameter escaping into RequestBuilder (56d6bd2)
|
8
|
+
|
9
|
+
## [0.9.0] - 2023-09-26
|
10
|
+
|
11
|
+
- Add support for HTTP proxies (3740f4f)
|
12
|
+
|
3
13
|
## [0.8.1] - 2023-09-20
|
4
14
|
|
5
15
|
- Fix bug where setting Connection#base_uri= doesn't update the HTTP client (d5a89db)
|
data/README.md
CHANGED
@@ -56,6 +56,8 @@ ads_client = X::Client.new(base_url: "https://ads-api.twitter.com/12/", **x_cred
|
|
56
56
|
ads_client.get("accounts")
|
57
57
|
```
|
58
58
|
|
59
|
+
See other common usage [examples](https://github.com/sferik/x-ruby/tree/main/examples).
|
60
|
+
|
59
61
|
## History and Philosophy
|
60
62
|
|
61
63
|
This library is a rewrite of the [Twitter Ruby library](https://github.com/sferik/twitter). Over 16 years of development, that library ballooned to over 3,000 lines of code (plus 7,500 lines of tests). At the time of writing, this library is about 300 lines of code (plus 200 test lines) and I’d like to keep it that way. That doesn’t mean new features won’t be added over time, but the benefits of more code must be weighted against the benefits of less:
|
@@ -88,6 +90,14 @@ Building and maintaining an open-source project like this takes a considerable a
|
|
88
90
|
|
89
91
|
[Click here to sponsor this project.](https://github.com/sponsors/sferik)
|
90
92
|
|
93
|
+
## Sponsors
|
94
|
+
|
95
|
+
Many thanks to our sponsors (listed in order of when they sponsored this project):
|
96
|
+
|
97
|
+
<a href="https://betterstack.com"><img src="https://raw.githubusercontent.com/sferik/x-ruby/main/sponsor_logos/better_stack.svg" alt="Better Stack" width="200" align="middle"></a>
|
98
|
+
<img src="https://raw.githubusercontent.com/sferik/x-ruby/main/sponsor_logos/spacer.png" width="20" align="middle">
|
99
|
+
<a href="https://sentry.io"><img src="https://raw.githubusercontent.com/sferik/x-ruby/main/sponsor_logos/sentry.svg" alt="Sentry" width="200" align="middle"></a>
|
100
|
+
|
91
101
|
## Development
|
92
102
|
|
93
103
|
1. Checkout and repo:
|
data/bin/console
ADDED
data/bin/setup
ADDED
data/lib/x/client.rb
CHANGED
@@ -26,6 +26,7 @@ module X
|
|
26
26
|
open_timeout: Connection::DEFAULT_OPEN_TIMEOUT,
|
27
27
|
read_timeout: Connection::DEFAULT_READ_TIMEOUT,
|
28
28
|
write_timeout: Connection::DEFAULT_WRITE_TIMEOUT,
|
29
|
+
proxy_url: nil,
|
29
30
|
content_type: RequestBuilder::DEFAULT_CONTENT_TYPE,
|
30
31
|
user_agent: RequestBuilder::DEFAULT_USER_AGENT,
|
31
32
|
debug_output: nil,
|
@@ -35,7 +36,7 @@ module X
|
|
35
36
|
|
36
37
|
initialize_authenticator(bearer_token, api_key, api_key_secret, access_token, access_token_secret)
|
37
38
|
@connection = Connection.new(base_url: base_url, open_timeout: open_timeout, read_timeout: read_timeout,
|
38
|
-
write_timeout: write_timeout, debug_output: debug_output)
|
39
|
+
write_timeout: write_timeout, debug_output: debug_output, proxy_url: proxy_url)
|
39
40
|
@request_builder = RequestBuilder.new(content_type: content_type, user_agent: user_agent)
|
40
41
|
@redirect_handler = RedirectHandler.new(@authenticator, @connection, @request_builder,
|
41
42
|
max_redirects: max_redirects)
|
data/lib/x/connection.rb
CHANGED
@@ -20,14 +20,15 @@ module X
|
|
20
20
|
Net::ReadTimeout
|
21
21
|
].freeze
|
22
22
|
|
23
|
-
attr_reader :base_uri, :http_client
|
23
|
+
attr_reader :base_uri, :proxy_uri, :http_client
|
24
24
|
|
25
25
|
def_delegators :@http_client, :open_timeout, :read_timeout, :write_timeout
|
26
26
|
def_delegators :@http_client, :open_timeout=, :read_timeout=, :write_timeout=
|
27
27
|
def_delegator :@http_client, :set_debug_output, :debug_output=
|
28
28
|
|
29
29
|
def initialize(base_url: DEFAULT_BASE_URL, open_timeout: DEFAULT_OPEN_TIMEOUT,
|
30
|
-
read_timeout: DEFAULT_READ_TIMEOUT, write_timeout: DEFAULT_WRITE_TIMEOUT, debug_output: nil)
|
30
|
+
read_timeout: DEFAULT_READ_TIMEOUT, write_timeout: DEFAULT_WRITE_TIMEOUT, proxy_url: nil, debug_output: nil)
|
31
|
+
@proxy_uri = URI(proxy_url) unless proxy_url.nil?
|
31
32
|
self.base_uri = base_url
|
32
33
|
apply_http_client_settings(
|
33
34
|
open_timeout: open_timeout,
|
@@ -77,11 +78,19 @@ module X
|
|
77
78
|
conditionally_apply_http_client_settings do
|
78
79
|
host = @base_uri.host || DEFAULT_HOST
|
79
80
|
port = @base_uri.port || DEFAULT_PORT
|
80
|
-
@http_client =
|
81
|
+
@http_client = build_http_client(host: host, port: port)
|
81
82
|
@http_client.use_ssl = @base_uri.scheme == "https"
|
82
83
|
end
|
83
84
|
end
|
84
85
|
|
86
|
+
def build_http_client(host:, port:)
|
87
|
+
if @proxy_uri.nil?
|
88
|
+
Net::HTTP.new(host, port)
|
89
|
+
else
|
90
|
+
Net::HTTP.new(host, port, @proxy_uri&.host, @proxy_uri&.port, @proxy_uri&.user, @proxy_uri&.password)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
85
94
|
def conditionally_apply_http_client_settings
|
86
95
|
if @http_client
|
87
96
|
settings = current_http_client_settings
|
@@ -72,22 +72,18 @@ module X
|
|
72
72
|
end
|
73
73
|
|
74
74
|
def signature_base_string(method, url, params)
|
75
|
-
"#{method}&#{
|
76
|
-
end
|
77
|
-
|
78
|
-
def encode_params(params)
|
79
|
-
params.sort.map { |k, v| "#{k}=#{encode(v.to_s)}" }.join("&")
|
75
|
+
"#{method}&#{escape(url)}&#{escape(URI.encode_www_form(params.sort))}"
|
80
76
|
end
|
81
77
|
|
82
78
|
def signing_key
|
83
|
-
"#{
|
79
|
+
"#{escape(api_key_secret)}&#{escape(access_token_secret)}"
|
84
80
|
end
|
85
81
|
|
86
82
|
def format_oauth_header(params)
|
87
|
-
"OAuth #{params.sort.map { |k, v| "#{k}=\"#{
|
83
|
+
"OAuth #{params.sort.map { |k, v| "#{k}=\"#{escape(v.to_s)}\"" }.join(", ")}"
|
88
84
|
end
|
89
85
|
|
90
|
-
def
|
86
|
+
def escape(value)
|
91
87
|
# TODO: Replace CGI.escape with CGI.escapeURIComponent when support for Ruby 3.1 is dropped
|
92
88
|
CGI.escape(value.to_s).gsub("+", "%20")
|
93
89
|
end
|
data/lib/x/redirect_handler.rb
CHANGED
@@ -49,7 +49,7 @@ module X
|
|
49
49
|
def send_new_request(new_uri, new_request)
|
50
50
|
@connection = Connection.new(base_url: new_uri, open_timeout: connection.open_timeout,
|
51
51
|
read_timeout: connection.read_timeout, write_timeout: connection.write_timeout,
|
52
|
-
debug_output: connection.debug_output)
|
52
|
+
debug_output: connection.debug_output, proxy_url: connection.proxy_uri)
|
53
53
|
connection.send_request(new_request)
|
54
54
|
end
|
55
55
|
end
|
data/lib/x/request_builder.rb
CHANGED
@@ -12,7 +12,7 @@ module X
|
|
12
12
|
delete: Net::HTTP::Delete
|
13
13
|
}.freeze
|
14
14
|
DEFAULT_CONTENT_TYPE = "application/json; charset=utf-8".freeze
|
15
|
-
DEFAULT_USER_AGENT = "X-Client/#{VERSION}
|
15
|
+
DEFAULT_USER_AGENT = "X-Client/#{VERSION} #{RUBY_ENGINE}/#{RUBY_VERSION} (#{RUBY_PLATFORM})".freeze
|
16
16
|
AUTHORIZATION_HEADER = "Authorization".freeze
|
17
17
|
CONTENT_TYPE_HEADER = "Content-Type".freeze
|
18
18
|
USER_AGENT_HEADER = "User-Agent".freeze
|
@@ -24,8 +24,8 @@ module X
|
|
24
24
|
@user_agent = user_agent
|
25
25
|
end
|
26
26
|
|
27
|
-
def build(authenticator, http_method,
|
28
|
-
request = create_request(http_method,
|
27
|
+
def build(authenticator, http_method, uri, body: nil)
|
28
|
+
request = create_request(http_method, uri, body)
|
29
29
|
add_authorization(request, authenticator)
|
30
30
|
add_content_type(request)
|
31
31
|
add_user_agent(request)
|
@@ -34,12 +34,13 @@ module X
|
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
-
def create_request(http_method,
|
37
|
+
def create_request(http_method, uri, body)
|
38
38
|
http_method_class = HTTP_METHODS[http_method]
|
39
39
|
|
40
40
|
raise ArgumentError, "Unsupported HTTP method: #{http_method}" unless http_method_class
|
41
41
|
|
42
|
-
|
42
|
+
escaped_uri = escape_query_params(uri)
|
43
|
+
request = http_method_class.new(escaped_uri)
|
43
44
|
request.body = body if body && http_method != :get
|
44
45
|
request
|
45
46
|
end
|
@@ -55,5 +56,9 @@ module X
|
|
55
56
|
def add_user_agent(request)
|
56
57
|
request.add_field(USER_AGENT_HEADER, user_agent) if user_agent
|
57
58
|
end
|
59
|
+
|
60
|
+
def escape_query_params(uri)
|
61
|
+
URI(uri).tap { |u| u.query = URI.encode_www_form(URI.decode_www_form(uri.query)) if uri.query }
|
62
|
+
end
|
58
63
|
end
|
59
64
|
end
|
data/lib/x/response_handler.rb
CHANGED
@@ -32,19 +32,23 @@ module X
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def handle(response)
|
35
|
-
if
|
36
|
-
|
35
|
+
if success?(response)
|
36
|
+
JSON.parse(response.body, array_class: array_class, object_class: object_class) if json?(response)
|
37
|
+
else
|
38
|
+
error_class = ERROR_CLASSES[response.code.to_i] || Error
|
39
|
+
error_message = "#{response.code} #{response.message}"
|
40
|
+
raise error_class.new(error_message, response: response)
|
37
41
|
end
|
38
|
-
|
39
|
-
error_class = ERROR_CLASSES[response.code.to_i] || Error
|
40
|
-
error_message = "#{response.code} #{response.message}"
|
41
|
-
raise error_class.new(error_message, response: response)
|
42
42
|
end
|
43
43
|
|
44
44
|
private
|
45
45
|
|
46
|
-
def
|
47
|
-
response.is_a?(Net::HTTPSuccess)
|
46
|
+
def success?(response)
|
47
|
+
response.is_a?(Net::HTTPSuccess)
|
48
|
+
end
|
49
|
+
|
50
|
+
def json?(response)
|
51
|
+
response.body && JSON_CONTENT_TYPE_REGEXP.match?(response["content-type"])
|
48
52
|
end
|
49
53
|
end
|
50
54
|
end
|
data/lib/x/version.rb
CHANGED
data/sig/x.rbs
CHANGED
@@ -28,10 +28,9 @@ module X
|
|
28
28
|
def generate_signature: (String method, String url, Hash[String, String] params) -> String
|
29
29
|
def hmac_signature: (String base_string) -> String
|
30
30
|
def signature_base_string: (String method, String url, Hash[String, String] params) -> String
|
31
|
-
def encode_params: (Hash[String, String] params) -> String
|
32
31
|
def signing_key: -> String
|
33
32
|
def format_oauth_header: (Hash[String, String] params) -> String
|
34
|
-
def
|
33
|
+
def escape: (String value) -> String
|
35
34
|
end
|
36
35
|
|
37
36
|
class Error < StandardError
|
@@ -93,10 +92,11 @@ module X
|
|
93
92
|
@http_client: Net::HTTP
|
94
93
|
|
95
94
|
attr_reader base_uri: URI::Generic
|
95
|
+
attr_reader proxy_uri: URI::Generic?
|
96
96
|
attr_reader open_timeout : Float | Integer
|
97
97
|
attr_reader read_timeout : Float | Integer
|
98
98
|
attr_reader write_timeout : Float | Integer
|
99
|
-
def initialize: (?base_url: URI::Generic | String, ?open_timeout: Float | Integer, ?read_timeout: Float | Integer, ?write_timeout: Float | Integer, ?debug_output: IO?) -> void
|
99
|
+
def initialize: (?base_url: URI::Generic | String, ?open_timeout: Float | Integer, ?read_timeout: Float | Integer, ?write_timeout: Float | Integer, ?proxy_url: URI::Generic? | String?, ?debug_output: IO?) -> void
|
100
100
|
def send_request: (Net::HTTPRequest request) -> Net::HTTPResponse
|
101
101
|
def base_uri=: (URI::Generic | String base_url) -> void
|
102
102
|
def debug_output: -> IO?
|
@@ -105,6 +105,7 @@ module X
|
|
105
105
|
def apply_http_client_settings: (open_timeout: Float | Integer, read_timeout: Float | Integer, write_timeout: Float | Integer, debug_output: IO?) -> untyped
|
106
106
|
def current_http_client_settings: -> {open_timeout: Float | Integer, read_timeout: Float | Integer, write_timeout: Float | Integer, debug_output: IO?}
|
107
107
|
def update_http_client_settings: -> untyped
|
108
|
+
def build_http_client: (host: String, port: Integer) -> (Net::HTTP)
|
108
109
|
def conditionally_apply_http_client_settings: { -> untyped } -> untyped
|
109
110
|
end
|
110
111
|
|
@@ -119,13 +120,14 @@ module X
|
|
119
120
|
attr_accessor content_type: String
|
120
121
|
attr_accessor user_agent: String
|
121
122
|
def initialize: (?content_type: String, ?user_agent: String) -> void
|
122
|
-
def build: (BearerTokenAuthenticator | OauthAuthenticator authenticator, Symbol http_method, URI::Generic
|
123
|
+
def build: (BearerTokenAuthenticator | OauthAuthenticator authenticator, Symbol http_method, URI::Generic uri, ?body: String?) -> (Net::HTTPRequest)
|
123
124
|
|
124
125
|
private
|
125
|
-
def create_request: (Symbol http_method, URI::Generic
|
126
|
+
def create_request: (Symbol http_method, URI::Generic uri, String? body) -> (Net::HTTPRequest)
|
126
127
|
def add_authorization: (Net::HTTPRequest request, BearerTokenAuthenticator | OauthAuthenticator authenticator) -> void
|
127
128
|
def add_content_type: (Net::HTTPRequest request) -> void
|
128
129
|
def add_user_agent: (Net::HTTPRequest request) -> void
|
130
|
+
def escape_query_params: (URI::Generic uri) -> URI::Generic
|
129
131
|
end
|
130
132
|
|
131
133
|
class RedirectHandler
|
@@ -153,10 +155,11 @@ module X
|
|
153
155
|
attr_accessor array_class: Class
|
154
156
|
attr_accessor object_class: Class
|
155
157
|
def initialize: (?array_class: Class, ?object_class: Class) -> void
|
156
|
-
def handle: (Net::HTTPResponse response) -> Hash[String, untyped]
|
158
|
+
def handle: (Net::HTTPResponse response) -> Hash[String, untyped]?
|
157
159
|
|
158
160
|
private
|
159
|
-
def
|
161
|
+
def success?: (Net::HTTPResponse response) -> bool
|
162
|
+
def json?: (Net::HTTPResponse response) -> bool
|
160
163
|
end
|
161
164
|
|
162
165
|
class Client
|
@@ -168,14 +171,14 @@ module X
|
|
168
171
|
@response_handler: ResponseHandler
|
169
172
|
|
170
173
|
attr_reader base_uri: URI::Generic
|
171
|
-
def initialize: (?bearer_token: String?, ?api_key: String?, ?api_key_secret: String?, ?access_token: String?, ?access_token_secret: String?, ?base_url: URI::Generic | String, ?content_type: String, ?user_agent: String, ?open_timeout: Float | Integer, ?read_timeout: Float | Integer, ?write_timeout: Float | Integer, ?debug_output: IO?, ?array_class: Class, ?object_class: Class, ?max_redirects: Integer) -> void
|
172
|
-
def get: (String endpoint) -> Hash[String, untyped]
|
173
|
-
def post: (String endpoint, ?nil body) -> Hash[String, untyped]
|
174
|
-
def put: (String endpoint, ?nil body) -> Hash[String, untyped]
|
175
|
-
def delete: (String endpoint) -> Hash[String, untyped]
|
174
|
+
def initialize: (?bearer_token: String?, ?api_key: String?, ?api_key_secret: String?, ?access_token: String?, ?access_token_secret: String?, ?base_url: URI::Generic | String, ?content_type: String, ?user_agent: String, ?open_timeout: Float | Integer, ?read_timeout: Float | Integer, ?write_timeout: Float | Integer, ?proxy_url: URI::Generic? | String?, ?debug_output: IO?, ?array_class: Class, ?object_class: Class, ?max_redirects: Integer) -> void
|
175
|
+
def get: (String endpoint) -> Hash[String, untyped]?
|
176
|
+
def post: (String endpoint, ?nil body) -> Hash[String, untyped]?
|
177
|
+
def put: (String endpoint, ?nil body) -> Hash[String, untyped]?
|
178
|
+
def delete: (String endpoint) -> Hash[String, untyped]?
|
176
179
|
|
177
180
|
private
|
178
181
|
def initialize_authenticator: (String? bearer_token, String? api_key, String? api_key_secret, String? access_token, String? access_token_secret) -> (BearerTokenAuthenticator | OauthAuthenticator)
|
179
|
-
def send_request: (Symbol http_method, String endpoint, ?nil body) -> Hash[String, untyped]
|
182
|
+
def send_request: (Symbol http_method, String endpoint, ?nil body) -> Hash[String, untyped]?
|
180
183
|
end
|
181
184
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: x
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Erik Berlin
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -17,13 +17,11 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- ".rubocop.yml"
|
21
20
|
- CHANGELOG.md
|
22
|
-
- Gemfile
|
23
21
|
- LICENSE.txt
|
24
22
|
- README.md
|
25
|
-
-
|
26
|
-
-
|
23
|
+
- bin/console
|
24
|
+
- bin/setup
|
27
25
|
- lib/x.rb
|
28
26
|
- lib/x/bearer_token_authenticator.rb
|
29
27
|
- lib/x/client.rb
|
@@ -50,10 +48,12 @@ licenses:
|
|
50
48
|
- MIT
|
51
49
|
metadata:
|
52
50
|
allowed_push_host: https://rubygems.org
|
51
|
+
rubygems_mfa_required: 'true'
|
53
52
|
homepage_uri: https://sferik.github.io/x-ruby
|
54
53
|
source_code_uri: https://github.com/sferik/x-ruby
|
55
54
|
changelog_uri: https://github.com/sferik/x-ruby/blob/master/CHANGELOG.md
|
56
|
-
|
55
|
+
bug_tracker_uri: https://github.com/sferik/x-ruby/issues
|
56
|
+
documentation_uri: https://rubydoc.info/gems/x/
|
57
57
|
post_install_message:
|
58
58
|
rdoc_options: []
|
59
59
|
require_paths:
|
@@ -69,7 +69,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
|
-
rubygems_version: 3.4.
|
72
|
+
rubygems_version: 3.4.20
|
73
73
|
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: A Ruby interface to the X API.
|
data/.rubocop.yml
DELETED
@@ -1,54 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- standard
|
3
|
-
- standard-performance
|
4
|
-
- rubocop-minitest
|
5
|
-
- rubocop-performance
|
6
|
-
- rubocop-rake
|
7
|
-
|
8
|
-
AllCops:
|
9
|
-
NewCops: enable
|
10
|
-
TargetRubyVersion: 3.0
|
11
|
-
|
12
|
-
Layout/ArgumentAlignment:
|
13
|
-
Enabled: true
|
14
|
-
EnforcedStyle: with_fixed_indentation
|
15
|
-
|
16
|
-
Layout/ArrayAlignment:
|
17
|
-
Enabled: true
|
18
|
-
EnforcedStyle: with_fixed_indentation
|
19
|
-
|
20
|
-
Layout/EndAlignment:
|
21
|
-
Enabled: true
|
22
|
-
EnforcedStyleAlignWith: variable
|
23
|
-
|
24
|
-
Layout/HashAlignment:
|
25
|
-
Enabled: true
|
26
|
-
EnforcedHashRocketStyle: key
|
27
|
-
EnforcedColonStyle: key
|
28
|
-
EnforcedLastArgumentHashStyle: always_inspect
|
29
|
-
|
30
|
-
Layout/ParameterAlignment:
|
31
|
-
Enabled: true
|
32
|
-
EnforcedStyle: with_fixed_indentation
|
33
|
-
IndentationWidth: ~
|
34
|
-
|
35
|
-
Layout/SpaceInsideHashLiteralBraces:
|
36
|
-
Enabled: false
|
37
|
-
|
38
|
-
Metrics/ParameterLists:
|
39
|
-
CountKeywordArgs: false
|
40
|
-
|
41
|
-
Style/Alias:
|
42
|
-
Enabled: true
|
43
|
-
EnforcedStyle: prefer_alias_method
|
44
|
-
|
45
|
-
Style/StringLiterals:
|
46
|
-
Enabled: true
|
47
|
-
EnforcedStyle: double_quotes
|
48
|
-
|
49
|
-
Style/StringLiteralsInInterpolation:
|
50
|
-
Enabled: true
|
51
|
-
EnforcedStyle: double_quotes
|
52
|
-
|
53
|
-
Style/FrozenStringLiteralComment:
|
54
|
-
Enabled: false
|
data/Gemfile
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
source "https://rubygems.org"
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in x.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
gem "hashie", ">= 5"
|
7
|
-
gem "minitest", ">= 5.19"
|
8
|
-
gem "rake", ">= 13.0.6"
|
9
|
-
gem "rbs", ">= 3.2.1"
|
10
|
-
gem "rubocop", ">= 1.21"
|
11
|
-
gem "rubocop-minitest", ">= 0.31"
|
12
|
-
gem "rubocop-performance", ">= 1.18"
|
13
|
-
gem "rubocop-rake", ">= 0.6"
|
14
|
-
gem "simplecov", ">= 0.22"
|
15
|
-
gem "standard", ">= 1.30.1"
|
16
|
-
gem "steep", ">= 1.5.3"
|
17
|
-
gem "timecop", ">= 0.9.6"
|
18
|
-
gem "webmock", ">= 3.18.1"
|
data/Rakefile
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs << "test"
|
6
|
-
t.libs << "lib"
|
7
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
8
|
-
end
|
9
|
-
|
10
|
-
require "standard/rake"
|
11
|
-
require "rubocop/rake_task"
|
12
|
-
|
13
|
-
RuboCop::RakeTask.new
|
14
|
-
|
15
|
-
require "steep"
|
16
|
-
require "steep/cli"
|
17
|
-
|
18
|
-
desc "Type check with Steep"
|
19
|
-
task :steep do
|
20
|
-
Steep::CLI.new(argv: ["check"], stdout: $stdout, stderr: $stderr, stdin: $stdin).run
|
21
|
-
end
|
22
|
-
|
23
|
-
task default: %i[test rubocop standard steep]
|
data/Steepfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
target :lib do
|
2
|
-
signature "sig"
|
3
|
-
check "lib"
|
4
|
-
library "base64"
|
5
|
-
library "cgi"
|
6
|
-
library "forwardable"
|
7
|
-
library "json"
|
8
|
-
library "net-http"
|
9
|
-
library "openssl"
|
10
|
-
library "securerandom"
|
11
|
-
library "uri"
|
12
|
-
configure_code_diagnostics(Steep::Diagnostic::Ruby.strict)
|
13
|
-
end
|