Module: HubSpot

Defined in:
lib/hub_spot.rb,
lib/hub_spot/http.rb,
lib/hub_spot/oauth.rb,
lib/hub_spot/contact.rb,
lib/hub_spot/version.rb,
lib/hub_spot/oauth/token.rb,
lib/hub_spot/oauth/client.rb,
lib/hub_spot/configuration.rb,
lib/hub_spot/oauth/token_store.rb,
lib/hub_spot/http_api_calls/base.rb,
lib/hub_spot/http_api_calls/error.rb,
lib/hub_spot/http_api_calls/contact/create_or_update.rb

Defined Under Namespace

Modules: Contact, HTTP, HTTPApiCalls, OAuth Classes: Configuration

Constant Summary collapse

VERSION =
"0.3.1"

Class Method Summary collapse

Class Method Details

.stringify_keys(hash) ⇒ Object

Convert keys to strings



32
33
34
35
36
# File 'lib/hub_spot.rb', line 32

def stringify_keys(hash)
  transform_hash(hash) {|hash, key, value|       
    hash[key.to_s] = value
  }
end

.transform_hash(original, options = {}, &block) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/hub_spot.rb', line 19

def transform_hash(original, options={}, &block)
  original.inject({}){|result, (key,value)|
    value = if (options[:deep] && Hash === value) 
              transform_hash(value, options, &block)
            else 
              value
            end
    block.call(result,key,value)
    result
  }
end