Class: Drip::Client::Configuration
- Inherits:
-
Object
- Object
- Drip::Client::Configuration
- 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
-
#initialize(**options) ⇒ Configuration
constructor
A new instance of Configuration.
- #url_prefix ⇒ Object
Constructor Details
#initialize(**options) ⇒ Configuration
Returns a new instance of Configuration.
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/drip/client/configuration.rb', line 13 def initialize(**) remainder = .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 .each do |k, v| public_send("#{k}=", v) end end |
Instance Method Details
#url_prefix ⇒ Object
25 26 27 |
# File 'lib/drip/client/configuration.rb', line 25 def url_prefix @url_prefix || DEFAULT_URL_PREFIX end |