hubspot-ruby 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -25,8 +25,6 @@ Jeweler::Tasks.new do |gem|
25
25
  gem.version = Hubspot::Version::STRING
26
26
 
27
27
  # dependencies defined in Gemfile
28
- gem.add_dependency "activesupport", ">=3.0.0"
29
- gem.add_dependency "httparty", ">=0.10.0"
30
28
  end
31
29
  Jeweler::RubygemsDotOrgTasks.new
32
30
 
data/hubspot-ruby.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "hubspot-ruby"
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Andrew DiMichele"]
12
- s.date = "2013-02-18"
12
+ s.date = "2013-02-22"
13
13
  s.description = "hubspot-ruby is a wrapper for the HubSpot REST API"
14
14
  s.email = "andrew@omadahealth.com"
15
15
  s.extra_rdoc_files = [
@@ -28,12 +28,17 @@ Gem::Specification.new do |s|
28
28
  "lib/hubspot-ruby.rb",
29
29
  "lib/hubspot/config.rb",
30
30
  "lib/hubspot/contact.rb",
31
+ "lib/hubspot/exceptions.rb",
31
32
  "lib/hubspot/utils.rb",
32
33
  "lib/hubspot/version.rb",
33
- "spec/fixtures/vcr_cassettes/example_contact.yml",
34
- "spec/fixtures/vcr_cassettes/find_contact_by_email.yml",
35
- "spec/fixtures/vcr_cassettes/find_contact_by_id.yml",
36
- "spec/fixtures/vcr_cassettes/update_contact.yml",
34
+ "spec/fixtures/vcr_cassettes/contact_create.yml",
35
+ "spec/fixtures/vcr_cassettes/contact_create_existing_email.yml",
36
+ "spec/fixtures/vcr_cassettes/contact_create_invalid_email.yml",
37
+ "spec/fixtures/vcr_cassettes/contact_create_with_params.yml",
38
+ "spec/fixtures/vcr_cassettes/contact_example.yml",
39
+ "spec/fixtures/vcr_cassettes/contact_find_by_email.yml",
40
+ "spec/fixtures/vcr_cassettes/contact_find_by_id.yml",
41
+ "spec/fixtures/vcr_cassettes/contact_update.yml",
37
42
  "spec/lib/hubspot-ruby_spec.rb",
38
43
  "spec/lib/hubspot/config_spec.rb",
39
44
  "spec/lib/hubspot/contact_spec.rb",
@@ -61,8 +66,6 @@ Gem::Specification.new do |s|
61
66
  s.add_development_dependency(%q<jeweler>, [">= 0"])
62
67
  s.add_development_dependency(%q<simplecov>, [">= 0"])
63
68
  s.add_development_dependency(%q<awesome_print>, [">= 0"])
64
- s.add_runtime_dependency(%q<activesupport>, [">= 3.0.0"])
65
- s.add_runtime_dependency(%q<httparty>, [">= 0.10.0"])
66
69
  else
67
70
  s.add_dependency(%q<activesupport>, [">= 3.0.0"])
68
71
  s.add_dependency(%q<httparty>, [">= 0.10.0"])
@@ -75,8 +78,6 @@ Gem::Specification.new do |s|
75
78
  s.add_dependency(%q<jeweler>, [">= 0"])
76
79
  s.add_dependency(%q<simplecov>, [">= 0"])
77
80
  s.add_dependency(%q<awesome_print>, [">= 0"])
78
- s.add_dependency(%q<activesupport>, [">= 3.0.0"])
79
- s.add_dependency(%q<httparty>, [">= 0.10.0"])
80
81
  end
81
82
  else
82
83
  s.add_dependency(%q<activesupport>, [">= 3.0.0"])
@@ -90,8 +91,6 @@ Gem::Specification.new do |s|
90
91
  s.add_dependency(%q<jeweler>, [">= 0"])
91
92
  s.add_dependency(%q<simplecov>, [">= 0"])
92
93
  s.add_dependency(%q<awesome_print>, [">= 0"])
93
- s.add_dependency(%q<activesupport>, [">= 3.0.0"])
94
- s.add_dependency(%q<httparty>, [">= 0.10.0"])
95
94
  end
96
95
  end
97
96
 
data/lib/hubspot-ruby.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'active_support/core_ext'
2
2
  require 'httparty'
3
+ require 'hubspot/exceptions'
3
4
  require 'hubspot/config'
4
5
  require 'hubspot/contact'
5
6
 
@@ -2,15 +2,40 @@ require 'hubspot/utils'
2
2
  require 'httparty'
3
3
 
4
4
  module Hubspot
5
+ #
6
+ # HubSpot Contacts API
7
+ #
8
+ # {https://developers.hubspot.com/docs/endpoints#contacts-api}
9
+ #
5
10
  class Contact
11
+ CREATE_CONTACT_PATH = "/contacts/v1/contact"
6
12
  GET_CONTACT_BY_EMAIL_PATH = "/contacts/v1/contact/email/:contact_email/profile"
7
13
  GET_CONTACT_BY_ID_PATH = "/contacts/v1/contact/vid/:contact_id/profile"
8
14
  UPDATE_CONTACT_PATH = "/contacts/v1/contact/vid/:contact_id/profile"
9
15
 
10
16
  class << self
17
+ # Creates a new contact
18
+ # {https://developers.hubspot.com/docs/methods/contacts/create_contact}
19
+ # @param email [Hash] unique email of the new contact
20
+ # @param params [Hash] hash of properties to set on the contact
21
+ # @return [Hubspot::Contact] the newly created contact
22
+ def create!(email, params={})
23
+ params_with_email = params.stringify_keys.merge("email" => email)
24
+ url = Hubspot::Utils.generate_url(CREATE_CONTACT_PATH)
25
+ post_data = {properties: Hubspot::Utils.hash_to_properties(params_with_email)}
26
+ resp = HTTParty.post(url, body: post_data.to_json, format: :json)
27
+ raise(Hubspot::ContactExistsError.new(resp, "Contact already exists with email: #{email}")) if resp.code == 409
28
+ raise(Hubspot::RequestError.new(resp, "Cannot create contact with email: #{email}")) unless resp.success?
29
+ Hubspot::Contact.new(resp.parsed_response)
30
+ end
31
+
32
+ # Finds a contact by email
33
+ # {https://developers.hubspot.com/docs/methods/contacts/get_contact_by_email}
34
+ # @param email [String] the email of the contact to find
35
+ # @return [Hubspot::Contact, nil] the contact found or nil
11
36
  def find_by_email(email)
12
37
  url = Hubspot::Utils.generate_url(GET_CONTACT_BY_EMAIL_PATH, {contact_email: email})
13
- resp = HTTParty.get(url)
38
+ resp = HTTParty.get(url, format: :json)
14
39
  if resp.code == 200
15
40
  Hubspot::Contact.new(resp.parsed_response)
16
41
  else
@@ -18,15 +43,58 @@ module Hubspot
18
43
  end
19
44
  end
20
45
 
46
+ # Finds a contact by vid
47
+ # @param vid [String] the vid of the contact to find
48
+ # @return [Hubspot::Contact, nil] the contact found or nil
21
49
  def find_by_id(vid)
22
50
  url = Hubspot::Utils.generate_url(GET_CONTACT_BY_ID_PATH, {contact_id: vid})
23
- resp = HTTParty.get(url)
51
+ resp = HTTParty.get(url, format: :json)
24
52
  if resp.code == 200
25
53
  Hubspot::Contact.new(resp.parsed_response)
26
54
  else
27
55
  nil
28
56
  end
29
57
  end
58
+
59
+ # TODO: Finds a contact by its User Token (hubspotutk cookie value)
60
+ # {https://developers.hubspot.com/docs/methods/contacts/get_contact_by_utk}
61
+ # @param utk [String] hubspotutk cookie value
62
+ # @return [Hubspot::Contact, nil] the contact found or nil
63
+ def find_by_utk(utk)
64
+ raise NotImplementedError
65
+ end
66
+
67
+ # TODO: Get all contacts
68
+ # {https://developers.hubspot.com/docs/methods/contacts/get_contacts}
69
+ # @param count [Fixnum] number of contacts per page; max 100
70
+ # @return [Hubspot::ContactCollection] the paginated collection of contacts
71
+ def all(count=100)
72
+ raise NotImplementedError
73
+ end
74
+
75
+ # TODO: Get recently updated and created contacts
76
+ # {https://developers.hubspot.com/docs/methods/contacts/get_recently_updated_contacts}
77
+ # @param count [Fixnum] number of contacts per page; max 100
78
+ # @return [Hubspot::ContactCollection] the paginated collection of contacts
79
+ def recent(count=100)
80
+ raise NotImplementedError
81
+ end
82
+
83
+ # TODO: Search for contacts by various crieria
84
+ # {https://developers.hubspot.com/docs/methods/contacts/search_contacts}
85
+ # @param query [String] The search term for what you're searching for
86
+ # @param count [Fixnum] number of contacts per page; max 100
87
+ # @return [Hubspot::ContactCollection] the collection of contacts; no pagination
88
+ def search(query, count=100)
89
+ raise NotImplementedError
90
+ end
91
+
92
+ # TODO: Get statistics about all contacts
93
+ # {https://developers.hubspot.com/docs/methods/contacts/get_contact_statistics}
94
+ # @return [Hash] hash of statistics
95
+ def statistics
96
+ raise NotImplementedError
97
+ end
30
98
  end
31
99
 
32
100
  attr_reader :properties
@@ -45,14 +113,25 @@ module Hubspot
45
113
  @properties["email"]
46
114
  end
47
115
 
116
+ # Updates the properties of a contact
117
+ # {https://developers.hubspot.com/docs/methods/contacts/update_contact}
118
+ # @param params [Hash] hash of properties to update
119
+ # @return [Hubspot::Contact] self
48
120
  def update!(params)
49
121
  params.stringify_keys!
50
122
  url = Hubspot::Utils.generate_url(UPDATE_CONTACT_PATH, {contact_id: vid})
51
123
  query = {"properties" => Hubspot::Utils.hash_to_properties(params)}
52
- resp = HTTParty.post(url, body: query.to_json)
53
- raise(Hubspot::RequestError.new(resp.response)) unless resp.success?
124
+ resp = HTTParty.post(url, body: query.to_json, format: :json)
125
+ raise(Hubspot::RequestError.new(resp)) unless resp.success?
54
126
  @properties.merge!(params)
55
127
  self
56
128
  end
129
+
130
+ # TODO: Archives the contact in hubspot
131
+ # {https://developers.hubspot.com/docs/methods/contacts/delete_contact}
132
+ # @return [nil]
133
+ def destroy!
134
+ raise NotImplementedError
135
+ end
57
136
  end
58
137
  end
@@ -0,0 +1,12 @@
1
+ module Hubspot
2
+ class RequestError < StandardError
3
+ def initialize(response, message=nil)
4
+ message += "\n" if message
5
+ super("#{message}Response body: #{response.body}")
6
+ end
7
+ end
8
+
9
+ class ConfigurationError < StandardError; end
10
+ class MissingInterpolation < StandardError; end
11
+ class ContactExistsError < RequestError; end
12
+ end
data/lib/hubspot/utils.rb CHANGED
@@ -1,8 +1,4 @@
1
1
  module Hubspot
2
- class ConfigurationError < StandardError; end
3
- class MissingInterpolation < StandardError; end
4
- class RequestError < StandardError; end
5
-
6
2
  class Utils
7
3
  class << self
8
4
  # Parses the hubspot properties format into a key-value hash
@@ -26,17 +22,18 @@ module Hubspot
26
22
  #
27
23
  def generate_url(path, params={})
28
24
  raise Hubspot::ConfigurationError.new("'hapikey' not configured") unless Hubspot::Config.hapikey
25
+ path = path.clone
26
+ params = params.clone
29
27
  params["hapikey"] = Hubspot::Config.hapikey
30
- ipath = path.clone
31
28
  params.each do |k,v|
32
- if ipath.match(":#{k}")
33
- ipath.gsub!(":#{k}",v.to_s)
29
+ if path.match(":#{k}")
30
+ path.gsub!(":#{k}",v.to_s)
34
31
  params.delete(k)
35
32
  end
36
33
  end
37
- raise(Hubspot::MissingInterpolation.new("Interpolation not resolved")) if ipath =~ /:/
34
+ raise(Hubspot::MissingInterpolation.new("Interpolation not resolved")) if path =~ /:/
38
35
  query = params.map{ |k,v| "#{k}=#{v}" }.join("&")
39
- Hubspot::Config.base_url + ipath + "?" + query
36
+ Hubspot::Config.base_url + path + "?" + query
40
37
  end
41
38
  end
42
39
  end
@@ -2,7 +2,7 @@ module Hubspot
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 1
5
- PATCH = 0
5
+ PATCH = 1
6
6
 
7
7
  STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
@@ -0,0 +1,32 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.hubapi.com/contacts/v1/contact?hapikey=demo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ! '{"properties":[{"property":"email","value":"newcontact1361564912@hsgem.com"}]}'
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Access-Control-Allow-Credentials:
16
+ - 'false'
17
+ Content-Type:
18
+ - text/plain; charset=utf-8
19
+ Date:
20
+ - Fri, 22 Feb 2013 20:28:34 GMT
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ Content-Length:
24
+ - '1084'
25
+ Connection:
26
+ - keep-alive
27
+ body:
28
+ encoding: US-ASCII
29
+ string: ! '{"vid":154963,"portal-id":62515,"profile-token":"AO_T-mO_ghCK-Ia-VTb9_2r9z6sSvJu1gQkVT4Y0GmhKxIP-e3PyPRBHyhh4qeC-yu-5881gXoLArqPN2BvJu9MSJLXCSyJNZjyX0hkD2yvbnkrKBZtpXjS1XtQL2R8VinrL5AZAQ073","profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mO_ghCK-Ia-VTb9_2r9z6sSvJu1gQkVT4Y0GmhKxIP-e3PyPRBHyhh4qeC-yu-5881gXoLArqPN2BvJu9MSJLXCSyJNZjyX0hkD2yvbnkrKBZtpXjS1XtQL2R8VinrL5AZAQ073/","properties":{"email":{"value":"newcontact1361564912@hsgem.com","versions":[{"value":"newcontact1361564912@hsgem.com","source-type":"API","source-id":null,"source-label":null,"timestamp":1361564913945,"selected":false}]},"createdate":{"value":"1361564913945","versions":[{"value":"1361564913945","source-type":"API","source-id":null,"source-label":null,"timestamp":1361564913945,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":154963,"identities":[{"type":"EMAIL","value":"newcontact1361564912@hsgem.com","timestamp":1361564913945},{"type":"LEAD_GUID","value":"b8c6e48e-e5b3-4322-b192-27ec5629175e","timestamp":1361564913954}]}]}'
30
+ http_version:
31
+ recorded_at: Fri, 22 Feb 2013 20:28:34 GMT
32
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,30 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.hubapi.com/contacts/v1/contact?hapikey=demo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ! '{"properties":[{"property":"email","value":"testingapis@hubspot.com"}]}'
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 409
13
+ message: Conflict
14
+ headers:
15
+ Content-Type:
16
+ - application/json;charset=UTF-8
17
+ Date:
18
+ - Fri, 22 Feb 2013 20:28:35 GMT
19
+ Server:
20
+ - Apache-Coyote/1.1
21
+ Content-Length:
22
+ - '380'
23
+ Connection:
24
+ - keep-alive
25
+ body:
26
+ encoding: US-ASCII
27
+ string: ! '{"status":"error","message":"{\"msg\":\"Contact already existed\",\"error\":\"CONTACT_EXISTS\",\"property\":{\"vid\":82325,\"identities\":[{\"type\":\"EMAIL\",\"value\":\"testingapis@hubspot.com\",\"timestamp\":1345062449327},{\"type\":\"LEAD_GUID\",\"value\":\"c0da5c41-f289-4642-910c-9aa2b0fba245\",\"timestamp\":1345062449333}]}}","guid":"cd0e6f59-c8a3-4ae5-b897-3b3990ebda40"}'
28
+ http_version:
29
+ recorded_at: Fri, 22 Feb 2013 20:28:35 GMT
30
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,31 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.hubapi.com/contacts/v1/contact?hapikey=demo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ! '{"properties":[{"property":"email","value":"not_an_email"}]}'
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 400
13
+ message: Bad Request
14
+ headers:
15
+ Content-Type:
16
+ - application/json;charset=UTF-8
17
+ Date:
18
+ - Fri, 22 Feb 2013 20:28:36 GMT
19
+ Server:
20
+ - Apache-Coyote/1.1
21
+ Content-Length:
22
+ - '177'
23
+ Connection:
24
+ - keep-alive
25
+ body:
26
+ encoding: US-ASCII
27
+ string: ! '{"status":"error","message":"Invalid value for type in identity:
28
+ value: \"not_an_email\"\ntype: EMAIL\ntimestamp: 1361564916579\n","guid":"74dee415-f9fd-4525-83e6-436df7c2aa56"}'
29
+ http_version:
30
+ recorded_at: Fri, 22 Feb 2013 20:28:36 GMT
31
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,32 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.hubapi.com/contacts/v1/contact?hapikey=demo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ! '{"properties":[{"property":"firstname","value":"Hugh"},{"property":"lastname","value":"Jackman"},{"property":"email","value":"newcontact_x_1361564914@hsgem.com"}]}'
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Access-Control-Allow-Credentials:
16
+ - 'false'
17
+ Content-Type:
18
+ - text/plain; charset=utf-8
19
+ Date:
20
+ - Fri, 22 Feb 2013 20:28:35 GMT
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ Content-Length:
24
+ - '1416'
25
+ Connection:
26
+ - keep-alive
27
+ body:
28
+ encoding: US-ASCII
29
+ string: ! '{"vid":154964,"portal-id":62515,"profile-token":"AO_T-mMaMO14Jys0CrLFvkD56Xc8f7PvvFmhsvSPDDdm6-6uF2wbsFHaXFthseHCDcYvwjiWsMGmF9JSy1cdRpd2-PHwsGHsvBwWTwTDSH7cfTId6uYx7xpng_5YxQM9KauZgI_NJMKL","profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mMaMO14Jys0CrLFvkD56Xc8f7PvvFmhsvSPDDdm6-6uF2wbsFHaXFthseHCDcYvwjiWsMGmF9JSy1cdRpd2-PHwsGHsvBwWTwTDSH7cfTId6uYx7xpng_5YxQM9KauZgI_NJMKL/","properties":{"email":{"value":"newcontact_x_1361564914@hsgem.com","versions":[{"value":"newcontact_x_1361564914@hsgem.com","source-type":"API","source-id":null,"source-label":null,"timestamp":1361564915163,"selected":false}]},"createdate":{"value":"1361564915163","versions":[{"value":"1361564915163","source-type":"API","source-id":null,"source-label":null,"timestamp":1361564915163,"selected":false}]},"lastname":{"value":"Jackman","versions":[{"value":"Jackman","source-type":"API","source-id":null,"source-label":null,"timestamp":1361564915163,"selected":false}]},"firstname":{"value":"Hugh","versions":[{"value":"Hugh","source-type":"API","source-id":null,"source-label":null,"timestamp":1361564915163,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":154964,"identities":[{"type":"EMAIL","value":"newcontact_x_1361564914@hsgem.com","timestamp":1361564915163},{"type":"LEAD_GUID","value":"49034e6d-f3f4-4018-8b50-1baa22cdb514","timestamp":1361564915173}]}]}'
30
+ http_version:
31
+ recorded_at: Fri, 22 Feb 2013 20:28:35 GMT
32
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,32 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.hubapi.com/contacts/v1/contact/email/testingapis@hubspot.com/profile?hapikey=demo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Access-Control-Allow-Credentials:
16
+ - 'false'
17
+ Content-Type:
18
+ - application/json;charset=UTF-8
19
+ Date:
20
+ - Fri, 22 Feb 2013 20:31:02 GMT
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ Content-Length:
24
+ - '5094'
25
+ Connection:
26
+ - keep-alive
27
+ body:
28
+ encoding: US-ASCII
29
+ string: ! '{"vid":82325,"canonical-vid":82325,"portal-id":62515,"profile-token":"AO_T-mNv5DxWksowkR_cUZwe4J5-pxmNlzGQ4bJOas20MGNrJtrQWj7vtreBvekW74KmTCsbeEx0Kwy3YfptnFT6fDiQ-3kEnQz44wTQsEvmusYBjUYqvfv0twCciwlZ1vCwerCEuRUo","profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mNv5DxWksowkR_cUZwe4J5-pxmNlzGQ4bJOas20MGNrJtrQWj7vtreBvekW74KmTCsbeEx0Kwy3YfptnFT6fDiQ-3kEnQz44wTQsEvmusYBjUYqvfv0twCciwlZ1vCwerCEuRUo/","properties":{"hs_analytics_num_visits":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_referrer":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_linkedin_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_url":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_last_engagement":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_num_broadcast_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"hs_social_facebook_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"createdate":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"API","source-id":null,"source-label":null,"timestamp":1345062449002,"selected":false}]},"lastname":{"value":"Eastwood","versions":[{"value":"Eastwood","source-type":"API","source-id":null,"source-label":null,"timestamp":1361147932002,"selected":false},{"value":"Cunningham","source-type":"API","source-id":null,"source-label":null,"timestamp":1361146313002,"selected":false}]},"hs_social_twitter_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"phone":{"value":"555-555-5432"},"firstname":{"value":"Clint","versions":[{"value":"Clint","source-type":"API","source-id":null,"source-label":null,"timestamp":1361147932002,"selected":false},{"value":"Steve","source-type":"API","source-id":null,"source-label":null,"timestamp":1361146313002,"selected":false}]},"hs_analytics_first_url":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source":{"value":"OFFLINE","versions":[{"value":"OFFLINE","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_referrer":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_num_event_completions":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"hs_social_google_plus_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"email":{"value":"testingapis@hubspot.com","versions":[{"value":"testingapis@hubspot.com","source-type":"CONTACTS_WEB","source-id":"dadams@hubspot.com","source-label":null,"timestamp":1345062449008,"selected":false}]},"hs_analytics_last_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_num_page_views":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source_data_2":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source_data_1":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_visit_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":82325,"identities":[{"type":"EMAIL","value":"testingapis@hubspot.com","timestamp":1345062449327},{"type":"LEAD_GUID","value":"c0da5c41-f289-4642-910c-9aa2b0fba245","timestamp":1345062449333}]}]}'
30
+ http_version:
31
+ recorded_at: Fri, 22 Feb 2013 20:31:02 GMT
32
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.hubapi.com/contacts/v1/contact/email/testingapis@hubspot.com/profile?hapikey=demo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Access-Control-Allow-Credentials:
16
+ - 'false'
17
+ Content-Type:
18
+ - application/json;charset=UTF-8
19
+ Date:
20
+ - Fri, 22 Feb 2013 20:29:42 GMT
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ Content-Length:
24
+ - '5094'
25
+ Connection:
26
+ - keep-alive
27
+ body:
28
+ encoding: US-ASCII
29
+ string: ! '{"vid":82325,"canonical-vid":82325,"portal-id":62515,"profile-token":"AO_T-mNUsbKKM-tvm_q0O7Ql1xQiWoedwmogZpyxE-rxo0onAmthqACf0UP7bZSHxumyp1tZAdD-Gx3_aLPT2M8W9zCHxEl-Mn0tQezqgf_Wtz4TeT89Zue-LLJ2bug1MkR2ALQyrk9L","profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mNUsbKKM-tvm_q0O7Ql1xQiWoedwmogZpyxE-rxo0onAmthqACf0UP7bZSHxumyp1tZAdD-Gx3_aLPT2M8W9zCHxEl-Mn0tQezqgf_Wtz4TeT89Zue-LLJ2bug1MkR2ALQyrk9L/","properties":{"hs_analytics_num_visits":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_referrer":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_linkedin_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_url":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_last_engagement":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_num_broadcast_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"hs_social_facebook_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"createdate":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"API","source-id":null,"source-label":null,"timestamp":1345062449002,"selected":false}]},"lastname":{"value":"Eastwood","versions":[{"value":"Eastwood","source-type":"API","source-id":null,"source-label":null,"timestamp":1361147932002,"selected":false},{"value":"Cunningham","source-type":"API","source-id":null,"source-label":null,"timestamp":1361146313002,"selected":false}]},"hs_social_twitter_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"firstname":{"value":"Clint","versions":[{"value":"Clint","source-type":"API","source-id":null,"source-label":null,"timestamp":1361147932002,"selected":false},{"value":"Steve","source-type":"API","source-id":null,"source-label":null,"timestamp":1361146313002,"selected":false}]},"hs_analytics_first_url":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source":{"value":"OFFLINE","versions":[{"value":"OFFLINE","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_referrer":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_num_event_completions":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"hs_social_google_plus_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"email":{"value":"testingapis@hubspot.com","versions":[{"value":"testingapis@hubspot.com","source-type":"CONTACTS_WEB","source-id":"dadams@hubspot.com","source-label":null,"timestamp":1345062449008,"selected":false}]},"hs_analytics_last_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_num_page_views":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source_data_2":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source_data_1":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_visit_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":82325,"identities":[{"type":"EMAIL","value":"testingapis@hubspot.com","timestamp":1345062449327},{"type":"LEAD_GUID","value":"c0da5c41-f289-4642-910c-9aa2b0fba245","timestamp":1345062449333}]}]}'
30
+ http_version:
31
+ recorded_at: Fri, 22 Feb 2013 20:29:42 GMT
32
+ - request:
33
+ method: get
34
+ uri: https://api.hubapi.com/contacts/v1/contact/email/notacontact@test.com/profile?hapikey=demo
35
+ body:
36
+ encoding: US-ASCII
37
+ string: ''
38
+ headers: {}
39
+ response:
40
+ status:
41
+ code: 404
42
+ message: Not Found
43
+ headers:
44
+ Content-Type:
45
+ - application/json;charset=UTF-8
46
+ Date:
47
+ - Fri, 22 Feb 2013 20:29:42 GMT
48
+ Server:
49
+ - Apache-Coyote/1.1
50
+ Content-Length:
51
+ - '95'
52
+ Connection:
53
+ - keep-alive
54
+ body:
55
+ encoding: US-ASCII
56
+ string: ! '{"status":"error","message":"resource not found","guid":"5aafc293-6bc9-47fb-b6a4-512ffff24e88"}'
57
+ http_version:
58
+ recorded_at: Fri, 22 Feb 2013 20:29:42 GMT
59
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,59 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.hubapi.com/contacts/v1/contact/vid/82325/profile?hapikey=demo
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Access-Control-Allow-Credentials:
16
+ - 'false'
17
+ Content-Type:
18
+ - application/json;charset=UTF-8
19
+ Date:
20
+ - Fri, 22 Feb 2013 20:29:43 GMT
21
+ Server:
22
+ - Apache-Coyote/1.1
23
+ Content-Length:
24
+ - '5094'
25
+ Connection:
26
+ - keep-alive
27
+ body:
28
+ encoding: US-ASCII
29
+ string: ! '{"vid":82325,"canonical-vid":82325,"portal-id":62515,"profile-token":"AO_T-mN82Ph5EzbxdO0UKGfnTGctmSbIcuJYxQEaRfQm2N8ln86VOZ60vLFdYpSpnT9uoGqu_joSKihWulaj7CE4pna4f4bM_EPcG26pT4nY1bDkzoOtxUSLb82cOvFPMicWnaF_1dz-","profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mN82Ph5EzbxdO0UKGfnTGctmSbIcuJYxQEaRfQm2N8ln86VOZ60vLFdYpSpnT9uoGqu_joSKihWulaj7CE4pna4f4bM_EPcG26pT4nY1bDkzoOtxUSLb82cOvFPMicWnaF_1dz-/","properties":{"hs_analytics_num_visits":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_referrer":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_linkedin_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_url":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_last_engagement":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_num_broadcast_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"hs_social_facebook_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"createdate":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"API","source-id":null,"source-label":null,"timestamp":1345062449002,"selected":false}]},"lastname":{"value":"Eastwood","versions":[{"value":"Eastwood","source-type":"API","source-id":null,"source-label":null,"timestamp":1361147932002,"selected":false},{"value":"Cunningham","source-type":"API","source-id":null,"source-label":null,"timestamp":1361146313002,"selected":false}]},"hs_social_twitter_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"firstname":{"value":"Clint","versions":[{"value":"Clint","source-type":"API","source-id":null,"source-label":null,"timestamp":1361147932002,"selected":false},{"value":"Steve","source-type":"API","source-id":null,"source-label":null,"timestamp":1361146313002,"selected":false}]},"hs_analytics_first_url":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source":{"value":"OFFLINE","versions":[{"value":"OFFLINE","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_referrer":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_num_event_completions":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"hs_social_google_plus_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"email":{"value":"testingapis@hubspot.com","versions":[{"value":"testingapis@hubspot.com","source-type":"CONTACTS_WEB","source-id":"dadams@hubspot.com","source-label":null,"timestamp":1345062449008,"selected":false}]},"hs_analytics_last_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_num_page_views":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source_data_2":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source_data_1":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_visit_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":82325,"identities":[{"type":"EMAIL","value":"testingapis@hubspot.com","timestamp":1345062449327},{"type":"LEAD_GUID","value":"c0da5c41-f289-4642-910c-9aa2b0fba245","timestamp":1345062449333}]}]}'
30
+ http_version:
31
+ recorded_at: Fri, 22 Feb 2013 20:29:43 GMT
32
+ - request:
33
+ method: get
34
+ uri: https://api.hubapi.com/contacts/v1/contact/vid/9999999/profile?hapikey=demo
35
+ body:
36
+ encoding: US-ASCII
37
+ string: ''
38
+ headers: {}
39
+ response:
40
+ status:
41
+ code: 404
42
+ message: Not Found
43
+ headers:
44
+ Content-Type:
45
+ - application/json;charset=UTF-8
46
+ Date:
47
+ - Fri, 22 Feb 2013 20:29:45 GMT
48
+ Server:
49
+ - Apache-Coyote/1.1
50
+ Content-Length:
51
+ - '95'
52
+ Connection:
53
+ - keep-alive
54
+ body:
55
+ encoding: US-ASCII
56
+ string: ! '{"status":"error","message":"resource not found","guid":"06364bc0-92ce-4c4f-b62e-dc8f1428cdfa"}'
57
+ http_version:
58
+ recorded_at: Fri, 22 Feb 2013 20:29:45 GMT
59
+ recorded_with: VCR 2.4.0
@@ -1,30 +1,5 @@
1
1
  ---
