Skip to content

Commit

Permalink
add default properties for ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
Trosss committed Nov 12, 2024
1 parent 45531e9 commit 67cbaa5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
2 changes: 1 addition & 1 deletion hubspot-api-ruby.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "hubspot-api-ruby"
s.version = "0.17.0"
s.version = "0.17.1"
s.require_paths = ["lib"]
s.authors = ["Jonathan"]
s.email = ["[email protected]"]
Expand Down
6 changes: 4 additions & 2 deletions lib/hubspot/ticket.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ module Hubspot
class Ticket
TICKETS_PATH = '/crm/v3/objects/tickets'
TICKET_PATH = '/crm/v3/objects/tickets/:ticket_id'
DEFAULT_TICKET_FIELDS='content,createdate,hs_lastmodifieddate,hs_object_id,hs_pipeline,hs_pipeline_stage,'\
'hs_ticket_category,hs_ticket_priority,hubspot_owner_id,subject'

attr_reader :properties, :id

Expand Down Expand Up @@ -53,8 +55,8 @@ def update!(id, properties = {})
new(response)
end

def find(ticket_id)
response = Hubspot::Connection.get_json(TICKET_PATH, { ticket_id: ticket_id })
def find(ticket_id, properties = DEFAULT_TICKET_FIELDS)
response = Hubspot::Connection.get_json(TICKET_PATH, { ticket_id: ticket_id, properties: })
new(response)
end
end
Expand Down
36 changes: 18 additions & 18 deletions spec/fixtures/vcr_cassettes/ticket_find.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions spec/lib/hubspot/ticket_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
VCR.use_cassette 'ticket' do
expect(new_ticket.id).not_to be_nil
expect(new_ticket.properties[:subject]).to eq('test ticket')
expect(new_ticket.properties[:hubspot_owner_id]).to be_nil
end
end
end
Expand Down

0 comments on commit 67cbaa5

Please sign in to comment.