hubspot-ruby 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/hubspot-ruby.gemspec +3 -3
- data/lib/hubspot/deal.rb +1 -1
- data/lib/hubspot/utils.rb +3 -2
- data/lib/hubspot/version.rb +1 -1
- data/spec/fixtures/vcr_cassettes/deal_find.yml +10 -10
- data/spec/lib/hubspot/deal_spec.rb +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b3bb3cc4a8f67d35d62d4b7c11076adb22c8af1
|
4
|
+
data.tar.gz: e68610e426a09c3eb53498af22d799510b9be14b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49b2b07ec56eb0e4d3e8fd4e6decb301fb79efb5f6c982f29cfc20d28fdddef38d8b4ee0ac9838791912e80eb366a847fd6b688dd119e5477c37bee49202aded
|
7
|
+
data.tar.gz: cb8d151625ea56420ed9463fdb69e08cd4809bdd91ca589d602792d9161e24947a0355ce6f4ee6d1651c2923ae28ee107a6ab6aabc4537d67c66cd5242a93503
|
data/hubspot-ruby.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: hubspot-ruby 0.1.
|
5
|
+
# stub: hubspot-ruby 0.1.5 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "hubspot-ruby"
|
9
|
-
s.version = "0.1.
|
9
|
+
s.version = "0.1.5"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Andrew DiMichele"]
|
14
|
-
s.date = "2014-12-
|
14
|
+
s.date = "2014-12-28"
|
15
15
|
s.description = "hubspot-ruby is a wrapper for the HubSpot REST API"
|
16
16
|
s.email = "hello@omadahealth.com"
|
17
17
|
s.extra_rdoc_files = [
|
data/lib/hubspot/deal.rb
CHANGED
@@ -30,7 +30,7 @@ module Hubspot
|
|
30
30
|
def create!(portal_id, company_ids, vids, params={})
|
31
31
|
url = Hubspot::Utils.generate_url(CREATE_DEAL_PATH).concat("&portalId=#{portal_id}")
|
32
32
|
associations_hash = {"portalId" => portal_id, "associations" => { "associatedCompanyIds" => company_ids, "associatedVids" => vids}}
|
33
|
-
post_data = associations_hash.merge({ properties: Hubspot::Utils.hash_to_properties(params) })
|
33
|
+
post_data = associations_hash.merge({ properties: Hubspot::Utils.hash_to_properties(params, key_name: "name") })
|
34
34
|
resp = HTTParty.post(url, body: post_data.to_json, headers: {"Content-Type" => "application/json"})
|
35
35
|
Hubspot::Deal.new(resp.parsed_response)
|
36
36
|
end
|
data/lib/hubspot/utils.rb
CHANGED
@@ -9,8 +9,9 @@ module Hubspot
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# Turns a hash into the hubspot properties format
|
12
|
-
def hash_to_properties(hash)
|
13
|
-
|
12
|
+
def hash_to_properties(hash, opts = {})
|
13
|
+
key_name = opts[:key_name] || "property"
|
14
|
+
hash.map{ |k,v| { key_name => k.to_s, "value" => v}}
|
14
15
|
end
|
15
16
|
|
16
17
|
# Generate the API URL for the request
|
data/lib/hubspot/version.rb
CHANGED
@@ -5,7 +5,7 @@ http_interactions:
|
|
5
5
|
uri: https://api.hubapi.com/deals/v1/deal?hapikey=demo&portalId=62515
|
6
6
|
body:
|
7
7
|
encoding: UTF-8
|
8
|
-
string: '{"portalId":62515,"associations":{"associatedCompanyIds":[8954037],"associatedVids":[27136]},"properties":[]}'
|
8
|
+
string: '{"portalId":62515,"associations":{"associatedCompanyIds":[8954037],"associatedVids":[27136]},"properties":[{"name":"amount","value":30}]}'
|
9
9
|
headers:
|
10
10
|
Content-Type:
|
11
11
|
- application/json
|
@@ -19,19 +19,19 @@ http_interactions:
|
|
19
19
|
Content-Type:
|
20
20
|
- application/json; charset=UTF-8
|
21
21
|
Date:
|
22
|
-
-
|
22
|
+
- Sat, 27 Dec 2014 16:36:47 GMT
|
23
23
|
Content-Length:
|
24
|
-
- '
|
24
|
+
- '743'
|
25
25
|
Connection:
|
26
26
|
- keep-alive
|
27
27
|
body:
|
28
28
|
encoding: UTF-8
|
29
|
-
string: '{"portalId":62515,"dealId":
|
29
|
+
string: '{"portalId":62515,"dealId":1146647,"isDeleted":false,"associations":{"associatedVids":[27136],"associatedCompanyIds":[8954037],"associatedDealIds":[]},"properties":{"amount":{"value":"30","timestamp":1419698207371,"source":"API","sourceId":null,"versions":[{"name":"amount","value":"30","timestamp":1419698207371,"source":"API","sourceVid":[]}]},"hs_createdate":{"value":"1419698207374","timestamp":1419698207374,"source":null,"sourceId":null,"versions":[{"name":"hs_createdate","value":"1419698207374","timestamp":1419698207374,"sourceVid":[]}]},"createdate":{"value":"1419698207374","timestamp":1419698207374,"source":null,"sourceId":null,"versions":[{"name":"createdate","value":"1419698207374","timestamp":1419698207374,"sourceVid":[]}]}}}'
|
30
30
|
http_version:
|
31
|
-
recorded_at:
|
31
|
+
recorded_at: Sat, 27 Dec 2014 16:36:47 GMT
|
32
32
|
- request:
|
33
33
|
method: get
|
34
|
-
uri: https://api.hubapi.com/deals/v1/deal/
|
34
|
+
uri: https://api.hubapi.com/deals/v1/deal/1146647?hapikey=demo
|
35
35
|
body:
|
36
36
|
encoding: US-ASCII
|
37
37
|
string: ''
|
@@ -46,14 +46,14 @@ http_interactions:
|
|
46
46
|
Content-Type:
|
47
47
|
- application/json; charset=UTF-8
|
48
48
|
Date:
|
49
|
-
-
|
49
|
+
- Sat, 27 Dec 2014 16:36:48 GMT
|
50
50
|
Content-Length:
|
51
|
-
- '
|
51
|
+
- '932'
|
52
52
|
Connection:
|
53
53
|
- keep-alive
|
54
54
|
body:
|
55
55
|
encoding: UTF-8
|
56
|
-
string: '{"portalId":62515,"dealId":
|
56
|
+
string: '{"portalId":62515,"dealId":1146647,"isDeleted":false,"associations":{"associatedVids":[27136],"associatedCompanyIds":[8954037],"associatedDealIds":[]},"properties":{"amount":{"value":"30","timestamp":1419698207401,"source":"API","sourceId":null,"versions":[{"name":"amount","value":"30","timestamp":1419698207401,"source":"API","sourceVid":[]}]},"num_associated_contacts":{"value":"1","timestamp":0,"source":"CALCULATED","sourceId":null,"versions":[{"name":"num_associated_contacts","value":"1","source":"CALCULATED","sourceVid":[]}]},"hs_createdate":{"value":"1419698207374","timestamp":1419698207401,"source":null,"sourceId":null,"versions":[{"name":"hs_createdate","value":"1419698207374","timestamp":1419698207401,"sourceVid":[]}]},"createdate":{"value":"1419698207374","timestamp":1419698207401,"source":null,"sourceId":null,"versions":[{"name":"createdate","value":"1419698207374","timestamp":1419698207401,"sourceVid":[]}]}}}'
|
57
57
|
http_version:
|
58
|
-
recorded_at:
|
58
|
+
recorded_at: Sat, 27 Dec 2014 16:36:48 GMT
|
59
59
|
recorded_with: VCR 2.4.0
|
@@ -27,12 +27,12 @@ describe Hubspot::Deal do
|
|
27
27
|
|
28
28
|
describe ".find" do
|
29
29
|
cassette "deal_find"
|
30
|
-
let(:deal) {Hubspot::Deal.create!(62515, [8954037], [27136], {})}
|
30
|
+
let(:deal) {Hubspot::Deal.create!(62515, [8954037], [27136], { amount: 30})}
|
31
31
|
|
32
32
|
it 'must find by the deal id' do
|
33
33
|
find_deal = Hubspot::Deal.find(deal.deal_id)
|
34
34
|
find_deal.deal_id.should eql deal.deal_id
|
35
|
+
find_deal.properties["amount"].should eql "30"
|
35
36
|
end
|
36
37
|
end
|
37
|
-
|
38
|
-
end
|
38
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hubspot-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew DiMichele
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|