Class: Youlend::Configuration

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

Constant Summary collapse

DOMAINS =
{
  production: 'https://youlendapi.com',
  development: 'https://staging.youlendapi.com'
}.freeze
API_DOMAINS =
{
  production: 'https://youlendapi.com',
  development: 'https://partners.staging-youlendapi.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
# File 'lib/youlend/configuration.rb', line 18

def initialize
  @tokens = { onboarding: '', prequalification: '' }
  @webhook_signature = ''
  @env = defined?(::Rails) ? ::Rails.env.to_sym : :development
  @debug = false
end

Instance Attribute Details

#client_idObject

Returns the value of attribute client_id.



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

def client_id
  @client_id
end

#client_secretObject

Returns the value of attribute client_secret.



5
6
7
# File 'lib/youlend/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/youlend/configuration.rb', line 6

def debug=(value)
  @debug = value
end

#envObject

Returns the value of attribute env.



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

def env
  @env
end

#tokensObject

Returns the value of attribute tokens.



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

def tokens
  @tokens
end

Instance Method Details

#api_domainObject



29
30
31
# File 'lib/youlend/configuration.rb', line 29

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

#debug?Boolean

Returns:

  • (Boolean)


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

def debug?
  @debug
end

#domainObject



33
34
35
# File 'lib/youlend/configuration.rb', line 33

def domain
  DOMAINS[@env.to_sym] || DOMAINS[:development]
end