Module: RHapi::Configuration
- Included in:
- RHapi
- Defined in:
- lib/r_hapi/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[:api_key, :end_point, :hub_spot_site, :version]
- DEFAULT_API_KEY =
nil
- DEFAULT_END_POINT =
"https://hubapi.com"
- DEFAULT_VERSION =
"v1"
- DEFAULT_HUB_SPOT_SITE =
nil
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
-
#options ⇒ Object
Create a hash of options and their values.
-
#reset ⇒ Object
Reset all configuration options to defaults.
Instance Method Details
#configure {|_self| ... } ⇒ Object
11 12 13 14 |
# File 'lib/r_hapi/configuration.rb', line 11 def configure self.reset yield self end |
#options ⇒ Object
Create a hash of options and their values
17 18 19 |
# File 'lib/r_hapi/configuration.rb', line 17 def Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }] end |
#reset ⇒ Object
Reset all configuration options to defaults
22 23 24 25 26 27 28 |
# File 'lib/r_hapi/configuration.rb', line 22 def reset self.api_key = DEFAULT_API_KEY self.end_point = DEFAULT_END_POINT self.hub_spot_site = DEFAULT_HUB_SPOT_SITE self.version = DEFAULT_VERSION self end |