Class: Hungrytable::ReservationMake
- Inherits:
-
Object
- Object
- Hungrytable::ReservationMake
- Includes:
- RequestExtensions
- Defined in:
- lib/hungrytable/reservation_make.rb
Overview
Makes a new restaurant reservation
Instance Attribute Summary collapse
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
-
#restaurant_slotlock ⇒ Object
readonly
Returns the value of attribute restaurant_slotlock.
Instance Method Summary collapse
-
#confirmation_number ⇒ String?
Get the confirmation number for the reservation.
-
#error_message ⇒ String?
Get error messages if reservation failed.
-
#initialize(restaurant_slotlock, opts = {}) ⇒ ReservationMake
constructor
A new instance of ReservationMake.
-
#successful? ⇒ Boolean
Check if the reservation was successful.
Constructor Details
#initialize(restaurant_slotlock, opts = {}) ⇒ ReservationMake
Returns a new instance of ReservationMake.
10 11 12 13 14 15 |
# File 'lib/hungrytable/reservation_make.rb', line 10 def initialize(restaurant_slotlock, opts = {}) @opts = opts ensure_required_opts @requester = opts[:requester] || PostRequest @restaurant_slotlock = restaurant_slotlock end |
Instance Attribute Details
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
8 9 10 |
# File 'lib/hungrytable/reservation_make.rb', line 8 def opts @opts end |
#restaurant_slotlock ⇒ Object (readonly)
Returns the value of attribute restaurant_slotlock.
8 9 10 |
# File 'lib/hungrytable/reservation_make.rb', line 8 def restaurant_slotlock @restaurant_slotlock end |
Instance Method Details
#confirmation_number ⇒ String?
Get the confirmation number for the reservation
25 26 27 28 29 |
# File 'lib/hungrytable/reservation_make.rb', line 25 def confirmation_number return nil unless successful? details['ns:ConfirmationNumber'] end |
#error_message ⇒ String?
Get error messages if reservation failed
33 34 35 |
# File 'lib/hungrytable/reservation_make.rb', line 33 def details['ns:ErrorMessage'] end |
#successful? ⇒ Boolean
Check if the reservation was successful
19 20 21 |
# File 'lib/hungrytable/reservation_make.rb', line 19 def successful? details['ns:ErrorID'].to_s == '0' end |