Class: Asdawqw::RequestToBookRequestModel

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/asdawqw/models/request_to_book_request_model.rb

Overview

Model for request to book API request

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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,
               message_to_host = nil)
  @rezcaster_notification_request = rezcaster_notification_request
  @action = action
  @reservation_id = reservation_id
  @message_to_host = message_to_host
  @expires_at = expires_at
end

Instance Attribute Details

#actionString

RESERVATION_REQUEST

Returns:



15
16
17
# File 'lib/asdawqw/models/request_to_book_request_model.rb', line 15

def action
  @action
end

#expires_atDate

expires time. Date is in format “yyyy-MM-dd”

Returns:

  • (Date)


27
28
29
# File 'lib/asdawqw/models/request_to_book_request_model.rb', line 27

def expires_at
  @expires_at
end

#message_to_hostString

Message from Guest to host

Returns:



23
24
25
# File 'lib/asdawqw/models/request_to_book_request_model.rb', line 23

def message_to_host
  @message_to_host
end

#reservation_idInteger

ID of reservation in BookingPal

Returns:

  • (Integer)


19
20
21
# File 'lib/asdawqw/models/request_to_book_request_model.rb', line 19

def reservation_id
  @reservation_id
end

#rezcaster_notification_requestReservationNotificationObject

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']
  message_to_host = hash['messageToHost']

  # Create object from extracted values.
  RequestToBookRequestModel.new(rezcaster_notification_request,
                                action,
                                reservation_id,
                                expires_at,
                                message_to_host)
end

.namesObject

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