2
2
  http_interactions:
3
- - request:
4
- method: post
5
- uri: https://api.hubapi.com/contacts/v1/contact/vid/82325/profile?hapikey=demo
6
- body:
7
- encoding: US-ASCII
8
- string: ! '{"properties":[{"property":"firstname","value":"Steve"},{"property":"lastname","value":"Cunningham"}]}'
9
- headers: {}
10
- response:
11
- status:
12
- code: 204
13
- message: No Content
14
- headers:
15
- Access-Control-Allow-Credentials:
16
- - 'false'
17
- Date:
18
- - Mon, 18 Feb 2013 00:11:53 GMT
19
- Server:
20
- - Apache-Coyote/1.1
21
- Connection:
22
- - keep-alive
23
- body:
24
- encoding: US-ASCII
25
- string: ''
26
- http_version:
27
- recorded_at: Mon, 18 Feb 2013 00:11:53 GMT
28
3
  - request:
29
4
  method: post
30
5
  uri: https://api.hubapi.com/contacts/v1/contact/vid/invalid/profile?hapikey=demo
@@ -40,7 +15,7 @@ http_interactions:
40
15
  Content-Type:
41
16
  - text/html;charset=utf-8
42
17
  Date:
43
- - Mon, 18 Feb 2013 00:11:54 GMT
18
+ - Fri, 22 Feb 2013 20:29:45 GMT
44
19
  Server:
