Class: Judopay::Configuration

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Set sensible configuration defaults



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/judopay.rb', line 52

def initialize
  @api_version = Judopay::API_VERSION
  @format = 'json'
  @use_production = false
  @user_agent = "Judopay Ruby (#{RUBY_VERSION}-p#{RUBY_PATCHLEVEL}) SDK gem v#{Judopay::SDK_VERSION}"
  @logger = Judopay::NullLogger.new
  @api_endpoints = {
    :sandbox => 'https://gw1.judopay-sandbox.com',
    :production => 'https://gw1.judopay.com'
  }.freeze
  @endpoint_url = @api_endpoints[:sandbox]
end

Instance Attribute Details

#api_endpointsObject (readonly)

Returns the value of attribute api_endpoints.



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

def api_endpoints
  @api_endpoints
end

#api_secretObject

Returns the value of attribute api_secret.



38
39
40
# File 'lib/judopay.rb', line 38

def api_secret
  @api_secret
end

#api_tokenObject

Returns the value of attribute api_token.



38
39
40
# File 'lib/judopay.rb', line 38

def api_token
  @api_token
end

#api_versionObject

Returns the value of attribute api_version.



38
39
40
# File 'lib/judopay.rb', line 38

def api_version
  @api_version
end

#endpoint_urlObject

Returns the value of attribute endpoint_url.



38
39
40
# File 'lib/judopay.rb', line 38

def endpoint_url
  @endpoint_url
end

#formatObject

Returns the value of attribute format.



38
39
40
# File 'lib/judopay.rb', line 38

def format
  @format
end

#judo_idObject

Returns the value of attribute judo_id.



38
39
40
# File 'lib/judopay.rb', line 38

def judo_id
  @judo_id
end

#loggerObject

Returns the value of attribute logger.



38
39
40
# File 'lib/judopay.rb', line 38

def logger
  @logger
end

#oauth_access_tokenObject

Returns the value of attribute oauth_access_token.



38
39
40
# File 'lib/judopay.rb', line 38

def oauth_access_token
  @oauth_access_token
end

#use_productionObject

Returns the value of attribute use_production.



38
39
40
# File 'lib/judopay.rb', line 38

def use_production
  @use_production
end

#user_agentObject

Returns the value of attribute user_agent.



38
39
40
# File 'lib/judopay.rb', line 38

def user_agent
  @user_agent
end

Instance Method Details

#validateObject



65
66
67
68
# File 'lib/judopay.rb', line 65

def validate
  return true unless judo_id.to_s.empty? || api_token.to_s.empty? || api_secret.to_s.empty?
  raise Judopay::ValidationError, 'SDK configuration variables missing'
end