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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6207ff9ba6f5c778463938992f3b793e7787bdc6
4
- data.tar.gz: 67943b81dfa1c6258185e10ee0a402b38037d32c
3
+ metadata.gz: 5904d5b6e1e1665e7d03187ed0660ed8908bbdfb
4
+ data.tar.gz: 225ecbb6e7981270e371e32bd39be4a3a8098c25
5
5
  SHA512:
6
- metadata.gz: 95cad69cddc99a5b6f5d6a498d6b2d1e5f23caebc0606880c9d4881b9b6084e769ece78e00aad41df345d197826fb892695b42e30cb5cde997f6f82c0a18bc5c
7
- data.tar.gz: b3c91d7cee5360cbdbd1a18738f20ec62637f9a2f3a0f628ad8903611720d431c0c69de3d24ae44d44f01aa88ccfd92ac0c94b624d2aad6ec7f0fc525b7b9a5f
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
- response = HubSpot::HTTP.post(url: url, headers: headers, post_body: post_body)
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(:email)
27
+ properties.fetch("email")
30
28
  end
31
29
 
32
30
  def headers
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module HubSpot
4
- VERSION = "0.2.1"
4
+ VERSION = "0.3.0"
5
5
  end
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
- # Your code goes here...
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hub_spot
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Rabinowitz