45
20
  - Apache-Coyote/1.1
46
21
  Content-Length:
@@ -62,5 +37,30 @@ http_interactions:
62
37
  requested resource (Not Found) is not available.</u></p><HR size="1" noshade="noshade"><h3>Apache
63
38
  Tomcat/6.0.30</h3></body></html>'
64
39
  http_version:
65
- recorded_at: Mon, 18 Feb 2013 00:11:54 GMT
40
+ recorded_at: Fri, 22 Feb 2013 20:29:46 GMT
41
+ - request:
42
+ method: post
43
+ uri: https://api.hubapi.com/contacts/v1/contact/vid/82325/profile?hapikey=demo
44
+ body:
45
+ encoding: US-ASCII
46
+ string: ! '{"properties":[{"property":"firstname","value":"Steve"},{"property":"lastname","value":"Cunningham"}]}'
47
+ headers: {}
48
+ response:
49
+ status:
50
+ code: 204
51
+ message: No Content
52
+ headers:
53
+ Access-Control-Allow-Credentials:
54
+ - 'false'
55
+ Date:
56
+ - Fri, 22 Feb 2013 20:31:03 GMT
57
+ Server:
58
+ - Apache-Coyote/1.1
59
+ Connection:
60
+ - keep-alive
61
+ body:
62
+ encoding: US-ASCII
63
+ string: ''
64
+ http_version:
65
+ recorded_at: Fri, 22 Feb 2013 20:31:03 GMT
66
66
  recorded_with: VCR 2.4.0
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
 
