x-core 1.0.0
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 +7 -0
- data/.yardopts +8 -0
- data/CHANGELOG.md +353 -0
- data/LICENSE.txt +21 -0
- data/README.md +54 -0
- data/lib/x/core/app_only_authenticator.rb +198 -0
- data/lib/x/core/authenticator.rb +74 -0
- data/lib/x/core/authenticator_request.rb +56 -0
- data/lib/x/core/bearer_token_authenticator.rb +46 -0
- data/lib/x/core/built_response.rb +100 -0
- data/lib/x/core/client.rb +728 -0
- data/lib/x/core/client_app_only.rb +115 -0
- data/lib/x/core/client_credentials.rb +193 -0
- data/lib/x/core/client_internals.rb +315 -0
- data/lib/x/core/client_memo.rb +58 -0
- data/lib/x/core/client_settings.rb +166 -0
- data/lib/x/core/client_token_refresh.rb +281 -0
- data/lib/x/core/connection.rb +328 -0
- data/lib/x/core/connection_pool.rb +123 -0
- data/lib/x/core/connection_proxy.rb +151 -0
- data/lib/x/core/connection_request.rb +90 -0
- data/lib/x/core/credential_holder.rb +78 -0
- data/lib/x/core/credential_validator.rb +286 -0
- data/lib/x/core/errors/authorization_denied.rb +55 -0
- data/lib/x/core/errors/authorization_error.rb +41 -0
- data/lib/x/core/errors/bad_gateway.rb +9 -0
- data/lib/x/core/errors/bad_request.rb +10 -0
- data/lib/x/core/errors/callback_error.rb +88 -0
- data/lib/x/core/errors/client_error.rb +17 -0
- data/lib/x/core/errors/conflict.rb +9 -0
- data/lib/x/core/errors/error.rb +66 -0
- data/lib/x/core/errors/forbidden.rb +10 -0
- data/lib/x/core/errors/gateway_timeout.rb +9 -0
- data/lib/x/core/errors/gone.rb +9 -0
- data/lib/x/core/errors/http_error.rb +333 -0
- data/lib/x/core/errors/internal_server_error.rb +9 -0
- data/lib/x/core/errors/invalid_response.rb +96 -0
- data/lib/x/core/errors/method_not_allowed.rb +10 -0
- data/lib/x/core/errors/network_error.rb +59 -0
- data/lib/x/core/errors/not_acceptable.rb +10 -0
- data/lib/x/core/errors/not_found.rb +15 -0
- data/lib/x/core/errors/payload_too_large.rb +10 -0
- data/lib/x/core/errors/payment_required.rb +10 -0
- data/lib/x/core/errors/request_timeout.rb +9 -0
- data/lib/x/core/errors/server_error.rb +15 -0
- data/lib/x/core/errors/service_unavailable.rb +9 -0
- data/lib/x/core/errors/token_report_failed.rb +59 -0
- data/lib/x/core/errors/too_many_redirects.rb +53 -0
- data/lib/x/core/errors/too_many_requests.rb +80 -0
- data/lib/x/core/errors/unauthorized.rb +15 -0
- data/lib/x/core/errors/unavailable_for_legal_reasons.rb +10 -0
- data/lib/x/core/errors/unprocessable_entity.rb +10 -0
- data/lib/x/core/errors/unsupported_format.rb +22 -0
- data/lib/x/core/errors/unsupported_media_type.rb +10 -0
- data/lib/x/core/errors/unsupported_operation.rb +18 -0
- data/lib/x/core/oauth1_authenticator.rb +142 -0
- data/lib/x/core/oauth2_authenticator.rb +296 -0
- data/lib/x/core/oauth2_authorization.rb +405 -0
- data/lib/x/core/oauth2_refresh.rb +272 -0
- data/lib/x/core/oauth2_tokens.rb +277 -0
- data/lib/x/core/origin.rb +95 -0
- data/lib/x/core/problem.rb +302 -0
- data/lib/x/core/proxy_setting.rb +22 -0
- data/lib/x/core/rate_limit.rb +137 -0
- data/lib/x/core/rate_limit_handler.rb +166 -0
- data/lib/x/core/redirect_handler.rb +208 -0
- data/lib/x/core/refresh_reporter.rb +92 -0
- data/lib/x/core/request_builder.rb +155 -0
- data/lib/x/core/request_context.rb +85 -0
- data/lib/x/core/request_encoding.rb +135 -0
- data/lib/x/core/response.rb +196 -0
- data/lib/x/core/response_headers.rb +31 -0
- data/lib/x/core/response_parser.rb +155 -0
- data/lib/x/core/retry_handler.rb +149 -0
- data/lib/x/core/setting_validator.rb +399 -0
- data/lib/x/core/stream_body.rb +77 -0
- data/lib/x/core/stream_response.rb +267 -0
- data/lib/x/core/token_endpoint.rb +238 -0
- data/lib/x/core/version.rb +25 -0
- data/lib/x/core.rb +6 -0
- data/sig/manifest.yaml +8 -0
- data/sig/x-core.rbs +396 -0
- metadata +162 -0
data/sig/x-core.rbs
ADDED
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
# The public interface of x-core, as its @api public documentation states it. The modules X::Client and the errors
|
|
2
|
+
# include, the handlers, parsers, and connection of X::Core, and the constants, methods, and instance variables the
|
|
3
|
+
# code keeps private are declared in sig/internal/x-core.rbs, which reopens the same modules and classes, so that
|
|
4
|
+
# Steep type checks the gem against them, but which the gem does not ship. The public methods those modules give a
|
|
5
|
+
# class are declared here on the class.
|
|
6
|
+
module X
|
|
7
|
+
module Core
|
|
8
|
+
VERSION: String
|
|
9
|
+
|
|
10
|
+
def self.gem_version: () -> Gem::Version
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# What an authenticator is guaranteed to read of the request it authenticates, which is all the authenticators of
|
|
14
|
+
# x-core read of it: its method, as a Symbol, the URI it is sent to, its body, and a header by its name
|
|
15
|
+
interface _AuthenticatorRequest
|
|
16
|
+
def http_method: () -> Symbol
|
|
17
|
+
def uri: () -> URI::Generic
|
|
18
|
+
def body: () -> String?
|
|
19
|
+
def []: (String name) -> String?
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
class Authenticator
|
|
23
|
+
AUTHENTICATION_HEADER: String
|
|
24
|
+
|
|
25
|
+
def user_id: () -> Integer?
|
|
26
|
+
def inspect: () -> String
|
|
27
|
+
def headers: (_AuthenticatorRequest request) -> Hash[String, String]
|
|
28
|
+
def marshal_dump: () -> bot
|
|
29
|
+
def encode_with: (untyped coder) -> bot
|
|
30
|
+
def as_json: (*untyped) -> bot
|
|
31
|
+
def to_json: (?JSON::State? state) -> bot
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
class BearerTokenAuthenticator < Authenticator
|
|
35
|
+
def initialize: (bearer_token: String) -> void
|
|
36
|
+
def headers: (_AuthenticatorRequest? request) -> Hash[String, String]
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
class OAuth2Authorization
|
|
40
|
+
AUTHORIZATION_URL: String
|
|
41
|
+
DEFAULT_SCOPES: Array[String]
|
|
42
|
+
|
|
43
|
+
attr_reader client_id: String
|
|
44
|
+
attr_reader redirect_uri: String
|
|
45
|
+
attr_reader scopes: Array[String]
|
|
46
|
+
attr_reader state: String
|
|
47
|
+
attr_reader code_verifier: String
|
|
48
|
+
|
|
49
|
+
def initialize: (client_id: String, redirect_uri: String, ?client_secret: String?, ?scopes: Array[String], ?state: String, ?code_verifier: String, ?base_url: String, ?proxy_url: (URI::Generic | String)?, ?open_timeout: Numeric?, ?read_timeout: Numeric?, ?write_timeout: Numeric?, ?keep_alive_timeout: Numeric, ?debug_output: _DebugOutput?, ?headers: headers) -> void
|
|
50
|
+
def inspect: () -> String
|
|
51
|
+
def url: () -> String
|
|
52
|
+
def tokens: (String | Hash[String | Symbol, String] callback) -> OAuth2Tokens
|
|
53
|
+
def client: (String | Hash[String | Symbol, String] callback, ?base_url: String, ?open_timeout: Numeric?, ?read_timeout: Numeric?, ?write_timeout: Numeric?, ?keep_alive_timeout: Numeric, ?debug_output: _DebugOutput?, ?proxy_url: (URI::Generic | String)?, ?default_array_class: Class, ?default_object_class: object_class, ?headers: headers, ?max_redirects: Integer, ?max_rate_limit_retries: Integer, ?max_rate_limit_wait: Numeric, ?max_retries: Integer, ?on_response: _ResponseHook?, ?save_tokens: _TokenSaver?, ?load_tokens: _TokenLoader?) -> Client
|
|
54
|
+
def marshal_dump: () -> bot
|
|
55
|
+
def encode_with: (untyped coder) -> bot
|
|
56
|
+
def as_json: (*untyped) -> bot
|
|
57
|
+
def to_json: (?JSON::State? state) -> bot
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
class AuthorizationDenied < Error
|
|
61
|
+
attr_reader error_code: String?
|
|
62
|
+
|
|
63
|
+
def initialize: (?String? message, ?error_code: String?) -> void
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
class TokenReportFailed < Error
|
|
67
|
+
attr_reader client: Client?
|
|
68
|
+
attr_reader tokens: OAuth2Tokens?
|
|
69
|
+
|
|
70
|
+
def initialize: (?String? message, ?client: Client?, ?tokens: OAuth2Tokens?) -> void
|
|
71
|
+
def to_s: () -> String
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
class AppOnlyAuthenticator < Authenticator
|
|
75
|
+
|
|
76
|
+
attr_reader api_key: String
|
|
77
|
+
def initialize: (api_key: String, api_key_secret: String, ?bearer_token: String?) -> void
|
|
78
|
+
def headers: (_AuthenticatorRequest? request) -> Hash[String, String]
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
class OAuth1Authenticator < Authenticator
|
|
82
|
+
attr_reader api_key: String
|
|
83
|
+
def initialize: (api_key: String, api_key_secret: String, access_token: String, access_token_secret: String) -> void
|
|
84
|
+
def user_id: () -> Integer?
|
|
85
|
+
def headers: (_AuthenticatorRequest request) -> Hash[String, String]
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
class Error < StandardError
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
class ClientError < HTTPError
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
class AuthorizationError < ClientError
|
|
95
|
+
def error_code: () -> String?
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
class BadGateway < ServerError
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
class BadRequest < ClientError
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
class Conflict < ClientError
|
|
105
|
+
end
|
|
106
|
+
|
|
107
|
+
# A resource that Problem#about? reads the identifier of, such as the resources of x-resources
|
|
108
|
+
interface _Identified
|
|
109
|
+
def id: () -> untyped
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
class Problem
|
|
113
|
+
attr_reader attrs: Hash[String, untyped]
|
|
114
|
+
|
|
115
|
+
def self.all_from: (Hash[String, untyped]? body) -> Array[Problem]
|
|
116
|
+
def initialize: (Hash[String | Symbol, untyped] attrs) -> void
|
|
117
|
+
def to_h: () -> Hash[String, untyped]
|
|
118
|
+
def title: () -> String?
|
|
119
|
+
def detail: () -> String?
|
|
120
|
+
def type: () -> String?
|
|
121
|
+
def resource_type: () -> String?
|
|
122
|
+
def resource_id: () -> String?
|
|
123
|
+
def parameter: () -> String?
|
|
124
|
+
def value: () -> untyped
|
|
125
|
+
def message: () -> String?
|
|
126
|
+
def not_found?: () -> bool
|
|
127
|
+
def disconnect?: () -> bool
|
|
128
|
+
def usage_capped?: () -> bool
|
|
129
|
+
def about?: (_Identified | Integer | String resource) -> bool
|
|
130
|
+
def ==: (untyped other) -> bool
|
|
131
|
+
def eql?: (untyped other) -> bool
|
|
132
|
+
def hash: () -> Integer
|
|
133
|
+
def as_json: (*untyped) -> Hash[String, untyped]
|
|
134
|
+
def to_json: (?JSON::State? state) -> String
|
|
135
|
+
def inspect: () -> String
|
|
136
|
+
def marshal_dump: () -> untyped
|
|
137
|
+
def marshal_load: (untyped state) -> void
|
|
138
|
+
def encode_with: (untyped coder) -> void
|
|
139
|
+
def init_with: (untyped coder) -> void
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
class HTTPError < Error
|
|
143
|
+
attr_reader http_response : Net::HTTPResponse
|
|
144
|
+
attr_reader problems: Array[Problem]
|
|
145
|
+
attr_reader problem: Problem?
|
|
146
|
+
|
|
147
|
+
def initialize: (?String? message, ?http_response: Net::HTTPResponse?, ?status: Integer?, ?headers: Hash[String | Symbol, String]?, ?body: String?, ?http_method: (Symbol | String)?, ?uri: URI::Generic?) -> void
|
|
148
|
+
def http_method: () -> Symbol?
|
|
149
|
+
def uri: () -> URI::Generic?
|
|
150
|
+
def headers: () -> Hash[String, String]
|
|
151
|
+
def status: () -> Integer
|
|
152
|
+
def body: () -> String?
|
|
153
|
+
def retry_after: () -> Integer?
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
class PaymentRequired < ClientError
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
class Forbidden < ClientError
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
class GatewayTimeout < ServerError
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
class Gone < ClientError
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
class InternalServerError < ServerError
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
class MethodNotAllowed < ClientError
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
class NetworkError < Error
|
|
175
|
+
def initialize: (?String? message, ?http_method: (Symbol | String)?, ?uri: URI::Generic?) -> void
|
|
176
|
+
def http_method: () -> Symbol?
|
|
177
|
+
def uri: () -> URI::Generic?
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
class NotAcceptable < ClientError
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
class NotFound < ClientError
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
class PayloadTooLarge < ClientError
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
class RequestTimeout < ClientError
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
class ServerError < HTTPError
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
class ServiceUnavailable < ServerError
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
class TooManyRedirects < Error
|
|
199
|
+
def initialize: (?String? message, ?http_method: (Symbol | String)?, ?uri: URI::Generic?) -> void
|
|
200
|
+
def http_method: () -> Symbol?
|
|
201
|
+
def uri: () -> URI::Generic?
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
class UnavailableForLegalReasons < ClientError
|
|
205
|
+
end
|
|
206
|
+
|
|
207
|
+
class UnsupportedMediaType < ClientError
|
|
208
|
+
end
|
|
209
|
+
|
|
210
|
+
class UnsupportedOperation < Error
|
|
211
|
+
end
|
|
212
|
+
|
|
213
|
+
class UnsupportedFormat < Error
|
|
214
|
+
end
|
|
215
|
+
|
|
216
|
+
class InvalidResponse < HTTPError
|
|
217
|
+
def body: () -> String?
|
|
218
|
+
|
|
219
|
+
def initialize: (?String? message, ?http_response: Net::HTTPResponse?, ?status: Integer?, ?headers: Hash[String | Symbol, String]?, ?body: String?, ?http_method: (Symbol | String)?, ?uri: URI::Generic?) -> void
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
class TooManyRequests < ClientError
|
|
223
|
+
def rate_limits: -> Array[RateLimit]
|
|
224
|
+
def rate_limit: -> RateLimit?
|
|
225
|
+
def exhausted_rate_limits: -> Array[RateLimit]
|
|
226
|
+
def limiting_rate_limit: -> RateLimit?
|
|
227
|
+
def reset_at: -> Time?
|
|
228
|
+
def reset_in: -> Integer?
|
|
229
|
+
def retry_after: -> Integer?
|
|
230
|
+
end
|
|
231
|
+
|
|
232
|
+
class Unauthorized < ClientError
|
|
233
|
+
end
|
|
234
|
+
|
|
235
|
+
class UnprocessableEntity < ClientError
|
|
236
|
+
end
|
|
237
|
+
|
|
238
|
+
# Where the requests and responses of a connection are written for debugging, as Net::HTTP writes them: an IO,
|
|
239
|
+
# a StringIO, a Logger, or anything else that takes a String with <<
|
|
240
|
+
interface _DebugOutput
|
|
241
|
+
def <<: (String data) -> untyped
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
interface _ResponseHook
|
|
245
|
+
def call: (Response response) -> untyped
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
class StreamResponse
|
|
249
|
+
attr_reader uri: URI::Generic
|
|
250
|
+
attr_reader http_response: Net::HTTPResponse
|
|
251
|
+
|
|
252
|
+
def headers: () -> Hash[String, String]
|
|
253
|
+
def status: () -> Integer
|
|
254
|
+
def rate_limits: () -> Array[RateLimit]
|
|
255
|
+
def rate_limit: () -> RateLimit?
|
|
256
|
+
def read_body: () -> String?
|
|
257
|
+
| () { (String chunk) -> void } -> nil
|
|
258
|
+
end
|
|
259
|
+
|
|
260
|
+
class Response
|
|
261
|
+
attr_reader http_method: Symbol
|
|
262
|
+
attr_reader uri: URI::Generic
|
|
263
|
+
attr_reader http_response: Net::HTTPResponse
|
|
264
|
+
|
|
265
|
+
def initialize: (http_method: Symbol | String, uri: URI::Generic, ?http_response: Net::HTTPResponse?, ?status: Integer?, ?headers: Hash[String | Symbol, String]?, ?body: String?) -> void
|
|
266
|
+
def headers: () -> Hash[String, String]
|
|
267
|
+
def body: () -> String?
|
|
268
|
+
def status: () -> Integer
|
|
269
|
+
def success?: () -> bool
|
|
270
|
+
def rate_limits: () -> Array[RateLimit]
|
|
271
|
+
def rate_limit: () -> RateLimit?
|
|
272
|
+
def resource_counts: () -> Hash[String, Integer]
|
|
273
|
+
def resource_count: () -> Integer
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
class RateLimit
|
|
277
|
+
RATE_LIMIT_TYPE: String
|
|
278
|
+
APP_LIMIT_TYPE: String
|
|
279
|
+
USER_LIMIT_TYPE: String
|
|
280
|
+
TYPES: Array[String]
|
|
281
|
+
|
|
282
|
+
attr_reader type: String
|
|
283
|
+
def limit: -> Integer
|
|
284
|
+
def remaining: -> Integer
|
|
285
|
+
def exhausted?: -> bool
|
|
286
|
+
def reset_at: -> Time
|
|
287
|
+
def reset_in: -> Integer
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
class OAuth2Authenticator < Authenticator
|
|
291
|
+
|
|
292
|
+
attr_reader client_id: String
|
|
293
|
+
attr_reader expires_at: Time?
|
|
294
|
+
attr_reader scopes: Array[String]?
|
|
295
|
+
def initialize: (client_id: String, access_token: String, ?refresh_token: String?, ?client_secret: String?, ?expires_at: Time?, ?scopes: Array[String]?, ?load_tokens: _TokenLoader?) -> void
|
|
296
|
+
def inspect: () -> String
|
|
297
|
+
def token_expired?: -> bool
|
|
298
|
+
def refresh!: -> OAuth2Tokens
|
|
299
|
+
def headers: (_AuthenticatorRequest? request) -> Hash[String, String]
|
|
300
|
+
end
|
|
301
|
+
|
|
302
|
+
class OAuth2Tokens
|
|
303
|
+
def self.from_json: (String | Hash[String | Symbol, untyped] json) -> OAuth2Tokens
|
|
304
|
+
attr_reader access_token: String
|
|
305
|
+
attr_reader refresh_token: String?
|
|
306
|
+
attr_reader expires_at: Time?
|
|
307
|
+
attr_reader scopes: Array[String]?
|
|
308
|
+
def initialize: (access_token: String, ?refresh_token: String?, ?expires_at: Time?, ?scopes: Array[String]?) -> void
|
|
309
|
+
def to_h: () -> {access_token: String, refresh_token: String?, expires_at: Time?, scopes: Array[String]?}
|
|
310
|
+
def ==: (untyped other) -> bool
|
|
311
|
+
def eql?: (untyped other) -> bool
|
|
312
|
+
def hash: () -> Integer
|
|
313
|
+
def as_json: (*untyped) -> Hash[String, untyped]
|
|
314
|
+
def to_json: (?JSON::State? state) -> String
|
|
315
|
+
def inspect: () -> String
|
|
316
|
+
def marshal_dump: () -> untyped
|
|
317
|
+
def marshal_load: (untyped state) -> void
|
|
318
|
+
def encode_with: (untyped coder) -> void
|
|
319
|
+
def init_with: (untyped coder) -> void
|
|
320
|
+
end
|
|
321
|
+
|
|
322
|
+
interface _TokenSaver
|
|
323
|
+
def call: (OAuth2Tokens tokens) -> untyped
|
|
324
|
+
end
|
|
325
|
+
|
|
326
|
+
# What reads the OAuth2Tokens in the storage that the processes sharing the tokens of a user read, or nil for none
|
|
327
|
+
interface _TokenLoader
|
|
328
|
+
def call: () -> OAuth2Tokens?
|
|
329
|
+
end
|
|
330
|
+
|
|
331
|
+
# What builds the result of a request from the whole of its parsed body, as the object_class of a request, a
|
|
332
|
+
# stream, or a client; later versions of 1.x may pass it keywords of their own, which it accepts with **
|
|
333
|
+
interface _ResponseBuilder
|
|
334
|
+
def from_response: (untyped body, client: Client, **untyped) -> untyped
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
# The object_class of a request: a class JSON.parse builds each JSON object into, or a response builder
|
|
338
|
+
type object_class = Class | _ResponseBuilder
|
|
339
|
+
|
|
340
|
+
type params = Hash[String | Symbol, untyped]
|
|
341
|
+
type headers = Hash[String | Symbol, String]
|
|
342
|
+
type body = String | Hash[untyped, untyped] | Array[untyped]
|
|
343
|
+
|
|
344
|
+
class Client
|
|
345
|
+
DEFAULT_BASE_URL: String
|
|
346
|
+
DEFAULT_ARRAY_CLASS: singleton(Array)
|
|
347
|
+
DEFAULT_OBJECT_CLASS: singleton(Hash)
|
|
348
|
+
DEFAULT_OPEN_TIMEOUT: Float | Integer
|
|
349
|
+
DEFAULT_READ_TIMEOUT: Float | Integer
|
|
350
|
+
DEFAULT_WRITE_TIMEOUT: Float | Integer
|
|
351
|
+
DEFAULT_KEEP_ALIVE_TIMEOUT: Float | Integer
|
|
352
|
+
DEFAULT_MAX_REDIRECTS: Integer
|
|
353
|
+
DEFAULT_MAX_RATE_LIMIT_RETRIES: Integer
|
|
354
|
+
DEFAULT_MAX_RATE_LIMIT_WAIT: Float | Integer
|
|
355
|
+
DEFAULT_MAX_RETRIES: Integer
|
|
356
|
+
|
|
357
|
+
attr_reader save_tokens: _TokenSaver?
|
|
358
|
+
attr_reader load_tokens: _TokenLoader?
|
|
359
|
+
attr_reader authenticator: Authenticator | AppOnlyAuthenticator | BearerTokenAuthenticator | OAuth1Authenticator | OAuth2Authenticator
|
|
360
|
+
def initialize: (?api_key: String?, ?api_key_secret: String?, ?access_token: String?, ?access_token_secret: String?, ?bearer_token: String?, ?client_id: String?, ?client_secret: String?, ?refresh_token: String?, ?expires_at: Time?, ?scopes: Array[String]?, ?authenticator: Authenticator?, ?base_url: String, ?open_timeout: Numeric?, ?read_timeout: Numeric?, ?write_timeout: Numeric?, ?keep_alive_timeout: Numeric, ?debug_output: _DebugOutput?, ?proxy_url: (URI::Generic | String)?, ?default_array_class: Class, ?default_object_class: object_class, ?headers: headers, ?max_redirects: Integer, ?max_rate_limit_retries: Integer, ?max_rate_limit_wait: Numeric, ?max_retries: Integer, ?on_response: _ResponseHook?, ?save_tokens: _TokenSaver?, ?load_tokens: _TokenLoader?) -> void
|
|
361
|
+
def inspect: () -> String
|
|
362
|
+
def with: (?api_key: String?, ?api_key_secret: String?, ?access_token: String?, ?access_token_secret: String?, ?bearer_token: String?, ?client_id: String?, ?client_secret: String?, ?refresh_token: String?, ?expires_at: Time?, ?scopes: Array[String]?, ?authenticator: Authenticator?, ?base_url: String, ?open_timeout: Numeric?, ?read_timeout: Numeric?, ?write_timeout: Numeric?, ?keep_alive_timeout: Numeric, ?debug_output: _DebugOutput?, ?proxy_url: (URI::Generic | String)?, ?default_array_class: Class, ?default_object_class: object_class, ?headers: headers, ?max_redirects: Integer, ?max_rate_limit_retries: Integer, ?max_rate_limit_wait: Numeric, ?max_retries: Integer, ?on_response: _ResponseHook?, ?save_tokens: _TokenSaver?, ?load_tokens: _TokenLoader?) -> Client
|
|
363
|
+
def app_only: () -> (Client | self)
|
|
364
|
+
def api_key: () -> String?
|
|
365
|
+
def client_id: () -> String?
|
|
366
|
+
def expires_at: () -> Time?
|
|
367
|
+
def scopes: () -> Array[String]?
|
|
368
|
+
def base_url: () -> String
|
|
369
|
+
def default_array_class: () -> Class
|
|
370
|
+
def default_object_class: () -> object_class
|
|
371
|
+
def on_response: () -> _ResponseHook?
|
|
372
|
+
def headers: () -> Hash[String, String]
|
|
373
|
+
def open_timeout: () -> Numeric?
|
|
374
|
+
def read_timeout: () -> Numeric?
|
|
375
|
+
def write_timeout: () -> Numeric?
|
|
376
|
+
def keep_alive_timeout: () -> Numeric
|
|
377
|
+
def debug_output: () -> _DebugOutput?
|
|
378
|
+
def max_redirects: () -> Integer
|
|
379
|
+
def max_rate_limit_retries: () -> Integer
|
|
380
|
+
def max_rate_limit_wait: () -> Numeric
|
|
381
|
+
def max_retries: () -> Integer
|
|
382
|
+
def get: (String endpoint, ?params: params?, ?headers: headers, ?array_class: Class, ?object_class: object_class) ?{ (Response) -> void } -> untyped
|
|
383
|
+
def post: (String endpoint, ?body? body, ?params: params?, ?form: params?, ?headers: headers, ?array_class: Class, ?object_class: object_class) ?{ (Response) -> void } -> untyped
|
|
384
|
+
def put: (String endpoint, ?body? body, ?params: params?, ?form: params?, ?headers: headers, ?array_class: Class, ?object_class: object_class) ?{ (Response) -> void } -> untyped
|
|
385
|
+
def delete: (String endpoint, ?params: params?, ?headers: headers, ?array_class: Class, ?object_class: object_class) ?{ (Response) -> void } -> untyped
|
|
386
|
+
def get_stream: [T] (String endpoint, ?params: params?, ?headers: headers) { (StreamResponse response) -> T } -> T
|
|
387
|
+
def close: () -> void
|
|
388
|
+
def with_retries: [T] () { () -> T } -> T
|
|
389
|
+
def memoized: (Symbol key) -> untyped
|
|
390
|
+
def memoize: [T] (Symbol key, T value) -> T
|
|
391
|
+
def marshal_dump: () -> bot
|
|
392
|
+
def encode_with: (untyped coder) -> bot
|
|
393
|
+
def as_json: (*untyped) -> bot
|
|
394
|
+
def to_json: (?JSON::State? state) -> bot
|
|
395
|
+
end
|
|
396
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: x-core
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Erik Berlin
|
|
8
|
+
bindir: bin
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: net-http
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - "~>"
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0.9'
|
|
19
|
+
- - ">="
|
|
20
|
+
- !ruby/object:Gem::Version
|
|
21
|
+
version: 0.9.1
|
|
22
|
+
type: :runtime
|
|
23
|
+
prerelease: false
|
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
25
|
+
requirements:
|
|
26
|
+
- - "~>"
|
|
27
|
+
- !ruby/object:Gem::Version
|
|
28
|
+
version: '0.9'
|
|
29
|
+
- - ">="
|
|
30
|
+
- !ruby/object:Gem::Version
|
|
31
|
+
version: 0.9.1
|
|
32
|
+
- !ruby/object:Gem::Dependency
|
|
33
|
+
name: simple_oauth
|
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
|
35
|
+
requirements:
|
|
36
|
+
- - "~>"
|
|
37
|
+
- !ruby/object:Gem::Version
|
|
38
|
+
version: '1.0'
|
|
39
|
+
type: :runtime
|
|
40
|
+
prerelease: false
|
|
41
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
42
|
+
requirements:
|
|
43
|
+
- - "~>"
|
|
44
|
+
- !ruby/object:Gem::Version
|
|
45
|
+
version: '1.0'
|
|
46
|
+
email:
|
|
47
|
+
- sferik@gmail.com
|
|
48
|
+
executables: []
|
|
49
|
+
extensions: []
|
|
50
|
+
extra_rdoc_files: []
|
|
51
|
+
files:
|
|
52
|
+
- ".yardopts"
|
|
53
|
+
- CHANGELOG.md
|
|
54
|
+
- LICENSE.txt
|
|
55
|
+
- README.md
|
|
56
|
+
- lib/x/core.rb
|
|
57
|
+
- lib/x/core/app_only_authenticator.rb
|
|
58
|
+
- lib/x/core/authenticator.rb
|
|
59
|
+
- lib/x/core/authenticator_request.rb
|
|
60
|
+
- lib/x/core/bearer_token_authenticator.rb
|
|
61
|
+
- lib/x/core/built_response.rb
|
|
62
|
+
- lib/x/core/client.rb
|
|
63
|
+
- lib/x/core/client_app_only.rb
|
|
64
|
+
- lib/x/core/client_credentials.rb
|
|
65
|
+
- lib/x/core/client_internals.rb
|
|
66
|
+
- lib/x/core/client_memo.rb
|
|
67
|
+
- lib/x/core/client_settings.rb
|
|
68
|
+
- lib/x/core/client_token_refresh.rb
|
|
69
|
+
- lib/x/core/connection.rb
|
|
70
|
+
- lib/x/core/connection_pool.rb
|
|
71
|
+
- lib/x/core/connection_proxy.rb
|
|
72
|
+
- lib/x/core/connection_request.rb
|
|
73
|
+
- lib/x/core/credential_holder.rb
|
|
74
|
+
- lib/x/core/credential_validator.rb
|
|
75
|
+
- lib/x/core/errors/authorization_denied.rb
|
|
76
|
+
- lib/x/core/errors/authorization_error.rb
|
|
77
|
+
- lib/x/core/errors/bad_gateway.rb
|
|
78
|
+
- lib/x/core/errors/bad_request.rb
|
|
79
|
+
- lib/x/core/errors/callback_error.rb
|
|
80
|
+
- lib/x/core/errors/client_error.rb
|
|
81
|
+
- lib/x/core/errors/conflict.rb
|
|
82
|
+
- lib/x/core/errors/error.rb
|
|
83
|
+
- lib/x/core/errors/forbidden.rb
|
|
84
|
+
- lib/x/core/errors/gateway_timeout.rb
|
|
85
|
+
- lib/x/core/errors/gone.rb
|
|
86
|
+
- lib/x/core/errors/http_error.rb
|
|
87
|
+
- lib/x/core/errors/internal_server_error.rb
|
|
88
|
+
- lib/x/core/errors/invalid_response.rb
|
|
89
|
+
- lib/x/core/errors/method_not_allowed.rb
|
|
90
|
+
- lib/x/core/errors/network_error.rb
|
|
91
|
+
- lib/x/core/errors/not_acceptable.rb
|
|
92
|
+
- lib/x/core/errors/not_found.rb
|
|
93
|
+
- lib/x/core/errors/payload_too_large.rb
|
|
94
|
+
- lib/x/core/errors/payment_required.rb
|
|
95
|
+
- lib/x/core/errors/request_timeout.rb
|
|
96
|
+
- lib/x/core/errors/server_error.rb
|
|
97
|
+
- lib/x/core/errors/service_unavailable.rb
|
|
98
|
+
- lib/x/core/errors/token_report_failed.rb
|
|
99
|
+
- lib/x/core/errors/too_many_redirects.rb
|
|
100
|
+
- lib/x/core/errors/too_many_requests.rb
|
|
101
|
+
- lib/x/core/errors/unauthorized.rb
|
|
102
|
+
- lib/x/core/errors/unavailable_for_legal_reasons.rb
|
|
103
|
+
- lib/x/core/errors/unprocessable_entity.rb
|
|
104
|
+
- lib/x/core/errors/unsupported_format.rb
|
|
105
|
+
- lib/x/core/errors/unsupported_media_type.rb
|
|
106
|
+
- lib/x/core/errors/unsupported_operation.rb
|
|
107
|
+
- lib/x/core/oauth1_authenticator.rb
|
|
108
|
+
- lib/x/core/oauth2_authenticator.rb
|
|
109
|
+
- lib/x/core/oauth2_authorization.rb
|
|
110
|
+
- lib/x/core/oauth2_refresh.rb
|
|
111
|
+
- lib/x/core/oauth2_tokens.rb
|
|
112
|
+
- lib/x/core/origin.rb
|
|
113
|
+
- lib/x/core/problem.rb
|
|
114
|
+
- lib/x/core/proxy_setting.rb
|
|
115
|
+
- lib/x/core/rate_limit.rb
|
|
116
|
+
- lib/x/core/rate_limit_handler.rb
|
|
117
|
+
- lib/x/core/redirect_handler.rb
|
|
118
|
+
- lib/x/core/refresh_reporter.rb
|
|
119
|
+
- lib/x/core/request_builder.rb
|
|
120
|
+
- lib/x/core/request_context.rb
|
|
121
|
+
- lib/x/core/request_encoding.rb
|
|
122
|
+
- lib/x/core/response.rb
|
|
123
|
+
- lib/x/core/response_headers.rb
|
|
124
|
+
- lib/x/core/response_parser.rb
|
|
125
|
+
- lib/x/core/retry_handler.rb
|
|
126
|
+
- lib/x/core/setting_validator.rb
|
|
127
|
+
- lib/x/core/stream_body.rb
|
|
128
|
+
- lib/x/core/stream_response.rb
|
|
129
|
+
- lib/x/core/token_endpoint.rb
|
|
130
|
+
- lib/x/core/version.rb
|
|
131
|
+
- sig/manifest.yaml
|
|
132
|
+
- sig/x-core.rbs
|
|
133
|
+
homepage: https://sferik.github.io/x-ruby
|
|
134
|
+
licenses:
|
|
135
|
+
- MIT
|
|
136
|
+
metadata:
|
|
137
|
+
allowed_push_host: https://rubygems.org
|
|
138
|
+
bug_tracker_uri: https://github.com/sferik/x-ruby/issues
|
|
139
|
+
changelog_uri: https://github.com/sferik/x-ruby/blob/main/x-core/CHANGELOG.md
|
|
140
|
+
documentation_uri: https://rubydoc.info/gems/x-core/
|
|
141
|
+
funding_uri: https://github.com/sponsors/sferik/
|
|
142
|
+
homepage_uri: https://sferik.github.io/x-ruby
|
|
143
|
+
rubygems_mfa_required: 'true'
|
|
144
|
+
source_code_uri: https://github.com/sferik/x-ruby/tree/main/x-core
|
|
145
|
+
rdoc_options: []
|
|
146
|
+
require_paths:
|
|
147
|
+
- lib
|
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
149
|
+
requirements:
|
|
150
|
+
- - ">="
|
|
151
|
+
- !ruby/object:Gem::Version
|
|
152
|
+
version: '3.4'
|
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
154
|
+
requirements:
|
|
155
|
+
- - ">="
|
|
156
|
+
- !ruby/object:Gem::Version
|
|
157
|
+
version: '0'
|
|
158
|
+
requirements: []
|
|
159
|
+
rubygems_version: 4.0.21
|
|
160
|
+
specification_version: 4
|
|
161
|
+
summary: 'The HTTP layer of the X gem: authentication, requests, and errors.'
|
|
162
|
+
test_files: []
|