hubspot-ruby 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 11a3489f968ac27c5a7595ef9434bd38a6bde444
4
- data.tar.gz: d49bdc1521715e28229279531880b5c9ff3867a4
3
+ metadata.gz: 7b3bb3cc4a8f67d35d62d4b7c11076adb22c8af1
4
+ data.tar.gz: e68610e426a09c3eb53498af22d799510b9be14b
5
5
  SHA512:
6
- metadata.gz: a1dc17f742cd3f58db33690e986b0474809003077fb2b8567929fee22a2e4a1a630d947971ced1a89b88e2ce203b99b6741ffba714f29cafb253a66765b39352
7
- data.tar.gz: f3d7ca1ecd5e4a26749620d5716d2eb782d30bdc0635fbeeabbb814c3bfb45f95828d9593e5a03288a59ddd5ec257e4924867f122416336a854dc9b1a3ef965a
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.4 ruby lib
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.4"
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-27"
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
- hash.map{ |k,v| {"property" => k.to_s, "value" => v}}
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
@@ -2,7 +2,7 @@ module Hubspot
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 4
5
+ PATCH = 5
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -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
- - Mon, 08 Dec 2014 13:31:02 GMT
22
+ - Sat, 27 Dec 2014 16:36:47 GMT
23
23
  Content-Length:
24
- - '562'
24
+ - '743'
25
25
  Connection:
26
26
  - keep-alive
27
27
  body:
28
28
  encoding: UTF-8
29
- string: '{"portalId":62515,"dealId":1071865,"isDeleted":false,"associations":{"associatedVids":[27136],"associatedCompanyIds":[8954037],"associatedDealIds":[]},"properties":{"createdate":{"value":"1418045462749","timestamp":1418045462749,"source":null,"sourceId":null,"versions":[{"name":"createdate","value":"1418045462749","timestamp":1418045462749,"sourceVid":[]}]},"hs_createdate":{"value":"1418045462749","timestamp":1418045462749,"source":null,"sourceId":null,"versions":[{"name":"hs_createdate","value":"1418045462749","timestamp":1418045462749,"sourceVid":[]}]}}}'
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: Mon, 08 Dec 2014 13:31:33 GMT
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/1071865?hapikey=demo
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
- - Mon, 08 Dec 2014 13:33:27 GMT
49
+ - Sat, 27 Dec 2014 16:36:48 GMT
50
50
  Content-Length:
51
- - '751'
51
+ - '932'
52
52
  Connection:
53
53
  - keep-alive
54
54
  body:
55
55
  encoding: UTF-8
56
- string: '{"portalId":62515,"dealId":1071865,"isDeleted":false,"associations":{"associatedVids":[27136],"associatedCompanyIds":[8954037],"associatedDealIds":[]},"properties":{"createdate":{"value":"1418045462749","timestamp":1418045462762,"source":null,"sourceId":null,"versions":[{"name":"createdate","value":"1418045462749","timestamp":1418045462762,"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":"1418045462749","timestamp":1418045462762,"source":null,"sourceId":null,"versions":[{"name":"hs_createdate","value":"1418045462749","timestamp":1418045462762,"sourceVid":[]}]}}}'
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: Mon, 08 Dec 2014 13:33:58 GMT
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
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-27 00:00:00.000000000 Z
11
+ date: 2014-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport