Class: DearInventory::Config

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/dear_inventory/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



19
20
21
# File 'lib/dear_inventory/config.rb', line 19

def 
  @account_id
end

#keyObject

Returns the value of attribute key.



22
23
24
# File 'lib/dear_inventory/config.rb', line 22

def key
  @key
end

Instance Method Details

#environmentObject



9
10
11
# File 'lib/dear_inventory/config.rb', line 9

def environment
  DearInventory::Environment
end

#environment=(value) ⇒ Object



14
15
16
# File 'lib/dear_inventory/config.rb', line 14

def environment=(value)
  DearInventory::Environment.set(value)
end

#require(param) ⇒ Object



25
26
27
28
29
30
# File 'lib/dear_inventory/config.rb', line 25

def require(param)
  value = public_send(param)
  return value unless value.nil? || value.empty?

  require_error(param)
end

#require_parameter(param) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/dear_inventory/config.rb', line 33

def require_parameter(param)
  require(param)
rescue ArgumentError => e
  message = e.message + "\n" \
    "Alternatively, you can pass dynamic values with your request " \
    "parameters"
  raise ArgumentError, message
end