hubspot-ruby 0.5.0 → 0.6.0

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.
@@ -1,35 +0,0 @@
1
- describe 'Deals pipeline API Live test', live: true do
2
-
3
- before do
4
- Hubspot.configure hapikey: 'demo'
5
- end
6
-
7
- let(:params) do
8
- {
9
- 'label' => 'auto pipeline1',
10
- 'stages' => [
11
- {
12
- 'label' => 'initial state',
13
- 'displayOrder' => 0,
14
- 'probability' => 0.5
15
- },
16
- {
17
- 'label' => 'next state',
18
- 'displayOrder' => 1,
19
- 'probability' => 0.9
20
- }
21
- ]
22
- }
23
- end
24
-
25
- it 'should create, find, update and destroy' do
26
- pipeline = Hubspot::DealPipeline.create!(params)
27
-
28
- expect(pipeline.label).to eql 'auto pipeline1'
29
- expect(pipeline.stages.size).to eql 2
30
- expect(pipeline.stages.first['label']).to eql 'initial state'
31
- expect(pipeline.stages[1]['label']).to eql 'next state'
32
-
33
- pipeline.destroy!
34
- end
35
- end
@@ -1,123 +0,0 @@
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
@@ -1,35 +0,0 @@
1
- describe "Deals API Live test", live: true do
2
-
3
- before do
4
- Hubspot.configure hapikey: "demo"
5
- end
6
-
7
- it 'should create, find, update and destroy' do
8
- contact = Hubspot::Contact.find_by_email("create_delete_test@hsgemtest.com") rescue nil
9
- contact ||= Hubspot::Contact.create!("create_delete_test@hsgemtest.com")
10
-
11
- expect(contact).to be_present
12
-
13
- deal = Hubspot::Deal.create!(62515, [], [contact.vid], { amount: 30, dealstage: 'closedwon' })
14
- expect(deal).to be_present
15
-
16
- expect(deal['dealstage']).to eql 'closedwon'
17
-
18
- deal.update!({dealstage: 'closedlost'})
19
-
20
- expect(deal['dealstage']).to eql 'closedlost'
21
- expect(deal['amount']).to eql '30'
22
-
23
- #to be sure it was updated
24
- updated_deal = Hubspot::Deal.find(deal.deal_id)
25
-
26
- expect(updated_deal['dealstage']).to eql 'closedlost'
27
- expect(updated_deal['amount']).to eql '30'
28
-
29
- expect(deal.destroy!).to be true
30
- expect(contact.destroy!).to be true
31
-
32
- # cant find anymore
33
- expect { Hubspot::Deal.find(deal.deal_id) }.to raise_error
34
- end
35
- end