3
3
  describe Hubspot::Contact do
4
4
  let(:example_contact_hash) do
5
- VCR.use_cassette("example_contact", record: :none) do
5
+ VCR.use_cassette("contact_example", record: :none) do
6
6
  HTTParty.get("https://api.hubapi.com/contacts/v1/contact/email/testingapis@hubspot.com/profile?hapikey=demo").parsed_response
7
7
  end
8
8
  end
@@ -13,14 +13,49 @@ describe Hubspot::Contact do
13
13
  subject{ Hubspot::Contact.new(example_contact_hash) }
14
14
  it{ should be_an_instance_of Hubspot::Contact }
15
15
  its(["email"]){ should == "testingapis@hubspot.com" }
16
- its(["firstname"]){ should == "Test" }
17
- its(["lastname"]){ should == "Contact" }
18
- its(["phone"]){ should == "555-555-2262" }
16
+ its(["firstname"]){ should == "Clint" }
17
+ its(["lastname"]){ should == "Eastwood" }
18
+ its(["phone"]){ should == "555-555-5432" }
19
19
  its(:vid){ should == 82325 }
20
20
  end
21
21
 
22
+ describe ".create!" do
23
+ let(:cassette){ "contact_create" }
24
+ before{ VCR.insert_cassette(cassette, record: :new_episodes) }
25
+ after{ VCR.eject_cassette }
26
+ let(:params){{}}
27
+ subject{ Hubspot::Contact.create!(email, params) }
28
+ context "with a new email" do
29
+ let(:email){ "newcontact#{Time.now.to_i}@hsgem.com" }
30
+ it{ should be_an_instance_of Hubspot::Contact }
31
+ its(:email){ should match /newcontact.*@hsgem.com/ } # Due to VCR the email may not match exactly
32
+
33
+ context "and some params" do
34
+ let(:cassette){ "contact_create_with_params" }
35
+ let(:email){ "newcontact_x_#{Time.now.to_i}@hsgem.com" }
36
+ let(:params){ {firstname: "Hugh", lastname: "Jackman" } }
37
+ its(["firstname"]){ should == "Hugh"}
38
+ its(["lastname"]){ should == "Jackman"}
39
+ end
40
+ end
41
+ context "with an existing email" do
42
+ let(:cassette){ "contact_create_existing_email" }
43
+ let(:email){ "testingapis@hubspot.com" }
44
+ it "raises a ContactExistsError" do
45
+ expect{ subject }.to raise_error Hubspot::ContactExistsError
46
+ end
47
+ end
48
+ context "with an invalid email" do
49
+ let(:cassette){ "contact_create_invalid_email" }
50
+ let(:email){ "not_an_email" }
51
+ it "raises a RequestError" do
52
+ expect{ subject }.to raise_error Hubspot::RequestError
53
+ end
54
+ end
55
+ end
56
+
22
57
  describe ".find_by_email" do
