hubspot-api-ruby 0.18.0 → 0.19.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/task.rb +13 -3
- data/spec/lib/hubspot/task_spec.rb +32 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45060ea19bf32fc857cbeb5d0a043b5c2c9668197ac25a518da74ecee2522e05
|
4
|
+
data.tar.gz: 68dfbf022d1580f26f51a7688151e8fc21c590e812e18b5b21475de9def30930
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 413df289081df3767598dc9c5c542dfa4c5e729adf55d79631d101ff905440590cdcc8c532531e62d728940d624941a41031b584eb642e245b4990e7fdd1b268
|
7
|
+
data.tar.gz: 66f6e52964908bd067b9c43fc3a0f82b75328d4fb3588acf5c84f5ebe50660228ad3736a4ebb0f94dc4444619e011eaebd3d3e93afc3a63dc1ad072d4a762a7b
|
data/hubspot-api-ruby.gemspec
CHANGED
data/lib/hubspot/task.rb
CHANGED
@@ -8,9 +8,10 @@ module Hubspot
|
|
8
8
|
#
|
9
9
|
class Task
|
10
10
|
TASKS_PATH = '/crm/v3/objects/tasks'
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
SEARCH_PATH = '/crm/v3/objects/tasks/search'
|
12
|
+
TASK_PATH = '/crm/v3/objects/tasks/:task_id'
|
13
|
+
DEFAULT_TASK_FIELDS = %w[hs_timestamp hs_task_body hubspot_owner_id hs_task_subject hs_task_status hs_task_priority
|
14
|
+
hs_task_type hs_task_reminders].freeze
|
14
15
|
|
15
16
|
attr_reader :properties, :id
|
16
17
|
|
@@ -33,6 +34,15 @@ module Hubspot
|
|
33
34
|
response = Hubspot::Connection.get_json(TASK_PATH, task_id: task_id, properties:)
|
34
35
|
new(response)
|
35
36
|
end
|
37
|
+
|
38
|
+
def search(properties = DEFAULT_TASK_FIELDS, body: {})
|
39
|
+
Hubspot::Connection.post_json(SEARCH_PATH, params: {}, body: { properties: }.merge(body))
|
40
|
+
end
|
41
|
+
|
42
|
+
def update!(task_id, properties = {})
|
43
|
+
response = Hubspot::Connection.patch_json(TASK_PATH, params: { task_id: }, body: { properties: })
|
44
|
+
new(response)
|
45
|
+
end
|
36
46
|
end
|
37
47
|
end
|
38
48
|
end
|
@@ -10,7 +10,7 @@ RSpec.describe Hubspot::Task do
|
|
10
10
|
Hubspot::Association.build_association_param('Task', 'Ticket', 16_174_569_112),
|
11
11
|
Hubspot::Association.build_association_param('Task', 'Contact', 75_761_595_194),
|
12
12
|
Hubspot::Association.build_association_param('Task', 'Company', 25_571_271_600),
|
13
|
-
Hubspot::Association.build_association_param('Task', 'Deal', 28_806_796_888)
|
13
|
+
Hubspot::Association.build_association_param('Task', 'Deal', 28_806_796_888)
|
14
14
|
]
|
15
15
|
described_class.create!(params, associations:)
|
16
16
|
end
|
@@ -47,4 +47,35 @@ RSpec.describe Hubspot::Task do
|
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
50
|
+
|
51
|
+
describe 'search' do
|
52
|
+
subject(:search) do
|
53
|
+
body = { filterGroups: [
|
54
|
+
{ filters: [{ propertyName: 'associations.ticket', operator: 'EQ',
|
55
|
+
value: '16676542642' }] }
|
56
|
+
] }
|
57
|
+
described_class.search(%w[hs_task_subject hs_task_status], body:)
|
58
|
+
end
|
59
|
+
|
60
|
+
it 'returns list of tasks matching search body' do
|
61
|
+
VCR.use_cassette 'task_search' do
|
62
|
+
expect(search['total']).to eq(2)
|
63
|
+
expect(search['results'].map { |r| r['id'] }).to contain_exactly('65090432307', '65476695429')
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
describe 'update!' do
|
69
|
+
let(:task_id) { 64_483_143_324 }
|
70
|
+
let(:properties) { { hs_task_status: 'COMPLETED' } }
|
71
|
+
|
72
|
+
subject(:update_task) { described_class.update!(task_id, properties) }
|
73
|
+
|
74
|
+
it 'updates existing task, returns the updated entity' do
|
75
|
+
VCR.use_cassette 'task_update' do
|
76
|
+
task = update_task
|
77
|
+
expect(task.properties[:hs_task_status]).to eq('COMPLETED')
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
50
81
|
end
|
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.19.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11
|
11
|
+
date: 2024-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -352,7 +352,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
352
352
|
- !ruby/object:Gem::Version
|
353
353
|
version: '0'
|
354
354
|
requirements: []
|
355
|
-
rubygems_version: 3.5.
|
355
|
+
rubygems_version: 3.5.22
|
356
356
|
signing_key:
|
357
357
|
specification_version: 4
|
358
358
|
summary: hubspot-api-ruby is a wrapper for the HubSpot REST API
|