Module: Pipedriver::Configuration
- Included in:
- Pipedriver
- Defined in:
- lib/pipedriver/configuration.rb
Constant Summary collapse
- VALID_CONNECTION_KEYS =
[:endpoint, :user_agent, :method].freeze
- VALID_OPTIONS_KEYS =
[:api_key, :format].freeze
- VALID_CONFIG_KEYS =
VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS
- DEFAULT_ENDPOINT =
'https://api.pipedrive.com/v1'
- DEFAULT_METHOD =
:get
- DEFAULT_USER_AGENT =
"Pipedriver API Ruby Gem #{Pipedriver::VERSION}".freeze
- DEFAULT_API_KEY =
nil
- DEFAULT_FORMAT =
:json
Class Method Summary collapse
-
.extended(base) ⇒ Object
Make sure we have the default values set when we get ‘extended’.
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
-
#options ⇒ Object
Return the configuration values set in this module.
- #reset ⇒ Object
Class Method Details
.extended(base) ⇒ Object
Make sure we have the default values set when we get ‘extended’
19 20 21 |
# File 'lib/pipedriver/configuration.rb', line 19 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
32 33 34 |
# File 'lib/pipedriver/configuration.rb', line 32 def configure yield self end |
#options ⇒ Object
Return the configuration values set in this module
37 38 39 |
# File 'lib/pipedriver/configuration.rb', line 37 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ] end |
#reset ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/pipedriver/configuration.rb', line 23 def reset self.endpoint = DEFAULT_ENDPOINT self.method = DEFAULT_METHOD self.user_agent = DEFAULT_USER_AGENT self.api_key = DEFAULT_API_KEY self.format = DEFAULT_FORMAT end |