hubspot-api-ruby 0.14.0 → 0.15.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.
- checksums.yaml +4 -4
- data/hubspot-api-ruby.gemspec +1 -1
- data/lib/hubspot/meeting.rb +17 -3
- data/spec/lib/hubspot/meeting_spec.rb +45 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b5da1c5b3161e39ad26020948f72dc349ec275140714ed29b470e9081c0e22d
|
4
|
+
data.tar.gz: e0fbef872458028ef540fe2fac43816980f2a4ad6862ee3acdaf68f6c12fc907
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ddeb851b64faacbed0a42a1019d28c7a04b0899454db482188a7c53f6f9c397ad929fdf445d1143b9cfd85742d595b085e7e58c37b2de988307bc74e15665da
|
7
|
+
data.tar.gz: f2bfebd54dfecd85121f49399d271a1bd3a917b58db832639f983ca98897610e064525a43e645dda305f16d57b4316bae633b65a57289c2211a724c9ac934e8f
|
data/hubspot-api-ruby.gemspec
CHANGED
data/lib/hubspot/meeting.rb
CHANGED
@@ -31,16 +31,30 @@ module Hubspot
|
|
31
31
|
new(response)
|
32
32
|
end
|
33
33
|
|
34
|
-
def find_by_contact(contact_id)
|
34
|
+
def find_by_contact(contact_id, opts={})
|
35
|
+
params = {
|
36
|
+
limit: opts[:limit].presence || 100,
|
37
|
+
after: opts[:after].presence
|
38
|
+
}.compact
|
39
|
+
|
40
|
+
default_filters = [{ propertyName: 'associations.contact', 'operator': 'EQ', value: contact_id }]
|
41
|
+
default_sorts = [{ propertyName: "hs_lastmodifieddate", direction: "DESCENDING" }]
|
42
|
+
|
35
43
|
response = Hubspot::Connection.post_json(MEETING_SEARCH_PATH, {
|
36
44
|
params: {},
|
37
45
|
body: {
|
46
|
+
**params,
|
38
47
|
properties: BASE_PROPERTIES,
|
39
|
-
filters: [
|
48
|
+
filters: (opts[:filters].presence || []) + default_filters,
|
49
|
+
sorts: opts[:sorts].presence || default_sorts
|
40
50
|
}
|
41
51
|
}
|
42
52
|
)
|
43
|
-
|
53
|
+
|
54
|
+
{
|
55
|
+
after: response.dig('paging', 'next', 'after'),
|
56
|
+
meetings: response['results'].map { |f| new(f) }
|
57
|
+
}
|
44
58
|
end
|
45
59
|
|
46
60
|
def create!(owner_id, meeting_title, meeting_body, start_date_time, end_date_time)
|
@@ -75,12 +75,14 @@ RSpec.describe Hubspot::Meeting do
|
|
75
75
|
|
76
76
|
describe ".find_by_contact" do
|
77
77
|
subject(:find_by_contact) do
|
78
|
-
described_class.find_by_contact(1451)
|
78
|
+
described_class.find_by_contact(1451, opts)
|
79
79
|
end
|
80
|
+
let(:opts) { {} }
|
80
81
|
|
81
82
|
it 'retrieves meetings' do
|
82
83
|
VCR.use_cassette 'meeting_find_by_contact' do
|
83
|
-
|
84
|
+
results = find_by_contact
|
85
|
+
meetings = results[:meetings]
|
84
86
|
first_meeting = meetings.first
|
85
87
|
expect(meetings).not_to be_nil
|
86
88
|
expect(first_meeting).not_to be_nil
|
@@ -91,6 +93,47 @@ RSpec.describe Hubspot::Meeting do
|
|
91
93
|
expect(first_meeting.properties[:hs_meeting_end_time]).not_to be nil
|
92
94
|
end
|
93
95
|
end
|
96
|
+
|
97
|
+
context 'when custom filters' do
|
98
|
+
let(:opts) { { filters: [{ propertyName: 'hs_meeting_title', 'operator': 'EQ', value: 'Hello World' }] } }
|
99
|
+
|
100
|
+
it 'retrieves meetings' do
|
101
|
+
VCR.use_cassette 'meeting_find_by_contact_custom_filters' do
|
102
|
+
results = find_by_contact
|
103
|
+
meetings = results[:meetings]
|
104
|
+
first_meeting = meetings.first
|
105
|
+
expect(meetings).not_to be_nil
|
106
|
+
expect(meetings.count).to eq 1
|
107
|
+
expect(first_meeting).not_to be_nil
|
108
|
+
expect(first_meeting.properties[:hubspot_owner_id]).not_to be nil
|
109
|
+
expect(first_meeting.properties[:hs_meeting_title]).not_to be nil
|
110
|
+
expect(first_meeting.properties[:hs_meeting_body]).not_to be nil
|
111
|
+
expect(first_meeting.properties[:hs_meeting_start_time]).not_to be nil
|
112
|
+
expect(first_meeting.properties[:hs_meeting_end_time]).not_to be nil
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
context 'when limit' do
|
118
|
+
let(:opts) { { limit: 2, after: 1 } }
|
119
|
+
|
120
|
+
it 'retrieves meetings' do
|
121
|
+
VCR.use_cassette 'meeting_find_by_contact_limit' do
|
122
|
+
results = find_by_contact
|
123
|
+
meetings = results[:meetings]
|
124
|
+
first_meeting = meetings.first
|
125
|
+
expect(meetings).not_to be_nil
|
126
|
+
expect(results[:after]).not_to be_nil
|
127
|
+
expect(meetings.count).to eq 2
|
128
|
+
expect(first_meeting).not_to be_nil
|
129
|
+
expect(first_meeting.properties[:hubspot_owner_id]).not_to be nil
|
130
|
+
expect(first_meeting.properties[:hs_meeting_title]).not_to be nil
|
131
|
+
expect(first_meeting.properties[:hs_meeting_body]).not_to be nil
|
132
|
+
expect(first_meeting.properties[:hs_meeting_start_time]).not_to be nil
|
133
|
+
expect(first_meeting.properties[:hs_meeting_end_time]).not_to be nil
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|
94
137
|
end
|
95
138
|
|
96
139
|
describe '.create' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hubspot-api-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|