class PrioTicket::TicketDetails
This API
provides all the ticket information that is available in the PrioTicket
system for requested `ticket_id`.
@author [henkm]
Attributes
distributor_id[RW]
identifier[RW]
Public Class Methods
find(distributor_id: nil, ticket_id: nil, identifier: nil)
click to toggle source
Calls the request type 'details' with given
@param distributor_id
Integer @return TicketDetails
# File lib/prioticket/ticket_details.rb, line 44 def self.find(distributor_id: nil, ticket_id: nil, identifier: nil) result = PrioTicket::API.call(request_body(ticket_id: ticket_id, distributor_id: distributor_id), identifier) new_obj = self.new(result["data"]) new_obj.distributor_id = distributor_id new_obj.identifier = identifier return new_obj end
new(args=nil)
click to toggle source
# File lib/prioticket/ticket_details.rb, line 31 def initialize(args=nil) return if args.nil? args.each do |k,v| PrioTicket.parse_json_value(self, k,v) end end
request_body(ticket_id: nil, distributor_id: nil)
click to toggle source
Computes the request body to send to the API
endpoint @param distributor_id
Integer
@return Hash
# File lib/prioticket/ticket_details.rb, line 57 def self.request_body(ticket_id: nil, distributor_id: nil) { request_type: "details", data: { distributor_id: distributor_id, ticket_id: ticket_id } } end
Public Instance Methods
availabilities(from_date: Time.now, until_date: Time.now+(60*60*24*21))
click to toggle source
Finds availabilities for given dates
@param from_date: DateTime @param until_date: DateTime
@return [type] [description]
# File lib/prioticket/ticket_details.rb, line 75 def availabilities(from_date: Time.now, until_date: Time.now+(60*60*24*21)) PrioTicket::Availabilities.find(distributor_id: distributor_id, ticket_id: ticket_id, identifier: identifier, from_date: from_date, until_date: until_date) end
reserve_timeslot()
click to toggle source
# File lib/prioticket/ticket_details.rb, line 79 def reserve_timeslot # "request_type": "reserve", # "data": { # "distributor_id": "501", # "ticket_id": "509", # "pickup_point_id": "Wyndham_Apollo_hotel", # "from_date_time": "2017-11-22T09:00:00+01:00", # "to_date_time": "2017-11-23T09:00:00+01:00", # "booking_details": [ # { # "ticket_type": "ADULT", # "count": 1 # } # ], # "distributor_reference": "ABC123456" end