Class: MerchantZip::Configuration
- Inherits:
-
Object
- Object
- MerchantZip::Configuration
- Defined in:
- lib/merchant-zip/configuration.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#mode ⇒ Object
Returns the value of attribute mode.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
-
#reverse_duplicate_merge(hash) ⇒ Object
Create a new config based off an existing one.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
22 23 24 |
# File 'lib/merchant-zip/configuration.rb', line 22 def initialize @mode = :live end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
4 5 6 |
# File 'lib/merchant-zip/configuration.rb', line 4 def api_key @api_key end |
#mode ⇒ Object
Returns the value of attribute mode.
3 4 5 |
# File 'lib/merchant-zip/configuration.rb', line 3 def mode @mode end |
Class Method Details
.setup ⇒ Object
6 7 8 9 10 |
# File 'lib/merchant-zip/configuration.rb', line 6 def self.setup new.tap do |instance| yield(instance) if block_given? end end |
Instance Method Details
#reverse_duplicate_merge(hash) ⇒ Object
Create a new config based off an existing one. This is useful when the caller wants to override the global configuration
14 15 16 17 18 19 20 |
# File 'lib/merchant-zip/configuration.rb', line 14 def reverse_duplicate_merge(hash) dup.tap do |instance| hash.each do |option, value| instance.public_send("#{option}=", value) end end end |