module Besepa::Utils::ApiConfig
Defines constants and methods related to configuration
Constants
- DEFAULT_API_KEY
The consumer key if none is set
- DEFAULT_ENDPOINT
The endpoint that will be used to connect if none is set
- VALID_OPTIONS_KEYS
An array of valid keys in the options hash when configuring api objects
Public Class Methods
extended(base)
click to toggle source
When this module is extended, set all configuration options to their default values
# File lib/besepa/utils/config.rb, line 24 def self.extended(base) base.reset end
Public Instance Methods
configure() { |self| ... }
click to toggle source
Convenience method to allow configuration options to be set in a block
# File lib/besepa/utils/config.rb, line 29 def configure yield self self end
options()
click to toggle source
Create a hash of options and their values
# File lib/besepa/utils/config.rb, line 35 def options options = {} VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)} options end
reset()
click to toggle source
Reset all configuration options to defaults
# File lib/besepa/utils/config.rb, line 42 def reset self.api_key = DEFAULT_API_KEY self.endpoint = DEFAULT_ENDPOINT self end