Class: Drip::Client::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/drip/client/configuration.rb

Constant Summary collapse

CONFIGURATION_FIELDS =
%i[access_token api_key account_id url_prefix http_open_timeout http_timeout].freeze

Instance Method Summary collapse

Constructor Details

#initialize(**options) ⇒ Configuration

Returns a new instance of Configuration.

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
20
21
22
23
# File 'lib/drip/client/configuration.rb', line 13

def initialize(**options)
  remainder = options.keys - CONFIGURATION_FIELDS
  raise ArgumentError, "unknown keyword#{'s' if remainder.size > 1}: #{remainder.join(', ')}" unless remainder.empty?

  # Initialize this variable to suppress Ruby warning.
  @url_prefix = nil

  options.each do |k, v|
    public_send("#{k}=", v)
  end
end

Instance Method Details

#url_prefixObject



25
26
27
# File 'lib/drip/client/configuration.rb', line 25

def url_prefix
  @url_prefix || DEFAULT_URL_PREFIX
end