Class: Increase::RequestOptions
- Inherits:
-
Object
- Object
- Increase::RequestOptions
- Defined in:
- lib/increase/request_options.rb
Overview
Specify HTTP behaviour to use for a specific request. These options supplement or override those provided at the client level.
When making a request, you can pass an actual RequestOptions instance, or simply pass a Hash with symbol keys matching the attributes on this class.
Instance Attribute Summary collapse
-
#extra_body ⇒ Hash{Symbol => Object}
Extra data to send with the request.
-
#extra_headers ⇒ Hash{String => String}
Extra headers to send with the request.
-
#extra_query ⇒ Hash{Symbol => Object}
Extra query params to send with the request.
-
#idempotency_key ⇒ String
Idempotency key to send with request and all associated retries.
-
#max_retries ⇒ Integer
Maximum number of retries to attempt after a failed initial request.
Instance Method Summary collapse
-
#[](key) ⇒ Object
Lookup an option previously set on this instance.
-
#initialize(values = {}) ⇒ RequestOptions
constructor
Returns a new instance of RequestOptions.
- #inspect ⇒ String
-
#to_h ⇒ Hash{Symbol => Object}
(also: #to_hash)
Return a Hash containing the options set on this instance.
- #to_s ⇒ String
Constructor Details
#initialize(values = {}) ⇒ RequestOptions
Returns a new instance of RequestOptions.
25 26 27 |
# File 'lib/increase/request_options.rb', line 25 def initialize(values = {}) @_values = values end |
Instance Attribute Details
#extra_body ⇒ Hash{Symbol => Object}
Extra data to send with the request. These are deep merged into any data generated as part of the normal request.
51 |
# File 'lib/increase/request_options.rb', line 51 option :extra_body |
#extra_headers ⇒ Hash{String => String}
Extra headers to send with the request. These are .merged
’d into any extra_headers
given at the
client level.
39 |
# File 'lib/increase/request_options.rb', line 39 option :extra_headers |
#extra_query ⇒ Hash{Symbol => Object}
Extra query params to send with the request. These are .merge
’d into any query
given at
the client level.
45 |
# File 'lib/increase/request_options.rb', line 45 option :extra_query |
#idempotency_key ⇒ String
Idempotency key to send with request and all associated retries. Will only be sent for write requests.
33 |
# File 'lib/increase/request_options.rb', line 33 option :idempotency_key |
#max_retries ⇒ Integer
Maximum number of retries to attempt after a failed initial request.
56 |
# File 'lib/increase/request_options.rb', line 56 option :max_retries |
Instance Method Details
#[](key) ⇒ Object
Lookup an option previously set on this instance.
61 62 63 |
# File 'lib/increase/request_options.rb', line 61 def [](key) @_values[key] end |
#inspect ⇒ String
75 76 77 |
# File 'lib/increase/request_options.rb', line 75 def inspect "#<Increase::RequestOptions:0x#{object_id.to_s(16)} #{@_values.inspect}>" end |
#to_h ⇒ Hash{Symbol => Object} Also known as: to_hash
Return a Hash containing the options set on this instance.
68 69 70 |
# File 'lib/increase/request_options.rb', line 68 def to_h @_values end |
#to_s ⇒ String
80 81 82 |
# File 'lib/increase/request_options.rb', line 80 def to_s @_values.to_s end |