hubspot-ruby 0.1.8 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -22
  3. data/Gemfile.lock +14 -11
  4. data/LICENSE.txt +0 -2
  5. data/README.md +8 -6
  6. data/RELEASING.md +4 -5
  7. data/Rakefile +2 -17
  8. data/hubspot-ruby.gemspec +20 -157
  9. data/lib/hubspot-ruby.rb +10 -0
  10. data/lib/hubspot/blog.rb +1 -2
  11. data/lib/hubspot/company.rb +149 -0
  12. data/lib/hubspot/company_properties.rb +59 -0
  13. data/lib/hubspot/config.rb +10 -4
  14. data/lib/hubspot/connection.rb +12 -4
  15. data/lib/hubspot/contact.rb +52 -31
  16. data/lib/hubspot/contact_list.rb +16 -16
  17. data/lib/hubspot/contact_properties.rb +53 -6
  18. data/lib/hubspot/deal.rb +2 -2
  19. data/lib/hubspot/deal_pipeline.rb +43 -0
  20. data/lib/hubspot/deal_properties.rb +59 -0
  21. data/lib/hubspot/engagement.rb +133 -0
  22. data/lib/hubspot/exceptions.rb +1 -1
  23. data/lib/hubspot/form.rb +20 -20
  24. data/lib/hubspot/owner.rb +49 -0
  25. data/lib/hubspot/properties.rb +119 -0
  26. data/lib/hubspot/railtie.rb +10 -0
  27. data/lib/hubspot/topic.rb +2 -2
  28. data/lib/hubspot/utils.rb +106 -3
  29. data/spec/lib/hubspot/blog_spec.rb +2 -0
  30. data/spec/lib/hubspot/company_properties_spec.rb +239 -0
  31. data/spec/lib/hubspot/company_spec.rb +190 -0
  32. data/spec/lib/hubspot/config_spec.rb +1 -1
  33. data/spec/lib/hubspot/connection_spec.rb +33 -27
  34. data/spec/lib/hubspot/contact_list_spec.rb +61 -61
  35. data/spec/lib/hubspot/contact_properties_spec.rb +234 -3
  36. data/spec/lib/hubspot/contact_spec.rb +140 -71
  37. data/spec/lib/hubspot/deal_properties_spec.rb +254 -0
  38. data/spec/lib/hubspot/engagement_spec.rb +87 -0
  39. data/spec/lib/hubspot/form_spec.rb +72 -60
  40. data/spec/lib/hubspot/owner_spec.rb +56 -0
  41. data/spec/lib/hubspot/properties_spec.rb +45 -0
  42. data/spec/lib/hubspot/topic_spec.rb +0 -1
  43. data/spec/lib/hubspot/utils_spec.rb +113 -15
  44. data/spec/lib/tasks/properties_spec.rb +90 -0
  45. data/spec/live/companies_integration_spec.rb +23 -0
  46. data/spec/live/companies_properties_integration_spec.rb +120 -0
  47. data/spec/live/contacts_integration_spec.rb +1 -1
  48. data/spec/live/contacts_properties_integration_spec.rb +120 -0
  49. data/spec/live/deal_properties_integration_spec.rb +123 -0
  50. data/spec/live/deals_integration_spec.rb +1 -1
  51. data/spec/support/cassette_helper.rb +1 -1
  52. data/spec/support/tests_helper.rb +3 -3
  53. metadata +39 -78
  54. data/.document +0 -5
  55. data/lib/hubspot/version.rb +0 -9
  56. data/spec/fixtures/vcr_cassettes/add_contacts_to_lists.yml +0 -281
  57. data/spec/fixtures/vcr_cassettes/blog_list.yml +0 -180
  58. data/spec/fixtures/vcr_cassettes/blog_posts.yml +0 -107
  59. data/spec/fixtures/vcr_cassettes/blog_posts_list.yml +0 -6463
  60. data/spec/fixtures/vcr_cassettes/contact_create.yml +0 -64
  61. data/spec/fixtures/vcr_cassettes/contact_create_existing_email.yml +0 -62
  62. data/spec/fixtures/vcr_cassettes/contact_create_invalid_email.yml +0 -63
  63. data/spec/fixtures/vcr_cassettes/contact_create_with_params.yml +0 -64
  64. data/spec/fixtures/vcr_cassettes/contact_destroy.yml +0 -131
  65. data/spec/fixtures/vcr_cassettes/contact_example.yml +0 -32
  66. data/spec/fixtures/vcr_cassettes/contact_find_by_email.yml +0 -59
  67. data/spec/fixtures/vcr_cassettes/contact_find_by_email_batch_mode.yml +0 -509
  68. data/spec/fixtures/vcr_cassettes/contact_find_by_id.yml +0 -59
  69. data/spec/fixtures/vcr_cassettes/contact_find_by_id_batch_mode.yml +0 -33
  70. data/spec/fixtures/vcr_cassettes/contact_find_by_utk.yml +0 -83
  71. data/spec/fixtures/vcr_cassettes/contact_find_by_utk_batch_mode.yml +0 -33
  72. data/spec/fixtures/vcr_cassettes/contact_list_batch_find.yml +0 -65
  73. data/spec/fixtures/vcr_cassettes/contact_list_destroy.yml +0 -63
  74. data/spec/fixtures/vcr_cassettes/contact_list_example.yml +0 -33
  75. data/spec/fixtures/vcr_cassettes/contact_list_find.yml +0 -96
  76. data/spec/fixtures/vcr_cassettes/contact_list_refresh.yml +0 -33
  77. data/spec/fixtures/vcr_cassettes/contact_list_update.yml +0 -36
  78. data/spec/fixtures/vcr_cassettes/contact_update.yml +0 -66
  79. data/spec/fixtures/vcr_cassettes/contacts_among_list.yml +0 -189
  80. data/spec/fixtures/vcr_cassettes/create_form.yml +0 -39
  81. data/spec/fixtures/vcr_cassettes/create_list.yml +0 -36
  82. data/spec/fixtures/vcr_cassettes/create_list_with_filters.yml +0 -36
  83. data/spec/fixtures/vcr_cassettes/deal_create.yml +0 -61
  84. data/spec/fixtures/vcr_cassettes/deal_example.yml +0 -166
  85. data/spec/fixtures/vcr_cassettes/deal_find.yml +0 -115
  86. data/spec/fixtures/vcr_cassettes/destroy_deal.yml +0 -221
  87. data/spec/fixtures/vcr_cassettes/fail_to_create_form.yml +0 -35
  88. data/spec/fixtures/vcr_cassettes/fail_to_create_list.yml +0 -35
  89. data/spec/fixtures/vcr_cassettes/field_among_form.yml +0 -34
  90. data/spec/fixtures/vcr_cassettes/fields_among_form.yml +0 -35
  91. data/spec/fixtures/vcr_cassettes/find_all_contacts.yml +0 -297
  92. data/spec/fixtures/vcr_cassettes/find_all_dynamic_lists.yml +0 -104
  93. data/spec/fixtures/vcr_cassettes/find_all_forms.yml +0 -15378
  94. data/spec/fixtures/vcr_cassettes/find_all_lists.yml +0 -138
  95. data/spec/fixtures/vcr_cassettes/find_all_recent_contacts.yml +0 -33
  96. data/spec/fixtures/vcr_cassettes/find_all_recent_updated_deals.yml +0 -130
  97. data/spec/fixtures/vcr_cassettes/find_all_stastic_lists.yml +0 -21876
  98. data/spec/fixtures/vcr_cassettes/form_destroy.yml +0 -64
  99. data/spec/fixtures/vcr_cassettes/form_example.yml +0 -39
  100. data/spec/fixtures/vcr_cassettes/form_find.yml +0 -69
  101. data/spec/fixtures/vcr_cassettes/form_post.yml +0 -31
  102. data/spec/fixtures/vcr_cassettes/form_submit_data.yml +0 -130
  103. data/spec/fixtures/vcr_cassettes/form_update.yml +0 -77
  104. data/spec/fixtures/vcr_cassettes/one_month_blog_posts_filter_state.yml +0 -19127
  105. data/spec/fixtures/vcr_cassettes/one_month_blog_posts_list.yml +0 -34963
  106. data/spec/fixtures/vcr_cassettes/remove_contacts_from_lists.yml +0 -315
  107. data/spec/fixtures/vcr_cassettes/topic_list.yml +0 -48
  108. data/spec/fixtures/vcr_cassettes/topics_list.yml +0 -86
