Class: CapitalOnTap::Configuration

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

Constant Summary collapse

AUTH_DOMAINS =
{
  production: 'https://api-auth.capitalontap.com',
  development: 'https://prelive-api-auth.capitalontap.com'
}.freeze
API_DOMAINS =
{
  production: 'https://api-partner.capitalontap.com',
  development: 'https://prelive-api-partner.capitalontap.com'
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



18
19
20
21
22
23
24
25
# File 'lib/capital_on_tap/configuration.rb', line 18

def initialize
  @client_id = ''
  @client_secret = ''
  @username = ''
  @password = ''
  @env = defined?(Rails) ? Rails.env : :development
  @debug = false
end

Instance Attribute Details

#client_idObject

Returns the value of attribute client_id.



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

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



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

def client_secret
  @client_secret
end

#debug=(value) ⇒ Object (writeonly)

Sets the attribute debug

Parameters:

  • value

    the value to set the attribute debug to.



6
7
8
# File 'lib/capital_on_tap/configuration.rb', line 6

def debug=(value)
  @debug = value
end

#envObject

Returns the value of attribute env.



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

def env
  @env
end

#passwordObject

Returns the value of attribute password.



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

def password
  @password
end

#usernameObject

Returns the value of attribute username.



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

def username
  @username
end

Instance Method Details

#base_auth_urlObject



31
32
33
# File 'lib/capital_on_tap/configuration.rb', line 31

def base_auth_url
  AUTH_DOMAINS[@env.to_sym] || AUTH_DOMAINS[:development]
end

#base_urlObject



35
36
37
# File 'lib/capital_on_tap/configuration.rb', line 35

def base_url
  API_DOMAINS[@env.to_sym] || API_DOMAINS[:development]
end

#debug?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/capital_on_tap/configuration.rb', line 27

def debug?
  @debug
end