Class: SimpleHubspot::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_hubspot/utils.rb

Class Method Summary collapse

Class Method Details

.hash_to_properties(hash, opts = {}) ⇒ Object



10
11
12
13
# File 'lib/simple_hubspot/utils.rb', line 10

def hash_to_properties(hash, opts = {})
  key_name = opts[:key_name] || "property"
  hash.map { |k, v| { key_name => k.to_s, "value" => v } }
end

.properties_to_hash(props) ⇒ Object



4
5
6
7
8
# File 'lib/simple_hubspot/utils.rb', line 4

def properties_to_hash(props)
  newprops = HashWithIndifferentAccess.new
  props.each { |k, v| newprops[k] = v["value"] }
  newprops
end