@@ -0,0 +1,90 @@
1
+ require 'rake'
2
+ require 'stringio'
3
+
4
+ describe 'properties rake tasks', live: true do
5
+ before :all do
6
+ Rake.application.rake_require 'tasks/properties'
7
+ end
8
+
9
+ context 'Contact Properties' do
10
+ let(:file) { '/tmp/contact-demo-props.json' }
11
+ let(:hapikey) { 'demo' }
12
+
13
+ describe 'hubspot:dump_properties' do
14
+ let :run_rake_task do
15
+ Rake::Task['hubspot:dump_properties'].reenable
16
+ Rake.application.invoke_task "hubspot:dump_properties[contact,#{file},#{hapikey}]"
17
+ end
18
+
19
+ it 'saves the properties to a file' do
20
+ run_rake_task
21
+
22
+ props = JSON.parse(File.read(file))
23
+ expect(props.count).to be > 0
24
+ expect(props['groups'].count).to be > 0
25
+ expect(props['properties'].count).to be > 0
26
+ end
27
+ end
28
+
29
+ describe 'hubspot:restore_properties' do
30
+ let :run_rake_task do
31
+ Rake::Task['hubspot:restore_properties'].reenable
32
+ Rake.application.invoke_task "hubspot:restore_properties[contact,#{file},#{hapikey}]"
33
+ end
34
+
35
+ it 'should not need to make any changes' do
36
+ results = capture_stdout { run_rake_task }
37
+ expect(results.include?('Created: ')).to be_false
38
+ expect(results.include?('Updated: ')).to be_false
39
+ end
40
+ end
41
+
42
+ end
43
+
44
+ context 'Deal Properties' do
45
+ let(:file) { '/tmp/deal-demo-props.json' }
46
+ let(:hapikey) { 'demo' }
47
+
48
+ describe 'hubspot:dump_properties' do
49
+ let :run_rake_task do
50
+ Rake::Task['hubspot:dump_properties'].reenable
51
+ Rake.application.invoke_task "hubspot:dump_properties[deal,#{file},#{hapikey}]"
52
+ end
53
+
54
+ it 'saves the properties to a file' do
55
+ pending 'Hubspot disabled this call using the demo hapikey'
56
+
57
+ run_rake_task
58
+
59
+ props = JSON.parse(File.read(file))
60
+ expect(props.count).to be > 0
61
+ expect(props['groups'].count).to be > 0
62
+ expect(props['properties'].count).to be > 0
63
+ end
64
+ end
65
+
66
+ describe 'hubspot:restore_properties' do
67
+ let :run_rake_task do
68
+ Rake::Task['hubspot:restore_properties'].reenable
69
+ Rake.application.invoke_task "hubspot:restore_properties[deal,#{file},#{hapikey}]"
70
+ end
71
+
72
+ it 'should not need to make any changes' do
73
+ pending 'Hubspot disabled this call using the demo hapikey'
74
+
75
+ results = capture_stdout { run_rake_task }
76
+ expect(results.include?('Created: ')).to be_false
77
+ expect(results.include?('Updated: ')).to be_false
78
+ end
79
+ end
80
+
81
+ end
82
+
83
+ def capture_stdout
84
+ previous, $stdout = $stdout, StringIO.new
85
+ yield
86
+ $stdout.string
87
+ ensure
88
+ $stdout = previous
89
+ end
90
+ end
@@ -0,0 +1,23 @@
1
+ describe "Companies API Live test", live: true do
2
+ # Let's try to hit all the API endpoints at least once
3
+
4
+ before do
5
+ Hubspot.configure hapikey: "demo"
6
+ end
7
+
8
+ it 'find, update and destroy a company' do
9
+ companies = Hubspot::Company.find_by_domain("create-delete-test.com")
10
+ companies.first.destroy! if companies.any?
11
+
12
+ company = Hubspot::Company.create!("Create Delete Test", domain: "create-delete-test.com")
13
+ expect(company).to be_present
14
+
15
+ company.update! name: "Create Delete Test 2"
16
+ company = Hubspot::Company.find_by_id(company.vid)
17
+
18
+ expect(company["name"]).to eql "Create Delete Test 2"
19
+
20
+ expect(company.destroy!).to be_true
21
+ expect(Hubspot::Company.find_by_domain("create-delete-test.com")).to eq []
22
+ end
23
+ end
@@ -0,0 +1,120 @@
1
+ describe 'Company Properties API Live test', live: true do
2
+ # Let's try to hit all the API endpoints at least once
3
+
4
+ before do
5
+ Hubspot.configure hapikey: "demo"
6
+ end
7
+
8
+ it 'should return a list of properties' do
9
+ result = Hubspot::CompanyProperties.all
10
+
11
+ expect(result.count).to be > 0
12
+ end
13
+
14
+ it 'should return a list of properties for the specified groups' do
15
+ group_names = %w(companyinformation)
16
+
17
+ result = Hubspot::CompanyProperties.all({}, { include: group_names })
18
+ expect(result.count).to be > 0
19
+ result.each do |entry|
20
+ expect(group_names.include?(entry['groupName']))
21
+ end
22
+ end
23
+
24
+ it 'should return a list of properties except for the specified groups' do
25
+ group_names = %w(companyinformation)
26
+
27
+ result = Hubspot::CompanyProperties.all({}, { exclude: group_names })
28
+ expect(result.count).to be > 0
29
+ result.each do |entry|
30
+ expect(group_names.include?(entry['groupName'])).to be_false
31
+ end
32
+ end
33
+
34
+ it 'should return a list of groups' do
35
+ result = Hubspot::CompanyProperties.groups
36
+
37
+ expect(result.count).to be > 0
38
+ expect(result[0].slice(*%w(name displayName displayOrder)).count).to eq(3)
39
+ end
40
+
41
+ it 'should return list of groups and their properties' do
42
+ result = Hubspot::CompanyProperties.groups({ includeProperties: true })
43
+
44
+ expect(result.count).to be > 0
45
+ expect(result[0].slice(*%w(name displayName displayOrder properties)).count).to eq(4)
46
+ end
47
+
48
+ it 'should return only the requested groups' do
49
+ group_names = %w(companyinformation )
50
+ result = Hubspot::CompanyProperties.groups({}, { include: group_names })
51
+
52
+ expect(result.count).to eq(group_names.count)
53
+ result.each do |entry|
54
+ expect(group_names.include?(entry['name']))
55
+ end
56
+ end
57
+
58
+ it 'should filter out the excluded groups' do
59
+ group_names = %w(companyinformation )
60
+ result = Hubspot::CompanyProperties.groups({}, { exclude: group_names })
61
+
62
+ result.each do |entry|
63
+ expect(group_names.include?(entry['name'])).to be_false
64
+ end
65
+ end
66
+
67
+ describe 'should create, update, and delete properties' do
68
+ let(:data) {
69
+ { 'name' => 'testfield909',
70
+ 'label' => 'A test property',
71
+ 'description' => 'This is a test property',
72
+ 'groupName' => 'companyinformation',
73
+ 'type' => 'string',
74
+ 'fieldType' => 'text',
75
+ 'formField' => false }
76
+ }
77
+
78
+ it 'should create a new property' do
79
+ response = Hubspot::CompanyProperties.create!(data)
80
+ data.map { |key, val| expect(response[key]).to eql(val) }
81
+ end
82
+
83
+ it 'should update an existing property' do
84
+ data['label'] = 'An updated test property'
85
+
86
+ response = Hubspot::CompanyProperties.update!(data['name'], data)
87
+ data.map { |key, val| expect(response[key]).to eql(val) }
88
+ end
89
+
90
+ it 'should delete an existing property' do
91
+ response = Hubspot::CompanyProperties.delete!(data['name'])
92
+ expect(response).to be nil
93
+ end
94
+ end
95
+
96
+ describe 'should create, update, and delete property groups' do
97
+ let(:data) {
98
+ { 'name' => 'testgroup99',
99
+ 'displayName' => 'Test Group 99'
100
+ }
101
+ }
102
+
103
+ it 'should create a new property group' do
104
+ response = Hubspot::CompanyProperties.create_group!(data)
105
+ data.map { |key, val| expect(response[key]).to eql(val) }
106
+ end
107
+
108
+ it 'should update an existing property group' do
109
+ data['displayName'] = 'Test Group 99 Modified'
110
+
111
+ response = Hubspot::CompanyProperties.update_group!(data['name'], data)
112
+ data.map { |key, val| expect(response[key]).to eql(val) }
113
+ end
114
+
115
+ it 'should delete an existing property group' do
116
+ response = Hubspot::CompanyProperties.delete_group!(data['name'])
117
+ expect(response).to be nil
118
+ end
119
+ end
120
+ end
@@ -21,4 +21,4 @@ describe "Contacts API Live test", live: true do
21
21
  expect(contact.destroy!).to be_true
