Class: Kentaa::Api::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/kentaa/api/config.rb

Constant Summary collapse

LIVE_URL =
"https://api.kentaa.nl/v1"
TEST_URL =
"https://api.kentaa.staatklaar.nu/v1"
DEV_URL =
"http://api.lvh.me:3000/v1"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, options = {}) ⇒ Config

Returns a new instance of Config.



12
13
14
15
# File 'lib/kentaa/api/config.rb', line 12

def initialize(api_key, options = {})
  @api_key = api_key
  @options = options
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



10
11
12
# File 'lib/kentaa/api/config.rb', line 10

def api_key
  @api_key
end

#optionsObject

Returns the value of attribute options.



10
11
12
# File 'lib/kentaa/api/config.rb', line 10

def options
  @options
end

Instance Method Details

#api_urlObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/kentaa/api/config.rb', line 17

def api_url
  case environment
  when :test
    TEST_URL
  when :development
    DEV_URL
  when :live
    LIVE_URL
  end
end

#environmentObject



28
29
30
31
32
33
34
35
36
# File 'lib/kentaa/api/config.rb', line 28

def environment
  if options[:test]
    :test
  elsif options[:dev]
    :development
  else
    :live
  end
end