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

Instance Method Details

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

Yields:

  • (_self)

Yield Parameters:



11
12
13
14
# File 'lib/r_hapi/configuration.rb', line 11

def configure
  self.reset
  yield self
end

#optionsObject

Create a hash of options and their values



17
18
19
# File 'lib/r_hapi/configuration.rb', line 17

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

#resetObject

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