Module: DocusignRest::Configuration

Included in:
DocusignRest
Defined in:
lib/docusign_rest/configuration.rb

Constant Summary collapse

VALID_CONNECTION_KEYS =
[:endpoint, :api_version, :user_agent, :method].freeze
VALID_OPTIONS_KEYS =
[:username, :password, :integrator_key, :account_id, :format].freeze
VALID_CONFIG_KEYS =
VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS
DEFAULT_ENDPOINT =
'https://demo.docusign.net/restapi'
DEFAULT_API_VERSION =
'v1'
DEFAULT_USER_AGENT =
"DocusignRest API Ruby Gem #{DocusignRest::VERSION}".freeze
DEFAULT_METHOD =
:get
DEFAULT_USERNAME =
nil
DEFAULT_PASSWORD =
nil
DEFAULT_INTEGRATOR_KEY =
nil
DEFAULT_ACCOUNT_ID =
nil
DEFAULT_FORMAT =
:json

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object

Make sure we have the default values set when we get ‘extended’



23
24
25
# File 'lib/docusign_rest/configuration.rb', line 23

def self.extended(base)
  base.reset
end

Instance Method Details

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

Allow configuration via a block

Yields:

  • (_self)

Yield Parameters:



41
42
43
# File 'lib/docusign_rest/configuration.rb', line 41

def configure
  yield self
end

#optionsObject



45
46
47
# File 'lib/docusign_rest/configuration.rb', line 45

def options
  Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ]
end

#resetObject



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/docusign_rest/configuration.rb', line 27

def reset
  self.endpoint       = DEFAULT_ENDPOINT
  self.api_version    = DEFAULT_API_VERSION
  self.user_agent     = DEFAULT_USER_AGENT
  self.method         = DEFAULT_METHOD

  self.username       = DEFAULT_USERNAME
  self.password       = DEFAULT_PASSWORD
  self.integrator_key = DEFAULT_INTEGRATOR_KEY
  self.     = DEFAULT_ACCOUNT_ID
  self.format         = DEFAULT_FORMAT
end