Class: ShedCloud::PartnerApi::RequestOptions
- Inherits:
-
Object
- Object
- ShedCloud::PartnerApi::RequestOptions
- Defined in:
- lib/shedcloud/partner_api/request_options.rb
Instance Attribute Summary collapse
-
#idempotency_key ⇒ Object
readonly
Returns the value of attribute idempotency_key.
-
#if_match ⇒ Object
readonly
Returns the value of attribute if_match.
Class Method Summary collapse
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(idempotency_key: nil, if_match: nil) ⇒ RequestOptions
constructor
A new instance of RequestOptions.
Constructor Details
#initialize(idempotency_key: nil, if_match: nil) ⇒ RequestOptions
Returns a new instance of RequestOptions.
11 12 13 14 |
# File 'lib/shedcloud/partner_api/request_options.rb', line 11 def initialize(idempotency_key: nil, if_match: nil) @idempotency_key = idempotency_key @if_match = if_match end |
Instance Attribute Details
#idempotency_key ⇒ Object (readonly)
Returns the value of attribute idempotency_key.
9 10 11 |
# File 'lib/shedcloud/partner_api/request_options.rb', line 9 def idempotency_key @idempotency_key end |
#if_match ⇒ Object (readonly)
Returns the value of attribute if_match.
9 10 11 |
# File 'lib/shedcloud/partner_api/request_options.rb', line 9 def if_match @if_match end |
Class Method Details
.with_idempotency_key(key) ⇒ Object
16 17 18 |
# File 'lib/shedcloud/partner_api/request_options.rb', line 16 def self.with_idempotency_key(key) new(idempotency_key: key) end |
.with_if_match(version) ⇒ Object
20 21 22 |
# File 'lib/shedcloud/partner_api/request_options.rb', line 20 def self.with_if_match(version) new(if_match: version) end |
Instance Method Details
#headers ⇒ Object
24 25 26 27 28 29 |
# File 'lib/shedcloud/partner_api/request_options.rb', line 24 def headers out = {} out['Idempotency-Key'] = idempotency_key if idempotency_key && !idempotency_key.empty? out['If-Match'] = if_match.to_s unless if_match.nil? out end |