Class: Delhivery::Configuration
- Inherits:
-
Object
- Object
- Delhivery::Configuration
- Defined in:
- lib/delhivery/configuration.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#production ⇒ Object
Returns the value of attribute production.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Configuration
constructor
A new instance of Configuration.
- #validate ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Configuration
Returns a new instance of Configuration.
5 6 7 8 |
# File 'lib/delhivery/configuration.rb', line 5 def initialize(opts = {}) @api_key = opts[:api_key] @production = opts[:production] || false end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
3 4 5 |
# File 'lib/delhivery/configuration.rb', line 3 def api_key @api_key end |
#production ⇒ Object
Returns the value of attribute production.
3 4 5 |
# File 'lib/delhivery/configuration.rb', line 3 def production @production end |
Instance Method Details
#validate ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/delhivery/configuration.rb', line 10 def validate errors = [] errors << "Invalid API Key" if @api_key.nil? || @api_key.empty? unless errors.empty? raise ArgumentError, "#{errors.join(', ')}" end end |