Class: Walinko::Client
- Inherits:
-
Object
- Object
- Walinko::Client
- Defined in:
- lib/walinko.rb
Instance Attribute Summary collapse
- #config ⇒ Walinko::Configuration readonly
- #messages ⇒ Walinko::Messages readonly
Instance Method Summary collapse
-
#initialize(api_key:, **opts) ⇒ Client
constructor
A new instance of Client.
-
#last_rate_limit ⇒ Walinko::RateLimitSnapshot?
Snapshot of the rate-limit window from the most recent response.
-
#last_request_id ⇒ String?
The ‘X-Request-Id` from the most recent response (or `nil`).
Constructor Details
#initialize(api_key:, **opts) ⇒ Client
Returns a new instance of Client.
32 33 34 35 36 |
# File 'lib/walinko.rb', line 32 def initialize(api_key:, **opts) @config = Configuration.new(api_key: api_key, **opts) @http = HttpClient.new(@config) @messages = Messages.new(@http) end |
Instance Attribute Details
#config ⇒ Walinko::Configuration (readonly)
21 22 23 |
# File 'lib/walinko.rb', line 21 def config @config end |
#messages ⇒ Walinko::Messages (readonly)
24 25 26 |
# File 'lib/walinko.rb', line 24 def @messages end |
Instance Method Details
#last_rate_limit ⇒ Walinko::RateLimitSnapshot?
Snapshot of the rate-limit window from the most recent response. Returns ‘nil` until the first call has completed.
41 42 43 |
# File 'lib/walinko.rb', line 41 def last_rate_limit @http.last_rate_limit end |
#last_request_id ⇒ String?
The ‘X-Request-Id` from the most recent response (or `nil`). Useful when filing support tickets.
48 49 50 |
# File 'lib/walinko.rb', line 48 def last_request_id @http.last_request_id end |