Class: PrioTicket::TicketList
- Inherits:
-
Object
- Object
- PrioTicket::TicketList
- Defined in:
- lib/prioticket/ticket_list.rb
Overview
This API provides all the tickets that are available in the PrioTicket system per distributor.
Instance Attribute Summary collapse
-
#distributor_id ⇒ Object
Returns the value of attribute distributor_id.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#tickets ⇒ Object
Returns the value of attribute tickets.
Class Method Summary collapse
-
.find(distributor_id: nil, identifier: '') ⇒ TicketList
Calls the request type ‘list’ with given.
-
.request_body(distributor_id: nil) ⇒ Object
Computes the request body to send to the API endpoint.
Instance Method Summary collapse
-
#initialize(args, distributor_id, identifier) ⇒ TicketList
constructor
A new instance of TicketList.
Constructor Details
#initialize(args, distributor_id, identifier) ⇒ TicketList
Returns a new instance of TicketList.
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/prioticket/ticket_list.rb', line 14 def initialize(args, distributor_id, identifier) @tickets = [] # Add ticket details as array of TicketListItem objects for ticket_hash in args["data"]["tickets"] ticket = Ticket.new(ticket_hash) ticket.distributor_id = distributor_id ticket.identifier = identifier @tickets << ticket end end |
Instance Attribute Details
#distributor_id ⇒ Object
Returns the value of attribute distributor_id.
11 12 13 |
# File 'lib/prioticket/ticket_list.rb', line 11 def distributor_id @distributor_id end |
#identifier ⇒ Object
Returns the value of attribute identifier.
12 13 14 |
# File 'lib/prioticket/ticket_list.rb', line 12 def identifier @identifier end |
#tickets ⇒ Object
Returns the value of attribute tickets.
10 11 12 |
# File 'lib/prioticket/ticket_list.rb', line 10 def tickets @tickets end |
Class Method Details
.find(distributor_id: nil, identifier: '') ⇒ TicketList
Calls the request type ‘list’ with given
31 32 33 34 35 36 37 |
# File 'lib/prioticket/ticket_list.rb', line 31 def self.find(distributor_id: nil, identifier: '') result = PrioTicket::API.call(request_body(distributor_id: distributor_id), identifier, false) return_obj = self.new(result, distributor_id, identifier) return_obj.distributor_id = distributor_id return_obj.identifier = identifier return return_obj end |
.request_body(distributor_id: nil) ⇒ Object
Computes the request body to send to the API endpoint
44 45 46 47 48 49 50 51 |
# File 'lib/prioticket/ticket_list.rb', line 44 def self.request_body(distributor_id: nil) { request_type: "list", data: { distributor_id: distributor_id } } end |