23
- before{ VCR.insert_cassette("find_contact_by_email", record: :new_episodes) }
58
+ before{ VCR.insert_cassette("contact_find_by_email", record: :new_episodes) }
24
59
  after{ VCR.eject_cassette }
25
60
  subject{ Hubspot::Contact.find_by_email(email) }
26
61
 
@@ -37,7 +72,7 @@ describe Hubspot::Contact do
37
72
  end
38
73
 
39
74
  describe ".find_by_id" do
40
- before{ VCR.insert_cassette("find_contact_by_id", record: :new_episodes) }
75
+ before{ VCR.insert_cassette("contact_find_by_id", record: :new_episodes) }
41
76
  after{ VCR.eject_cassette }
42
77
  subject{ Hubspot::Contact.find_by_id(vid) }
43
78
 
@@ -54,7 +89,7 @@ describe Hubspot::Contact do
54
89
  end
55
90
 
56
91
  describe "#update!" do
57
- before{ VCR.insert_cassette("update_contact", record: :new_episodes) }
92
+ before{ VCR.insert_cassette("contact_update", record: :new_episodes) }
58
93
  after{ VCR.eject_cassette }
59
94
  let(:contact){ Hubspot::Contact.new(example_contact_hash) }
60
95
  let(:params){ {firstname: "Steve", lastname: "Cunningham"} }