22
22
  expect(Hubspot::Contact.find_by_email("create_delete_test@hsgemtest.com")).to be_nil
23
23
  end
24
- end
24
+ end
@@ -0,0 +1,120 @@
1
+ describe 'Contact Properties API Live test', live: true do
2
+ # Let's try to hit all the API endpoints at least once
3
+
4
+ before do
5
+ Hubspot.configure hapikey: "demo"
6
+ end
7
+
8
+ it 'should return a list of properties' do
9
+ result = Hubspot::ContactProperties.all
10
+
11
+ expect(result.count).to be > 0
12
+ end
13
+
14
+ it 'should return a list of properties for the specified groups' do
15
+ group_names = %w(contactinformation salesforceinformation)
16
+
17
+ result = Hubspot::ContactProperties.all({}, { include: group_names })
18
+ expect(result.count).to be > 0
19
+ result.each do |entry|
20
+ expect(group_names.include?(entry['groupName']))
21
+ end
22
+ end
23
+
24
+ it 'should return a list of properties except for the specified groups' do
25
+ group_names = %w(contactinformation salesforceinformation)
26
+
27
+ result = Hubspot::ContactProperties.all({}, { exclude: group_names })
28
+ expect(result.count).to be > 0
29
+ result.each do |entry|
30
+ expect(group_names.include?(entry['groupName'])).to be_false
31
+ end
32
+ end
33
+
34
+ it 'should return a list of groups' do
35
+ result = Hubspot::ContactProperties.groups
36
+
37
+ expect(result.count).to be > 0
38
+ expect(result[0].slice(*%w(name displayName displayOrder)).count).to eq(3)
39
+ end
40
+
41
+ it 'should return list of groups and their properties' do
42
+ result = Hubspot::ContactProperties.groups({ includeProperties: true })
43
+
44
+ expect(result.count).to be > 0
45
+ expect(result[0].slice(*%w(name displayName displayOrder properties)).count).to eq(4)
46
+ end
47
+
48
+ it 'should return only the requested groups' do
49
+ group_names = %w(contactinformation salesforceinformation)
50
+ result = Hubspot::ContactProperties.groups({}, { include: group_names })
51
+
52
+ expect(result.count).to eq(group_names.count)
53
+ result.each do |entry|
54
+ expect(group_names.include?(entry['name']))
55
+ end
56
+ end
57
+
58
+ it 'should filter out the excluded groups' do
59
+ group_names = %w(contactinformation salesforceinformation)
60
+ result = Hubspot::ContactProperties.groups({}, { exclude: group_names })
61
+
62
+ result.each do |entry|
63
+ expect(group_names.include?(entry['name'])).to be_false
64
+ end
65
+ end
66
+
67
+ describe 'should create, update, and delete properties' do
68
+ let(:data) {
69
+ { 'name' => 'testfield909',
70
+ 'label' => 'A test property',
71
+ 'description' => 'This is a test property',
72
+ 'groupName' => 'contactinformation',
73
+ 'type' => 'string',
74
+ 'fieldType' => 'text',
75
+ 'formField' => false }
76
+ }
77
+
78
+ it 'should create a new property' do
79
+ response = Hubspot::ContactProperties.create!(data)
80
+ data.map { |key, val| expect(response[key]).to eql(val) }
81
+ end
82
+
83
+ it 'should update an existing property' do
84
+ data['label'] = 'An updated test property'
85
+
86
+ response = Hubspot::ContactProperties.update!(data['name'], data)
87
+ data.map { |key, val| expect(response[key]).to eql(val) }
88
+ end
89
+
90
+ it 'should delete an existing property' do
91
+ response = Hubspot::ContactProperties.delete!(data['name'])
92
+ expect(response).to be nil
93
+ end
94
+ end
95
+
96
+ describe 'should create, update, and delete property groups' do
97
+ let(:data) {
98
+ { 'name' => 'testgroup99',
99
+ 'displayName' => 'Test Group 99'
100
+ }
101
+ }
102
+
103
+ it 'should create a new property group' do
104
+ response = Hubspot::ContactProperties.create_group!(data)
105
+ data.map { |key, val| expect(response[key]).to eql(val) }
106
+ end
107
+
108
+ it 'should update an existing property group' do
109
+ data['displayName'] = 'Test Group 99 Modified'
110
+
111
+ response = Hubspot::ContactProperties.update_group!(data['name'], data)
112
+ data.map { |key, val| expect(response[key]).to eql(val) }
113
+ end
114
+
115
+ it 'should delete an existing property group' do
116
+ response = Hubspot::ContactProperties.delete_group!(data['name'])
117
+ expect(response).to be nil
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,123 @@
1
+ describe 'Deal Properties API Live test', live: true do
2
+ # Let's try to hit all the API endpoints at least once
3
+
4
+ before do
5
+ Hubspot.configure hapikey: 'demo'
6
+ end
7
+
8
+ it 'should return a list of properties' do
9
+ pending 'Broken by Hubspot'
10
+ result = Hubspot::DealProperties.all
11
+
12
+ expect(result.count).to be > 0
13
+ end
14
+
15
+ it 'should return a list of properties for the specified groups' do
16
+ pending 'Broken by Hubspot'
17
+ group_names = %w(dealinformation)
18
+
19
+ result = Hubspot::DealProperties.all({}, { include: group_names })
20
+ expect(result.count).to be > 0
21
+ result.each do |entry|
22
+ expect(group_names.include?(entry['groupName']))
23
+ end
24
+ end
25
+
26
+ it 'should return a list of properties except for the specified groups' do
27
+ pending 'Broken by Hubspot'
28
+ group_names = %w(dealinformation)
29
+
30
+ result = Hubspot::DealProperties.all({}, { exclude: group_names })
31
+ expect(result.count).to be > 0
32
+ result.each do |entry|
33
+ expect(group_names.include?(entry['groupName'])).to be_false
34
+ end
35
+ end
36
+
37
+ it 'should return a list of groups' do
38
+ result = Hubspot::DealProperties.groups
39
+
40
+ expect(result.count).to be > 0
41
+ expect(result[0].keys).to eql(%w(name displayName displayOrder hubspotDefined))
42
+ end
43
+
44
+ it 'should return list of groups and their properties' do
45
+ result = Hubspot::DealProperties.groups({ includeProperties: true })
46
+
47
+ expect(result.count).to be > 0
48
+ expect(result[0].keys).to eql(%w(name displayName displayOrder hubspotDefined properties))
49
+ end
50
+
51
+ it 'should return only the requested groups' do
52
+ group_names = %w(dealinformation)
53
+ result = Hubspot::DealProperties.groups({}, { include: group_names })
54
+
55
+ expect(result.count).to eq(group_names.count)
56
+ result.each do |entry|
57
+ expect(group_names.include?(entry['name']))
58
+ end
59
+ end
60
+
61
+ it 'should filter out the excluded groups' do
62
+ group_names = %w(dealinformation)
63
+ result = Hubspot::DealProperties.groups({}, { exclude: group_names })
64
+
65
+ result.each do |entry|
66
+ expect(group_names.include?(entry['name'])).to be_false
67
+ end
68
+ end
69
+
70
+ describe 'should create, update, and delete properties' do
71
+ let(:data) {
72
+ { 'name' => 'testfield909',
73
+ 'label' => 'A test property',
74
+ 'description' => 'This is a test property',
75
+ 'groupName' => 'dealinformation',
76
+ 'type' => 'string',
77
+ 'fieldType' => 'text',
78
+ 'formField' => false }
79
+ }
80
+
81
+ it 'should create a new property' do
82
+ response = Hubspot::DealProperties.create!(data)
83
+ data.map { |key, val| expect(response[key]).to eql(val) }
84
+ end
85
+
86
+ it 'should update an existing property' do
87
+ data['label'] = 'An updated test property'
88
+
89
+ response = Hubspot::DealProperties.update!(data['name'], data)
90
+ data.map { |key, val| expect(response[key]).to eql(val) }
91
+ end
92
+
93
+ it 'should delete an existing property' do
94
+ response = Hubspot::DealProperties.delete!(data['name'])
95
+ expect(response).to be nil
96
+ end
97
+ end
98
+
99
+ describe 'should create, update, and delete property groups' do
100
+ let(:data) {
101
+ { 'name' => 'testgroup99',
102
+ 'displayName' => 'Test Group 99'
103
+ }
104
+ }
105
+
106
+ it 'should create a new property group' do
107
+ response = Hubspot::DealProperties.create_group!(data)
108
+ data.map { |key, val| expect(response[key]).to eql(val) }
109
+ end
110
+
111
+ it 'should update an existing property group' do
112
+ data['displayName'] = 'Test Group 99 Modified'
113
+
114
+ response = Hubspot::DealProperties.update_group!(data['name'], data)
115
+ data.map { |key, val| expect(response[key]).to eql(val) }
116
+ end
117
+
118
+ it 'should delete an existing property group' do
119
+ response = Hubspot::DealProperties.delete_group!(data['name'])
120
+ expect(response).to be nil
121
+ end
122
+ end
123
+ end