Class: Nfe::RequestOptions

Inherits:
Data
  • Object
show all
Defined in:
lib/nfe/request_options.rb,
sig/nfe/request_options.rbs

Overview

Immutable per-call overrides for a single request. Passing a RequestOptions to Client#request (or through a resource helper) overrides the family-resolved api_key, base_url, and timeout for that one call; any nil field falls back to normal family resolution.

This enables multi-tenant per-call keys without constructing a second Nfe::Client.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, base_url: nil, timeout: nil) ⇒ RequestOptions

Returns a new instance of RequestOptions.

Parameters:

  • api_key: (String, nil) (defaults to: nil)
  • base_url: (String, nil) (defaults to: nil)
  • timeout: (Numeric, nil) (defaults to: nil)


12
13
14
# File 'lib/nfe/request_options.rb', line 12

def initialize(api_key: nil, base_url: nil, timeout: nil)
  super
end

Instance Attribute Details

#api_keyString? (readonly)

Returns the value of attribute api_key.

Returns:

  • (String, nil)


3
4
5
# File 'sig/nfe/request_options.rbs', line 3

def api_key
  @api_key
end

#base_urlString? (readonly)

Returns the value of attribute base_url.

Returns:

  • (String, nil)


4
5
6
# File 'sig/nfe/request_options.rbs', line 4

def base_url
  @base_url
end

#timeoutNumeric? (readonly)

Returns the value of attribute timeout.

Returns:

  • (Numeric, nil)


5
6
7
# File 'sig/nfe/request_options.rbs', line 5

def timeout
  @timeout
end

Class Method Details

.newinstance

Parameters:

  • api_key: (String, nil)
  • base_url: (String, nil)
  • timeout: (Numeric, nil)

Returns:

  • (instance)


7
# File 'sig/nfe/request_options.rbs', line 7

def self.new: (?api_key: String?, ?base_url: String?, ?timeout: Numeric?) -> instance