hub_spot 0.2.1 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hub_spot/http_api_calls/contact/create_or_update.rb +3 -5
- data/lib/hub_spot/version.rb +1 -1
- data/lib/hub_spot.rb +21 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5904d5b6e1e1665e7d03187ed0660ed8908bbdfb
|
4
|
+
data.tar.gz: 225ecbb6e7981270e371e32bd39be4a3a8098c25
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a1c31957238f0059542a55bea00a06d6d68da2e5c1af9257a7655aa5aea915153714af806faeddf5ddb39bede35648be1898b05793a3058813f78e2c4a1fc671
|
7
|
+
data.tar.gz: e66dd5365a3fbd63ac4e6d3b0ad3d9dbb43c6815185bfa22448497ef8dfd0f2946ccb1fc82d24dc4cf3ce57ef863f065dbc503fc287af8fe3aeb6ab0d900946f
|
@@ -8,7 +8,7 @@ module HubSpot
|
|
8
8
|
URL = "https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/%<email>s"
|
9
9
|
|
10
10
|
def initialize(properties)
|
11
|
-
@properties = properties
|
11
|
+
@properties = ::HubSpot.stringify_keys(properties)
|
12
12
|
end
|
13
13
|
|
14
14
|
private
|
@@ -16,9 +16,7 @@ module HubSpot
|
|
16
16
|
attr_reader :properties
|
17
17
|
|
18
18
|
def make_the_call
|
19
|
-
|
20
|
-
puts response
|
21
|
-
response
|
19
|
+
HubSpot::HTTP.post(url: url, headers: headers, post_body: post_body)
|
22
20
|
end
|
23
21
|
|
24
22
|
def url
|
@@ -26,7 +24,7 @@ module HubSpot
|
|
26
24
|
end
|
27
25
|
|
28
26
|
def email
|
29
|
-
properties.fetch(
|
27
|
+
properties.fetch("email")
|
30
28
|
end
|
31
29
|
|
32
30
|
def headers
|
data/lib/hub_spot/version.rb
CHANGED
data/lib/hub_spot.rb
CHANGED
@@ -13,5 +13,25 @@ require "hub_spot/oauth/client"
|
|
13
13
|
require "hub_spot/version"
|
14
14
|
|
15
15
|
module HubSpot
|
16
|
-
|
16
|
+
module_function
|
17
|
+
|
18
|
+
# From @avdi per http://www.virtuouscode.com/2009/11/20/hash-transforms-in-ruby/
|
19
|
+
def transform_hash(original, options={}, &block)
|
20
|
+
original.inject({}){|result, (key,value)|
|
21
|
+
value = if (options[:deep] && Hash === value)
|
22
|
+
transform_hash(value, options, &block)
|
23
|
+
else
|
24
|
+
value
|
25
|
+
end
|
26
|
+
block.call(result,key,value)
|
27
|
+
result
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Convert keys to strings
|
32
|
+
def stringify_keys(hash)
|
33
|
+
transform_hash(hash) {|hash, key, value|
|
34
|
+
hash[key.to_s] = value
|
35
|
+
}
|
36
|
+
end
|
17
37
|
end
|