Module: ServiceNow::Configuration

Defined in:
lib/servicenow/configuration.rb

Constant Summary collapse

VALID_OPTIONS_KEYS =
[
  :user_agent,
].freeze
DEFAULT_USER_AGENT =
"ServiceNow Ruby Gem #{ServiceNow::VERSION}".freeze

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



18
19
20
# File 'lib/servicenow/configuration.rb', line 18

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:



13
14
15
# File 'lib/servicenow/configuration.rb', line 13

def configure
  yield self
end

#optionsObject

Create a hash of options and their values



23
24
25
26
27
# File 'lib/servicenow/configuration.rb', line 23

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

#resetObject



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

def reset
  self.debug = DEFAULT_DEBUG
  self.user_agent = DEFAULT_USER_AGENT
end