@@ -33,10 +33,14 @@ describe Hubspot::Utils do
33
33
 
34
34
  describe ".generate_url" do
35
35
  let(:path){ "/test/:email/profile" }
36
- let(:params){{}}
36
+ let(:params){{email: "test"}}
37
37
  subject{ Hubspot::Utils.generate_url(path, params) }
38
38
  before{ Hubspot.configure(hapikey: "demo") }
39
39
 
40
+ it "doesn't modify params" do
41
+ expect{ subject }.to_not change{params}
42
+ end
43
+
40
44
  context "when configure hasn't been called" do
41
45
  before{ Hubspot::Config.reset! }
42
46
  it "raises a config exception" do
@@ -45,6 +49,7 @@ describe Hubspot::Utils do
45
49
  end
46
50
 
47
51
  context "with interpolations but no params" do
52
+ let(:params){{}}
48
53
  it "raises an interpolation exception" do
49
54
  expect{ subject }.to raise_error Hubspot::MissingInterpolation
50
55
  end
@@ -12,4 +12,6 @@ describe "Contacts API Live test", live: true do
12
12
  contact["firstname"].should == "Clint"
13
13
  contact["lastname"].should == "Eastwood"
14
14
  end
15
+
16
+ pending "creates and destroys a contact"
15
17
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubspot-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-18 00:00:00.000000000 Z
12
+ date: 2013-02-22 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -187,38 +187,6 @@ dependencies:
187
187
  - - ! '>='
188
188
  - !ruby/object:Gem::Version
189
189
  version: '0'
190
- - !ruby/object:Gem::Dependency
191
- name: activesupport
192
- requirement: !ruby/object:Gem::Requirement
193
- none: false
194
- requirements:
195
- - - ! '>='
196
- - !ruby/object:Gem::Version
197
- version: 3.0.0
198
- type: :runtime
199
- prerelease: false
200
- version_requirements: !ruby/object:Gem::Requirement
201
- none: false
202
- requirements:
203
- - - ! '>='
204
- - !ruby/object:Gem::Version
205
- version: 3.0.0
206
- - !ruby/object:Gem::Dependency
207
- name: httparty
208
- requirement: !ruby/object:Gem::Requirement
209
- none: false
210
- requirements:
211
- - - ! '>='
212
- - !ruby/object:Gem::Version
213
- version: 0.10.0
214
- type: :runtime
215
- prerelease: false
216
- version_requirements: !ruby/object:Gem::Requirement
217
- none: false
218
- requirements:
219
- - - ! '>='
220
- - !ruby/object:Gem::Version
221
- version: 0.10.0
222
190
  description: hubspot-ruby is a wrapper for the HubSpot REST API
