Class: Asdawqw::RequestToBookRequestModel
- Defined in:
- lib/asdawqw/models/request_to_book_request_model.rb
Overview
Model for request to book API request
Instance Attribute Summary collapse
-
#action ⇒ String
RESERVATION_REQUEST.
-
#expires_at ⇒ Date
expires time.
-
#message_to_host ⇒ String
Message from Guest to host.
-
#reservation_id ⇒ Integer
ID of reservation in BookingPal.
-
#rezcaster_notification_request ⇒ ReservationNotificationObject
Reservation Notification object.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
Instance Method Summary collapse
-
#initialize(rezcaster_notification_request = nil, action = nil, reservation_id = nil, expires_at = nil, message_to_host = nil) ⇒ RequestToBookRequestModel
constructor
A new instance of RequestToBookRequestModel.
Methods inherited from BaseModel
Constructor Details
#initialize(rezcaster_notification_request = nil, action = nil, reservation_id = nil, expires_at = nil, message_to_host = nil) ⇒ RequestToBookRequestModel
Returns a new instance of RequestToBookRequestModel.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/asdawqw/models/request_to_book_request_model.rb', line 41 def initialize(rezcaster_notification_request = nil, action = nil, reservation_id = nil, expires_at = nil, = nil) @rezcaster_notification_request = rezcaster_notification_request @action = action @reservation_id = reservation_id @message_to_host = @expires_at = expires_at end |
Instance Attribute Details
#action ⇒ String
RESERVATION_REQUEST
15 16 17 |
# File 'lib/asdawqw/models/request_to_book_request_model.rb', line 15 def action @action end |
#expires_at ⇒ Date
expires time. Date is in format “yyyy-MM-dd”
27 28 29 |
# File 'lib/asdawqw/models/request_to_book_request_model.rb', line 27 def expires_at @expires_at end |
#message_to_host ⇒ String
Message from Guest to host
23 24 25 |
# File 'lib/asdawqw/models/request_to_book_request_model.rb', line 23 def @message_to_host end |
#reservation_id ⇒ Integer
ID of reservation in BookingPal
19 20 21 |
# File 'lib/asdawqw/models/request_to_book_request_model.rb', line 19 def reservation_id @reservation_id end |
#rezcaster_notification_request ⇒ ReservationNotificationObject
Reservation Notification object
11 12 13 |
# File 'lib/asdawqw/models/request_to_book_request_model.rb', line 11 def rezcaster_notification_request @rezcaster_notification_request end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/asdawqw/models/request_to_book_request_model.rb', line 54 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. if hash['rezcasterNotificationRequest'] rezcaster_notification_request = ReservationNotificationObject.from_hash(hash['rezcasterNotificationRequest']) end action = hash['action'] reservation_id = hash['reservationId'] expires_at = hash['expires_at'] = hash['messageToHost'] # Create object from extracted values. RequestToBookRequestModel.new(rezcaster_notification_request, action, reservation_id, expires_at, ) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 38 39 |
# File 'lib/asdawqw/models/request_to_book_request_model.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['rezcaster_notification_request'] = 'rezcasterNotificationRequest' @_hash['action'] = 'action' @_hash['reservation_id'] = 'reservationId' @_hash['message_to_host'] = 'messageToHost' @_hash['expires_at'] = 'expires_at' @_hash end |