Class: BundleUp::Unify::Ticketing
- Defined in:
- lib/bundleup/unify/ticketing.rb,
sig/bundleup/unify/ticketing.rbs
Overview
Client for ticketing Unify endpoints.
Constant Summary
Constants inherited from Base
Base::API_VERSION, Base::BASE_URL
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #blank?(value) ⇒ Boolean
-
#ticket(ticket_id, params = {}) ⇒ { data: ticket }
Fetches a single ticket by ID from the connected ticketing tool.
-
#tickets(params = {}) ⇒ { data: Array[ticketing_ticket], metadata: metadata }
Fetches tickets from the connected ticketing tool.
Methods inherited from Base
Constructor Details
This class inherits a constructor from BundleUp::Unify::Base
Instance Method Details
#blank?(value) ⇒ Boolean
38 39 40 |
# File 'lib/bundleup/unify/ticketing.rb', line 38 def blank?(value) value.nil? || value.to_s.empty? end |
#ticket(ticket_id, params = {}) ⇒ { data: ticket }
Fetches a single ticket by ID from the connected ticketing tool.
Not supported by Basecamp, whose API only serves a to-do underneath its project — an id on its own cannot address one.
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/bundleup/unify/ticketing.rb', line 22 def ticket(ticket_id, params = {}) raise ArgumentError, 'ticket_id is required to fetch a ticket.' if blank?(ticket_id) encoded_id = URI.encode_www_form_component(ticket_id) response = connection.get("ticketing/tickets/#{encoded_id}") do |req| req.params = params end raise "Failed to fetch ticketing/tickets/#{encoded_id}: #{response.status}" unless response.success? response.body end |
#tickets(params = {}) ⇒ { data: Array[ticketing_ticket], metadata: metadata }
Fetches tickets from the connected ticketing tool.
8 9 10 11 12 13 14 15 16 |
# File 'lib/bundleup/unify/ticketing.rb', line 8 def tickets(params = {}) response = connection.get('ticketing/tickets') do |req| req.params = params end raise "Failed to fetch ticketing/tickets: #{response.status}" unless response.success? response.body end |