Class: InternetBS::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#credentialsObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/internetbs/configuration.rb', line 29

def credentials
  @credentials ||= {
    :production => {
      :api_key => ENV['INTERNETBS_API_KEY'],
      :api_pwd => ENV['INTERNETBS_API_PWD'],
      :api_uri => "https://api.internet.bs"
    },
    :test => {
      :api_key => "testapi",
      :api_pwd => "testpass",
      :api_uri => "https://testapi.internet.bs"
    },
    :development => {
      :api_key => "testapi",
      :api_pwd => "testpass",
      :api_uri => "https://testapi.internet.bs"
    }
  }
end

Instance Method Details

#api_keyObject



5
6
7
# File 'lib/internetbs/configuration.rb', line 5

def api_key
  InternetBS.credentials[InternetBS.environment][:api_key]
end

#api_key=(value) ⇒ Object



9
10
11
# File 'lib/internetbs/configuration.rb', line 9

def api_key=(value)
  InternetBS.credentials[InternetBS.environment][:api_key] = value
end

#api_pwdObject



13
14
15
# File 'lib/internetbs/configuration.rb', line 13

def api_pwd
  InternetBS.credentials[InternetBS.environment][:api_pwd]
end

#api_pwd=(value) ⇒ Object



17
18
19
# File 'lib/internetbs/configuration.rb', line 17

def api_pwd=(value)
  InternetBS.credentials[InternetBS.environment][:api_pwd] = value
end

#api_uriObject



21
22
23
# File 'lib/internetbs/configuration.rb', line 21

def api_uri
  InternetBS.credentials[InternetBS.environment][:api_uri]
end

#api_uri=(value) ⇒ Object



25
26
27
# File 'lib/internetbs/configuration.rb', line 25

def api_uri=(value)
  InternetBS.credentials[InternetBS.environment][:api_uri] = value
end

#environmentObject



49
50
51
# File 'lib/internetbs/configuration.rb', line 49

def environment
  @environment ||= :production
end

#environment=(value) ⇒ Object



53
54
55
# File 'lib/internetbs/configuration.rb', line 53

def environment=(value)
  @environment = value.is_a?(String) ? value.to_sym : value
end

#environmentsObject



57
58
59
# File 'lib/internetbs/configuration.rb', line 57

def environments
  InternetBS.credentials.keys
end