Module: ExperianMS::Configuration

Included in:
ExperianMS
Defined in:
lib/experian_ms/configuration.rb

Constant Summary collapse

BASE_URL =
'https://ats.eccmp.com'.freeze
CONTENT_TYPE =
'application/xml'.freeze
CUSTOMER_ID =
0
API_VERSION =
1
FORM_GROUP_ID =
1
KEY =
''
SECRET =
''
CLIENT_ID =
''
OAUTH2_ENDPOINT =
'https://ats.eccmp.com/ats/oauth2/Token'.freeze
VALID_OPTIONS_KEYS =
[:base_url,
:customer_id,
:api_version,
:form_group_id,
:key, :secret,
:client_id,
:oauth2_endpoint,
:content_type]

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

When this module is extended, set all configuration options to their default values



24
25
26
# File 'lib/experian_ms/configuration.rb', line 24

def self.extended(base)
  base.reset
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Convenience method to allow configuration options to be set in a block

Yields:

  • (_self)

Yield Parameters:



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

def configure
  yield self
end

#optionsObject

Create a hash of options and their values



34
35
36
37
38
# File 'lib/experian_ms/configuration.rb', line 34

def options
  VALID_OPTIONS_KEYS.inject({}) do |option, key|
   option.merge!(key => send(key))
  end
end

#resetObject

Reset all configuration options to defaults



41
42
43
44
45
46
47
48
49
50
51
# File 'lib/experian_ms/configuration.rb', line 41

def reset
  self.base_url        = BASE_URL
  self.customer_id     = CUSTOMER_ID
  self.api_version     = API_VERSION
  self.form_group_id   = FORM_GROUP_ID
  self.key             = KEY
  self.secret          = SECRET
  self.client_id       = CLIENT_ID
  self.oauth2_endpoint = OAUTH2_ENDPOINT
  self.content_type    = CONTENT_TYPE
end