Class: DearInventory::Config
- Inherits:
-
Object
- Object
- DearInventory::Config
- Extended by:
- T::Sig
- Defined in:
- lib/dear_inventory/config.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Returns the value of attribute account_id.
-
#key ⇒ Object
Returns the value of attribute key.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
- #environment ⇒ Object
- #environment=(value) ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #require(param) ⇒ Object
- #require_parameter(param) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
20 21 22 23 |
# File 'lib/dear_inventory/config.rb', line 20 def initialize @logger = Logger.new(STDOUT) @logger.level = Logger::WARN end |
Instance Attribute Details
#account_id ⇒ Object
Returns the value of attribute account_id.
11 12 13 |
# File 'lib/dear_inventory/config.rb', line 11 def account_id @account_id end |
#key ⇒ Object
Returns the value of attribute key.
14 15 16 |
# File 'lib/dear_inventory/config.rb', line 14 def key @key end |
#logger ⇒ Object
Returns the value of attribute logger.
17 18 19 |
# File 'lib/dear_inventory/config.rb', line 17 def logger @logger end |
Instance Method Details
#environment ⇒ Object
26 27 28 |
# File 'lib/dear_inventory/config.rb', line 26 def environment DearInventory::Environment end |
#environment=(value) ⇒ Object
31 32 33 |
# File 'lib/dear_inventory/config.rb', line 31 def environment=(value) DearInventory::Environment.set(value) end |
#require(param) ⇒ Object
36 37 38 39 40 41 |
# File 'lib/dear_inventory/config.rb', line 36 def require(param) value = public_send(param) return value unless value.nil? || value.empty? require_error(param) end |
#require_parameter(param) ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/dear_inventory/config.rb', line 44 def require_parameter(param) require(param) rescue ArgumentError => e = e. + "\n" \ "Alternatively, you can pass dynamic values with your request " \ "parameters" raise ArgumentError, end |