223
191
  email: andrew@omadahealth.com
224
192
  executables: []
@@ -238,12 +206,17 @@ files:
238
206
  - lib/hubspot-ruby.rb
239
207
  - lib/hubspot/config.rb
240
208
  - lib/hubspot/contact.rb
209
+ - lib/hubspot/exceptions.rb
241
210
  - lib/hubspot/utils.rb
242
211
  - lib/hubspot/version.rb
243
- - spec/fixtures/vcr_cassettes/example_contact.yml
244
- - spec/fixtures/vcr_cassettes/find_contact_by_email.yml
245
- - spec/fixtures/vcr_cassettes/find_contact_by_id.yml
246
- - spec/fixtures/vcr_cassettes/update_contact.yml
212
+ - spec/fixtures/vcr_cassettes/contact_create.yml
213
+ - spec/fixtures/vcr_cassettes/contact_create_existing_email.yml
214
+ - spec/fixtures/vcr_cassettes/contact_create_invalid_email.yml
215
+ - spec/fixtures/vcr_cassettes/contact_create_with_params.yml
216
+ - spec/fixtures/vcr_cassettes/contact_example.yml
217
+ - spec/fixtures/vcr_cassettes/contact_find_by_email.yml
218
+ - spec/fixtures/vcr_cassettes/contact_find_by_id.yml
219
+ - spec/fixtures/vcr_cassettes/contact_update.yml
247
220
  - spec/lib/hubspot-ruby_spec.rb
248
221
  - spec/lib/hubspot/config_spec.rb
249
222
  - spec/lib/hubspot/contact_spec.rb
@@ -264,7 +237,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
264
237
  version: '0'
265
238
  segments:
266
239
  - 0
267
- hash: 3359032865728179848
240
+ hash: 1080958652327679356
268
241
  required_rubygems_version: !ruby/object:Gem::Requirement
269
242
  none: false
270
243
  requirements:
