Sha256: 79af91cf344bad156b282f9aea1ab7b1ee0a56fac7138944455e9469d38faced

Contents?: true

Size: 1001 Bytes

Versions: 2

Compression:

Stored size: 1001 Bytes

Contents

# frozen_string_literal: true

require "hub_spot/configuration"
require "hub_spot/http"
require "hub_spot/http_api_calls/base"
require "hub_spot/http_api_calls/error"
require "hub_spot/http_api_calls/contact/create_or_update"
require "hub_spot/contact"
require "hub_spot/oauth"
require "hub_spot/oauth/token"
require "hub_spot/oauth/token_store"
require "hub_spot/oauth/client"
require "hub_spot/version"

module HubSpot
  module_function

  # From @avdi per http://www.virtuouscode.com/2009/11/20/hash-transforms-in-ruby/
  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

  # Convert keys to strings
  def stringify_keys(hash)
    transform_hash(hash) {|hash, key, value|       
      hash[key.to_s] = value
    }
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
hub_spot-0.3.1 lib/hub_spot.rb
hub_spot-0.3.0 lib/hub_spot.rb