Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Return the Vimaly ticket-id after successfully updating a ticket
Browse files Browse the repository at this point in the history
  • Loading branch information
alto committed Aug 22, 2018
1 parent b96a25d commit 2a552be
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion lib/vimaly/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def update_ticket(id, other_fields)
response = put("/tickets/#{id}", ticket.to_json(custom_field_name_map, true))
case response.status
when 200..299
true
id
else
log_warn "status: #{response.status}"
log_warn " #{response.inspect}"
Expand Down
20 changes: 11 additions & 9 deletions test/client_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,22 +98,24 @@ class ClientTest < Minitest::Test
should "succeed for standard params" do
stub_update_ticket

@client.update_ticket(
123,
title: 'updated title',
description: 'updated description'
id = @client.update_ticket(
123,
title: 'updated title',
description: 'updated description'
)
assert_equal 123, id
end

should "succeed for custom params" do
stub_update_ticket_custom

@client.update_ticket(
123,
title: 'updated title',
description: 'updated description',
'Last seen': Date.new(2016,1,20)
id = @client.update_ticket(
123,
title: 'updated title',
description: 'updated description',
'Last seen': Date.new(2016,1,20)
)
assert_equal 123, id
end
end # updating tickets

Expand Down

0 comments on commit 2a552be

Please sign in to comment.