@@ -1,32 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.hubapi.com/contacts/v1/contact/email/testingapis@hubspot.com/profile?hapikey=demo
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers: {}
10
- response:
11
- status:
12
- code: 200
13
- message: OK
14
- headers:
15
- Access-Control-Allow-Credentials:
16
- - 'false'
17
- Content-Type:
18
- - application/json;charset=UTF-8
19
- Date:
20
- - Sun, 17 Feb 2013 21:25:47 GMT
21
- Server:
22
- - Apache-Coyote/1.1
23
- Content-Length:
24
- - '4526'
25
- Connection:
26
- - keep-alive
27
- body:
28
- encoding: US-ASCII
29
- string: ! '{"vid":82325,"canonical-vid":82325,"portal-id":62515,"profile-token":"AO_T-mOFl-EsboE0zgQW128L0RgCNNG8B5dPZhYfs7wWibbeR0hPcNdip07vdlt8TTWgDKqvLs-7XByciZlyBnA6_P7AR66hspzqIoBuh2fWiQa231_UEvVohe-lkdfQYv8iCtnAMNVq","profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mOFl-EsboE0zgQW128L0RgCNNG8B5dPZhYfs7wWibbeR0hPcNdip07vdlt8TTWgDKqvLs-7XByciZlyBnA6_P7AR66hspzqIoBuh2fWiQa231_UEvVohe-lkdfQYv8iCtnAMNVq/","properties":{"firstname":{"value":"Test","versions":[{"timestamp":1338305440003,"selected":false,"source-label":"FirstName","value":"Test","source-type":"FORM","source-id":"bc65112f47c2469e90f5951213a66110"}]},"lastname":{"value":"Contact","versions":[{"timestamp":1338305440003,"selected":false,"source-label":"LastName","value":"Contact","source-type":"FORM","source-id":"bc65112f47c2469e90f5951213a66110"}]},"phone":{"value":"555-555-2262","versions":[{"timestamp":1338305440003,"selected":false,"source-label":"Phone","value":"555-555-2262","source-type":"FORM","source-id":"bc65112f47c2469e90f5951213a66110"}]},"hs_analytics_num_visits":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_referrer":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_linkedin_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_url":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_last_engagement":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_num_broadcast_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"hs_social_facebook_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"createdate":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"API","source-id":null,"source-label":null,"timestamp":1345062449002,"selected":false}]},"hs_social_twitter_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_url":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_referrer":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_num_event_completions":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"hs_analytics_source":{"value":"OFFLINE","versions":[{"value":"OFFLINE","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_google_plus_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"email":{"value":"testingapis@hubspot.com","versions":[{"value":"testingapis@hubspot.com","source-type":"CONTACTS_WEB","source-id":"dadams@hubspot.com","source-label":null,"timestamp":1345062449008,"selected":false}]},"hs_analytics_last_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_num_page_views":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source_data_2":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source_data_1":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_visit_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":82325,"identities":[{"type":"EMAIL","value":"testingapis@hubspot.com","timestamp":1345062449327},{"type":"LEAD_GUID","value":"c0da5c41-f289-4642-910c-9aa2b0fba245","timestamp":1345062449333}]}]}'
30
- http_version:
31
- recorded_at: Sun, 17 Feb 2013 21:25:47 GMT
32
- recorded_with: VCR 2.4.0
@@ -1,59 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.hubapi.com/contacts/v1/contact/email/testingapis@hubspot.com/profile?hapikey=demo
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers: {}
10
- response:
11
- status:
12
- code: 200
13
- message: OK
14
- headers:
15
- Access-Control-Allow-Credentials:
16
- - 'false'
17
- Content-Type:
18
- - application/json;charset=UTF-8
19
- Date:
20
- - Mon, 18 Feb 2013 00:27:11 GMT
21
- Server:
22
- - Apache-Coyote/1.1
23
- Content-Length:
24
- - '4857'
25
- Connection:
26
- - keep-alive
27
- body:
28
- encoding: US-ASCII
29
- string: ! '{"vid":82325,"canonical-vid":82325,"portal-id":62515,"profile-token":"AO_T-mOEnUzEVVZQVj3XwZCiE87gPcrjLaNbtQmsuVg5c7YUx7BIfMF48rHWdEvZSEpbpX-V7Qz46i0z1hk7KQyH41DJZLQPB2F-aH8qrG1EW-mIZxHl-QmK9Ffo4ILZrKoOwwr3qqZw","profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mOEnUzEVVZQVj3XwZCiE87gPcrjLaNbtQmsuVg5c7YUx7BIfMF48rHWdEvZSEpbpX-V7Qz46i0z1hk7KQyH41DJZLQPB2F-aH8qrG1EW-mIZxHl-QmK9Ffo4ILZrKoOwwr3qqZw/","properties":{"hs_analytics_num_visits":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_referrer":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_linkedin_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_url":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_last_engagement":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_num_broadcast_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"hs_social_facebook_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"createdate":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"API","source-id":null,"source-label":null,"timestamp":1345062449002,"selected":false}]},"lastname":{"value":"Cunningham","versions":[{"value":"Cunningham","source-type":"API","source-id":null,"source-label":null,"timestamp":1361146313002,"selected":false}]},"hs_social_twitter_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"firstname":{"value":"Steve","versions":[{"value":"Steve","source-type":"API","source-id":null,"source-label":null,"timestamp":1361146313002,"selected":false}]},"hs_analytics_first_url":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source":{"value":"OFFLINE","versions":[{"value":"OFFLINE","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_referrer":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_num_event_completions":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"hs_social_google_plus_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"email":{"value":"testingapis@hubspot.com","versions":[{"value":"testingapis@hubspot.com","source-type":"CONTACTS_WEB","source-id":"dadams@hubspot.com","source-label":null,"timestamp":1345062449008,"selected":false}]},"hs_analytics_last_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_num_page_views":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source_data_2":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source_data_1":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_visit_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":82325,"identities":[{"type":"EMAIL","value":"testingapis@hubspot.com","timestamp":1345062449327},{"type":"LEAD_GUID","value":"c0da5c41-f289-4642-910c-9aa2b0fba245","timestamp":1345062449333}]}]}'
30
- http_version:
31
- recorded_at: Mon, 18 Feb 2013 00:27:11 GMT
32
- - request:
33
- method: get
34
- uri: https://api.hubapi.com/contacts/v1/contact/email/notacontact@test.com/profile?hapikey=demo
35
- body:
36
- encoding: US-ASCII
37
- string: ''
38
- headers: {}
39
- response:
40
- status:
41
- code: 404
42
- message: Not Found
43
- headers:
44
- Content-Type:
45
- - application/json;charset=UTF-8
46
- Date:
47
- - Mon, 18 Feb 2013 00:27:11 GMT
48
- Server:
49
- - Apache-Coyote/1.1
50
- Content-Length:
51
- - '95'
52
- Connection:
53
- - keep-alive
54
- body:
55
- encoding: US-ASCII
56
- string: ! '{"status":"error","message":"resource not found","guid":"c1ff8266-2bff-4278-9717-d4db2ea429cc"}'
57
- http_version:
58
- recorded_at: Mon, 18 Feb 2013 00:27:11 GMT
59
- recorded_with: VCR 2.4.0
@@ -1,59 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://api.hubapi.com/contacts/v1/contact/vid/82325/profile?hapikey=demo
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers: {}
10
- response:
11
- status:
12
- code: 200
13
- message: OK
14
- headers:
15
- Access-Control-Allow-Credentials:
16
- - 'false'
17
- Content-Type:
18
- - application/json;charset=UTF-8
19
- Date:
20
- - Mon, 18 Feb 2013 00:35:33 GMT
21
- Server:
22
- - Apache-Coyote/1.1
23
- Content-Length:
24
- - '4857'
25
- Connection:
26
- - keep-alive
27
- body:
28
- encoding: US-ASCII
29
- string: ! '{"vid":82325,"canonical-vid":82325,"portal-id":62515,"profile-token":"AO_T-mMbtNq2RnAUjbHWrHMch5z4aOs7MBYrtC9WGDpghGH-X3L3ZuRjqPAj5LhRh5C17U-jCRLDOUi1hcvLdzqFAo1-vyCmW82-pXxzMA2uZpEjXNmn_9duS1o9GryBETCHoMLpzijw","profile-url":"https://app.hubspot.com/contacts/62515/lists/public/contact/_AO_T-mMbtNq2RnAUjbHWrHMch5z4aOs7MBYrtC9WGDpghGH-X3L3ZuRjqPAj5LhRh5C17U-jCRLDOUi1hcvLdzqFAo1-vyCmW82-pXxzMA2uZpEjXNmn_9duS1o9GryBETCHoMLpzijw/","properties":{"hs_analytics_num_visits":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_referrer":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_linkedin_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_url":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_last_engagement":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_social_num_broadcast_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"hs_social_facebook_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"createdate":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"API","source-id":null,"source-label":null,"timestamp":1345062449002,"selected":false}]},"lastname":{"value":"Cunningham","versions":[{"value":"Cunningham","source-type":"API","source-id":null,"source-label":null,"timestamp":1361146313002,"selected":false}]},"hs_social_twitter_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"firstname":{"value":"Steve","versions":[{"value":"Steve","source-type":"API","source-id":null,"source-label":null,"timestamp":1361146313002,"selected":false}]},"hs_analytics_first_url":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source":{"value":"OFFLINE","versions":[{"value":"OFFLINE","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_referrer":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_num_event_completions":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"hs_social_google_plus_clicks":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]},"email":{"value":"testingapis@hubspot.com","versions":[{"value":"testingapis@hubspot.com","source-type":"CONTACTS_WEB","source-id":"dadams@hubspot.com","source-label":null,"timestamp":1345062449008,"selected":false}]},"hs_analytics_last_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_num_page_views":{"value":"0","versions":[{"value":"0","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_first_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source_data_2":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_source_data_1":{"value":"","versions":[{"value":"","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1345067864004,"selected":false}]},"hs_analytics_last_visit_timestamp":{"value":"1345062449327","versions":[{"value":"1345062449327","source-type":"ANALYTICS","source-id":null,"source-label":null,"timestamp":1348916431004,"selected":false}]}},"form-submissions":[],"list-memberships":[],"identity-profiles":[{"vid":82325,"identities":[{"type":"EMAIL","value":"testingapis@hubspot.com","timestamp":1345062449327},{"type":"LEAD_GUID","value":"c0da5c41-f289-4642-910c-9aa2b0fba245","timestamp":1345062449333}]}]}'
30
- http_version:
31
- recorded_at: Mon, 18 Feb 2013 00:35:33 GMT
32
- - request:
33
- method: get
34
- uri: https://api.hubapi.com/contacts/v1/contact/vid/9999999/profile?hapikey=demo
35
- body:
36
- encoding: US-ASCII
37
- string: ''
38
- headers: {}
39
- response:
40
- status:
41
- code: 404
42
- message: Not Found
43
- headers:
44
- Content-Type:
45
- - application/json;charset=UTF-8
46
- Date:
47
- - Mon, 18 Feb 2013 00:35:34 GMT
48
- Server:
49
- - Apache-Coyote/1.1
50
- Content-Length:
51
- - '95'
52
- Connection:
53
- - keep-alive
54
- body:
55
- encoding: US-ASCII
56
- string: ! '{"status":"error","message":"resource not found","guid":"4710ce10-c3c7-4f35-ae2c-4c4f182325a6"}'
57
- http_version:
58
- recorded_at: Mon, 18 Feb 2013 00:35:34 GMT
59
- recorded_with: VCR 2.4.0