hubspot-api-ruby 0.20.0 → 0.21.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/association.rb +14 -13
- data/lib/hubspot/conversation_thread.rb +27 -0
- data/lib/hubspot-api-ruby.rb +1 -0
- data/spec/lib/hubspot/conversation_thread_spec.rb +25 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3d7600de11889f3e5dfe562ccec90bb6c1edd20b866c972e35ae11c1ce3bacf
|
4
|
+
data.tar.gz: 65698aa080bdb71c8c0e05436cd36af6981b3f1d8c79de9e7e95c32888b9e252
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 49597d6095f36055416f3610e5e7b1059a6f08829b9e3a9c248b753f2ad133d31087edcb6c86f5100cd66bb939d33b8ea1c9fab321012a8a9c5394b3c7ec9368
|
7
|
+
data.tar.gz: 6ebf057a56f6d2d643c2582d96f7f8fd8002cfe7088a72d0bec190dc62e06961470f04b18121d87f2d0b42abe3f2bda6821a63294590e1d536be412b0cd6c472
|
data/hubspot-api-ruby.gemspec
CHANGED
data/lib/hubspot/association.rb
CHANGED
@@ -6,29 +6,30 @@ class Hubspot::Association
|
|
6
6
|
}.freeze
|
7
7
|
|
8
8
|
ASSOCIATION_DEFINITIONS = {
|
9
|
+
"Contact" => {
|
10
|
+
"Deal" => 4
|
11
|
+
},
|
9
12
|
"Company" => {
|
10
13
|
"Contact" => 2,
|
11
|
-
"
|
12
|
-
"
|
14
|
+
"Company" => 13,
|
15
|
+
"Deal" => 6
|
13
16
|
},
|
14
17
|
"Deal" => {
|
15
|
-
"
|
16
|
-
"
|
18
|
+
"Contact" => 3,
|
19
|
+
"Company" => 5
|
17
20
|
},
|
18
|
-
"
|
19
|
-
"
|
21
|
+
"Task" => {
|
22
|
+
"Contact" => 204,
|
23
|
+
"Company" => 192,
|
24
|
+
"Deal" => 216,
|
25
|
+
"Ticket" => 230
|
20
26
|
},
|
21
27
|
"Ticket" => {
|
22
28
|
"Contact" => 16,
|
23
|
-
"
|
29
|
+
"Conversation" => 32,
|
24
30
|
"Company" => 339,
|
31
|
+
"Deal" => 28,
|
25
32
|
"Task" => 229
|
26
|
-
},
|
27
|
-
"Task" => {
|
28
|
-
"Contact" => 204,
|
29
|
-
"Deal" => 216,
|
30
|
-
"Company" => 192,
|
31
|
-
"Ticket" => 230
|
32
33
|
}
|
33
34
|
}.freeze
|
34
35
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'hubspot/utils'
|
2
|
+
|
3
|
+
module Hubspot
|
4
|
+
#
|
5
|
+
# HubSpot Tasks API
|
6
|
+
#
|
7
|
+
# {https://developers.hubspot.com/docs/reference/api/conversations/inbox-and-messages}
|
8
|
+
#
|
9
|
+
class ConversationThread
|
10
|
+
THREAD_PATH = '/conversations/v3/conversations/threads/:thread_id'
|
11
|
+
|
12
|
+
attr_reader :properties, :id
|
13
|
+
|
14
|
+
def initialize(response_hash)
|
15
|
+
@id = response_hash['id']
|
16
|
+
@properties = response_hash.deep_symbolize_keys
|
17
|
+
end
|
18
|
+
|
19
|
+
class << self
|
20
|
+
def find(thread_id, with_associations: false)
|
21
|
+
association = with_associations ? ['TICKET'] : []
|
22
|
+
response = Hubspot::Connection.get_json(THREAD_PATH, thread_id:, association:)
|
23
|
+
new(response)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/hubspot-api-ruby.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
RSpec.describe Hubspot::ConversationThread do
|
2
|
+
describe 'find' do
|
3
|
+
let(:thread_id) { 3_176_297_853 }
|
4
|
+
|
5
|
+
subject(:existing_thread) { described_class.find(thread_id, with_associations: true) }
|
6
|
+
|
7
|
+
it 'gets existing conversation thread' do
|
8
|
+
VCR.use_cassette 'conversation_thread_find' do
|
9
|
+
expect(existing_thread.id).not_to be_nil
|
10
|
+
expect(existing_thread.properties[:status]).to eq('OPEN')
|
11
|
+
expect(existing_thread.properties[:threadAssociations]).to eq(associatedTicketId: '21514722825')
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
context 'when task does not exist' do
|
16
|
+
let(:thread_id) { 996_174_569_112 }
|
17
|
+
|
18
|
+
it 'raises an error' do
|
19
|
+
VCR.use_cassette 'conversation_thread_find' do
|
20
|
+
expect { existing_thread }.to raise_error Hubspot::NotFoundError
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
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.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-03-
|
11
|
+
date: 2025-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -274,6 +274,7 @@ files:
|
|
274
274
|
- lib/hubspot/contact.rb
|
275
275
|
- lib/hubspot/contact_list.rb
|
276
276
|
- lib/hubspot/contact_properties.rb
|
277
|
+
- lib/hubspot/conversation_thread.rb
|
277
278
|
- lib/hubspot/custom_event.rb
|
278
279
|
- lib/hubspot/deal.rb
|
279
280
|
- lib/hubspot/deal_pipeline.rb
|
@@ -309,6 +310,7 @@ files:
|
|
309
310
|
- spec/lib/hubspot/contact_list_spec.rb
|
310
311
|
- spec/lib/hubspot/contact_properties_spec.rb
|
311
312
|
- spec/lib/hubspot/contact_spec.rb
|
313
|
+
- spec/lib/hubspot/conversation_thread_spec.rb
|
312
314
|
- spec/lib/hubspot/custom_event_spec.rb
|
313
315
|
- spec/lib/hubspot/deal_pipeline_spec.rb
|
314
316
|
- spec/lib/hubspot/deal_properties_spec.rb
|
@@ -352,7 +354,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
352
354
|
- !ruby/object:Gem::Version
|
353
355
|
version: '0'
|
354
356
|
requirements: []
|
355
|
-
rubygems_version: 3.5.
|
357
|
+
rubygems_version: 3.5.22
|
356
358
|
signing_key:
|
357
359
|
specification_version: 4
|
358
360
|
summary: hubspot-api-ruby is a wrapper for the HubSpot REST API
|