Class: ChipRails::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/chip_rails.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



16
17
18
19
20
21
# File 'lib/chip_rails.rb', line 16

def initialize
  @webhook_key = ENV['CHIP_WEBHOOOK_KEY']
  @api_key = ENV['CHIP_API_KEY']
  @brand_id = ENV['CHIP_BRAND_ID']
  @base_url = 'https://gate.chip-in.asia/api/v1/'
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



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

def api_key
  @api_key
end

#base_urlObject

Returns the value of attribute base_url.



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

def base_url
  @base_url
end

#brand_idObject

Returns the value of attribute brand_id.



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

def brand_id
  @brand_id
end

#webhook_keyObject

Returns the value of attribute webhook_key.



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

def webhook_key
  @webhook_key
end

Instance Method Details

#validate!Object



23
24
25
26
27
# File 'lib/chip_rails.rb', line 23

def validate!
  raise 'ChipRails configuration: webhook_key is missing' unless @webhook_key
  raise 'ChipRails configuration: api_key is missing' unless @api_key
  raise 'ChipRails configuration: brand_id is missing' unless @brand_id
end