Class: PrioTicket::Reservation
- Inherits:
-
Object
- Object
- PrioTicket::Reservation
- Defined in:
- lib/prioticket/reservation.rb
Overview
Describes a Reservation
Instance Attribute Summary collapse
-
#booking_details ⇒ Object
Returns the value of attribute booking_details.
-
#booking_status ⇒ Object
Returns the value of attribute booking_status.
-
#cancellation_date_time ⇒ Object
Returns the value of attribute cancellation_date_time.
-
#distributor_id ⇒ Object
Returns the value of attribute distributor_id.
-
#distributor_reference ⇒ Object
Returns the value of attribute distributor_reference.
-
#from_date_time ⇒ Object
Returns the value of attribute from_date_time.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#pickup_point_id ⇒ Object
Returns the value of attribute pickup_point_id.
-
#reservation_reference ⇒ Object
Returns the value of attribute reservation_reference.
-
#ticket_id ⇒ Object
Returns the value of attribute ticket_id.
-
#to_date_time ⇒ Object
Returns the value of attribute to_date_time.
Class Method Summary collapse
Instance Method Summary collapse
-
#cancel ⇒ Reservation
Cancels the current reservation.
- #cancelled ⇒ Object
-
#initialize(args) ⇒ Reservation
constructor
A new instance of Reservation.
-
#save ⇒ Object
Sends the reservation request tot the API.
- #success ⇒ Object (also: #cancelled?)
Constructor Details
#initialize(args) ⇒ Reservation
22 23 24 25 26 27 |
# File 'lib/prioticket/reservation.rb', line 22 def initialize(args) return if args.nil? args.each do |k,v| PrioTicket.parse_json_value(self, k,v) end end |
Instance Attribute Details
#booking_details ⇒ Object
Returns the value of attribute booking_details.
15 16 17 |
# File 'lib/prioticket/reservation.rb', line 15 def booking_details @booking_details end |
#booking_status ⇒ Object
Returns the value of attribute booking_status.
19 20 21 |
# File 'lib/prioticket/reservation.rb', line 19 def booking_status @booking_status end |
#cancellation_date_time ⇒ Object
Returns the value of attribute cancellation_date_time.
20 21 22 |
# File 'lib/prioticket/reservation.rb', line 20 def cancellation_date_time @cancellation_date_time end |
#distributor_id ⇒ Object
Returns the value of attribute distributor_id.
10 11 12 |
# File 'lib/prioticket/reservation.rb', line 10 def distributor_id @distributor_id end |
#distributor_reference ⇒ Object
Returns the value of attribute distributor_reference.
16 17 18 |
# File 'lib/prioticket/reservation.rb', line 16 def distributor_reference @distributor_reference end |
#from_date_time ⇒ Object
Returns the value of attribute from_date_time.
13 14 15 |
# File 'lib/prioticket/reservation.rb', line 13 def from_date_time @from_date_time end |
#identifier ⇒ Object
Returns the value of attribute identifier.
9 10 11 |
# File 'lib/prioticket/reservation.rb', line 9 def identifier @identifier end |
#pickup_point_id ⇒ Object
Returns the value of attribute pickup_point_id.
12 13 14 |
# File 'lib/prioticket/reservation.rb', line 12 def pickup_point_id @pickup_point_id end |
#reservation_reference ⇒ Object
Returns the value of attribute reservation_reference.
18 19 20 |
# File 'lib/prioticket/reservation.rb', line 18 def reservation_reference @reservation_reference end |
#ticket_id ⇒ Object
Returns the value of attribute ticket_id.
11 12 13 |
# File 'lib/prioticket/reservation.rb', line 11 def ticket_id @ticket_id end |
#to_date_time ⇒ Object
Returns the value of attribute to_date_time.
14 15 16 |
# File 'lib/prioticket/reservation.rb', line 14 def to_date_time @to_date_time end |
Class Method Details
.cancel(distributor_id: nil, reservation_reference: nil, distributor_reference: nil, identifier: nil) ⇒ Object
59 60 61 62 63 64 65 66 67 68 |
# File 'lib/prioticket/reservation.rb', line 59 def self.cancel(distributor_id: nil, reservation_reference: nil, distributor_reference: nil, identifier: nil) reservation = PrioTicket::Reservation.new( distributor_id: distributor_id, reservation_reference: reservation_reference, distributor_reference: distributor_reference, identifier: identifier ) reservation.cancel return reservation end |
Instance Method Details
#cancel ⇒ Reservation
Cancels the current reservation
54 55 56 57 |
# File 'lib/prioticket/reservation.rb', line 54 def cancel result = PrioTicket::API.call(cancel_request_body, identifier) parse_result(result) end |
#cancelled ⇒ Object
37 38 39 |
# File 'lib/prioticket/reservation.rb', line 37 def cancelled booking_status == "Cancelled" || cancellation_date_time end |
#save ⇒ Object
Sends the reservation request tot the API
46 47 48 |
# File 'lib/prioticket/reservation.rb', line 46 def save request_reservation end |
#success ⇒ Object Also known as: cancelled?
29 30 31 |
# File 'lib/prioticket/reservation.rb', line 29 def success booking_status == "Reserved" end |