Class: Asdawqw::Thread
- Defined in:
- lib/asdawqw/models/thread.rb
Overview
Thread Model.
Instance Attribute Summary collapse
-
#channel_abb ⇒ ChannelABBEnum
Channel abbreviation - unique channel value in BookingPal.
-
#channel_name ⇒ String
Channel from where come reservation.
-
#date_from ⇒ Date
Start date of reservation.
-
#date_to ⇒ Date
End date of reservation.
-
#guest_email_address ⇒ String
Email of guest.
-
#guest_name ⇒ String
Name of guest.
-
#id ⇒ Integer
Thread ID.
-
#last_message_sent_at ⇒ String
Time when last message was sent.
-
#last_message_text ⇒ String
Last message text.
-
#product_id ⇒ Integer
ID of product in BookingPal database.
-
#reservation_id ⇒ Integer
ID of reservation.
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(id = nil, last_message_sent_at = nil, last_message_text = nil, channel_name = nil, channel_abb = nil, guest_name = nil, guest_email_address = nil, product_id = nil, date_from = nil, date_to = nil, reservation_id = nil) ⇒ Thread
constructor
A new instance of Thread.
Methods inherited from BaseModel
Constructor Details
#initialize(id = nil, last_message_sent_at = nil, last_message_text = nil, channel_name = nil, channel_abb = nil, guest_name = nil, guest_email_address = nil, product_id = nil, date_from = nil, date_to = nil, reservation_id = nil) ⇒ Thread
Returns a new instance of Thread.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/asdawqw/models/thread.rb', line 70 def initialize(id = nil, = nil, = nil, channel_name = nil, channel_abb = nil, guest_name = nil, guest_email_address = nil, product_id = nil, date_from = nil, date_to = nil, reservation_id = nil) @id = id @last_message_sent_at = @last_message_text = @channel_name = channel_name @channel_abb = channel_abb @guest_name = guest_name @guest_email_address = guest_email_address @product_id = product_id @reservation_id = reservation_id @date_from = date_from @date_to = date_to end |
Instance Attribute Details
#channel_abb ⇒ ChannelABBEnum
Channel abbreviation - unique channel value in BookingPal. See Appendix
27 28 29 |
# File 'lib/asdawqw/models/thread.rb', line 27 def channel_abb @channel_abb end |
#channel_name ⇒ String
Channel from where come reservation
23 24 25 |
# File 'lib/asdawqw/models/thread.rb', line 23 def channel_name @channel_name end |
#date_from ⇒ Date
Start date of reservation. Date is in format “yyyy-MM-dd”
47 48 49 |
# File 'lib/asdawqw/models/thread.rb', line 47 def date_from @date_from end |
#date_to ⇒ Date
End date of reservation. Date is in format “yyyy-MM-dd”
51 52 53 |
# File 'lib/asdawqw/models/thread.rb', line 51 def date_to @date_to end |
#guest_email_address ⇒ String
Email of guest
35 36 37 |
# File 'lib/asdawqw/models/thread.rb', line 35 def guest_email_address @guest_email_address end |
#guest_name ⇒ String
Name of guest
31 32 33 |
# File 'lib/asdawqw/models/thread.rb', line 31 def guest_name @guest_name end |
#id ⇒ Integer
Thread ID
11 12 13 |
# File 'lib/asdawqw/models/thread.rb', line 11 def id @id end |
#last_message_sent_at ⇒ String
Time when last message was sent
15 16 17 |
# File 'lib/asdawqw/models/thread.rb', line 15 def @last_message_sent_at end |
#last_message_text ⇒ String
Last message text
19 20 21 |
# File 'lib/asdawqw/models/thread.rb', line 19 def @last_message_text end |
#product_id ⇒ Integer
ID of product in BookingPal database
39 40 41 |
# File 'lib/asdawqw/models/thread.rb', line 39 def product_id @product_id end |
#reservation_id ⇒ Integer
ID of reservation
43 44 45 |
# File 'lib/asdawqw/models/thread.rb', line 43 def reservation_id @reservation_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/asdawqw/models/thread.rb', line 95 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. id = hash['id'] = hash['lastMessageSentAt'] = hash['lastMessageText'] channel_name = hash['channelName'] channel_abb = hash['channelABB'] guest_name = hash['guestName'] guest_email_address = hash['guestEmailAddress'] product_id = hash['productId'] date_from = hash['dateFrom'] date_to = hash['dateTo'] reservation_id = hash['reservationId'] # Create object from extracted values. Thread.new(id, , , channel_name, channel_abb, guest_name, guest_email_address, product_id, date_from, date_to, reservation_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/asdawqw/models/thread.rb', line 54 def self.names @_hash = {} if @_hash.nil? @_hash['id'] = 'id' @_hash['last_message_sent_at'] = 'lastMessageSentAt' @_hash['last_message_text'] = 'lastMessageText' @_hash['channel_name'] = 'channelName' @_hash['channel_abb'] = 'channelABB' @_hash['guest_name'] = 'guestName' @_hash['guest_email_address'] = 'guestEmailAddress' @_hash['product_id'] = 'productId' @_hash['reservation_id'] = 'reservationId' @_hash['date_from'] = 'dateFrom' @_hash['date_to'] = 'dateTo' @_hash end |