Module: OAS::Configuration

Included in:
OAS
Defined in:
lib/oas/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =

An array of valid keys in the options hash when configuring a OAS::Client

[
:endpoint,      
:account,
:username,
:password,
:timeout,
:logger].freeze
DEFAULT_ENDPOINT =

The endpoint that will be used to connect if none is set

"https://oas.realmediadigital.com/oasapi/OaxApi".freeze
DEFAULT_ACCOUNT =

The account that will be used to connect if none is set

"OasDefault"
DEFAULT_USERNAME =

By default, don’t set a username

nil
DEFAULT_PASSWORD =

By default, don’t set a password

nil
DEFAULT_TIMEOUT =

By default, set open and read timeout to 300

300

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



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

def self.extended(base)
  base.reset!
end

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



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

def configure
  yield self if block_given?
end

#optionsObject



37
38
39
40
41
# File 'lib/oas/configuration.rb', line 37

def options
  options = {}
  VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }
  options
end

#reset!Object



43
44
45
46
47
48
49
50
# File 'lib/oas/configuration.rb', line 43

def reset!
  self.endpoint   = DEFAULT_ENDPOINT
  self.    = DEFAULT_ACCOUNT
  self.username   = DEFAULT_USERNAME
  self.password   = DEFAULT_PASSWORD
  self.timeout    = DEFAULT_TIMEOUT
  self.logger     = nil
end