Class: Brevo::ConversationsMessage
- Inherits:
-
Object
- Object
- Brevo::ConversationsMessage
- Defined in:
- lib/brevo/models/conversations_message.rb
Overview
a Conversations message
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#agent_id ⇒ Object
ID of the agent on whose behalf the message was sent (only in messages sent by an agent).
-
#agent_name ⇒ Object
Agent’s name as displayed to the visitor.
-
#agent_userpic ⇒ Object
Only set if the agent has uploaded a profile picture.
-
#attachments ⇒ Object
An array of file attachments.
-
#bcc ⇒ Object
An array containing details of the blind carbon copy (BCC) recipients (applicable only to messages in email threads).
-
#cc ⇒ Object
An array containing details of the carbon copy (CC) recipients (applicable only to messages in email threads).
-
#created_at ⇒ Object
Timestamp in milliseconds.
-
#file ⇒ Object
Returns the value of attribute file.
-
#forwarded_to_source_status ⇒ Object
Returns the value of attribute forwarded_to_source_status.
-
#from ⇒ Object
Returns the value of attribute from.
-
#id ⇒ Object
Message ID.
-
#integrations ⇒ Object
Integration details.
-
#is_bot ⇒ Object
‘true` for automated messages generated by an AI bot.
-
#is_missed ⇒ Object
‘true` for missed and offline messages.
-
#is_missed_by_visitor ⇒ Object
‘true` for unread agent’s messages in finished chats.
-
#is_pushed ⇒ Object
‘true` for pushed messages.
-
#is_trigger ⇒ Object
‘true` for automatic messages from “Targeted chats & triggers” and API (developers.brevo.com/docs/javascript-api-reference#sendautomessage).
-
#received_from ⇒ Object
In two-way integrations, messages sent via REST API can be marked with receivedFrom property and then filtered out when received in a webhook to avoid infinite loop.
-
#reply_to ⇒ Object
Returns the value of attribute reply_to.
-
#source_message_id ⇒ Object
The ID of the message assigned by the integration source.
-
#subject ⇒ Object
The subject line of the email message (only for messages sent to email threads).
-
#text ⇒ Object
Message text or name of the attached file.
-
#to ⇒ Object
An array containing details of the recipients (applicable only to messages in email threads).
-
#type ⇒ Object
‘"agent"` for agents’ messages, `"visitor"` for visitors’ messages.
-
#visitor_id ⇒ Object
visitor’s ID.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ConversationsMessage
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ ConversationsMessage
Initializes the object
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/brevo/models/conversations_message.rb', line 175 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'type') self.type = attributes[:'type'] end if attributes.has_key?(:'text') self.text = attributes[:'text'] end if attributes.has_key?(:'subject') self.subject = attributes[:'subject'] end if attributes.has_key?(:'visitorId') self.visitor_id = attributes[:'visitorId'] end if attributes.has_key?(:'agentId') self.agent_id = attributes[:'agentId'] end if attributes.has_key?(:'agentName') self.agent_name = attributes[:'agentName'] end if attributes.has_key?(:'createdAt') self.created_at = attributes[:'createdAt'] end if attributes.has_key?(:'isPushed') self.is_pushed = attributes[:'isPushed'] end if attributes.has_key?(:'isTrigger') self.is_trigger = attributes[:'isTrigger'] end if attributes.has_key?(:'isMissed') self.is_missed = attributes[:'isMissed'] end if attributes.has_key?(:'isMissedByVisitor') self.is_missed_by_visitor = attributes[:'isMissedByVisitor'] end if attributes.has_key?(:'agentUserpic') self.agent_userpic = attributes[:'agentUserpic'] end if attributes.has_key?(:'receivedFrom') self.received_from = attributes[:'receivedFrom'] end if attributes.has_key?(:'file') self.file = attributes[:'file'] end if attributes.has_key?(:'from') self.from = attributes[:'from'] end if attributes.has_key?(:'to') if (value = attributes[:'to']).is_a?(Array) self.to = value end end if attributes.has_key?(:'replyTo') self.reply_to = attributes[:'replyTo'] end if attributes.has_key?(:'cc') if (value = attributes[:'cc']).is_a?(Array) self.cc = value end end if attributes.has_key?(:'bcc') if (value = attributes[:'bcc']).is_a?(Array) self.bcc = value end end if attributes.has_key?(:'sourceMessageId') self. = attributes[:'sourceMessageId'] end if attributes.has_key?(:'forwardedToSourceStatus') self.forwarded_to_source_status = attributes[:'forwardedToSourceStatus'] end if attributes.has_key?(:'integrations') self.integrations = attributes[:'integrations'] end if attributes.has_key?(:'isBot') self.is_bot = attributes[:'isBot'] end if attributes.has_key?(:'attachments') if (value = attributes[:'attachments']).is_a?(Array) self. = value end end end |
Instance Attribute Details
#agent_id ⇒ Object
ID of the agent on whose behalf the message was sent (only in messages sent by an agent).
34 35 36 |
# File 'lib/brevo/models/conversations_message.rb', line 34 def agent_id @agent_id end |
#agent_name ⇒ Object
Agent’s name as displayed to the visitor. Only in the messages sent by an agent.
37 38 39 |
# File 'lib/brevo/models/conversations_message.rb', line 37 def agent_name @agent_name end |
#agent_userpic ⇒ Object
Only set if the agent has uploaded a profile picture.
55 56 57 |
# File 'lib/brevo/models/conversations_message.rb', line 55 def agent_userpic @agent_userpic end |
#attachments ⇒ Object
An array of file attachments.
87 88 89 |
# File 'lib/brevo/models/conversations_message.rb', line 87 def @attachments end |
#bcc ⇒ Object
An array containing details of the blind carbon copy (BCC) recipients (applicable only to messages in email threads).
73 74 75 |
# File 'lib/brevo/models/conversations_message.rb', line 73 def bcc @bcc end |
#cc ⇒ Object
An array containing details of the carbon copy (CC) recipients (applicable only to messages in email threads).
70 71 72 |
# File 'lib/brevo/models/conversations_message.rb', line 70 def cc @cc end |
#created_at ⇒ Object
Timestamp in milliseconds.
40 41 42 |
# File 'lib/brevo/models/conversations_message.rb', line 40 def created_at @created_at end |
#file ⇒ Object
Returns the value of attribute file.
60 61 62 |
# File 'lib/brevo/models/conversations_message.rb', line 60 def file @file end |
#forwarded_to_source_status ⇒ Object
Returns the value of attribute forwarded_to_source_status.
78 79 80 |
# File 'lib/brevo/models/conversations_message.rb', line 78 def forwarded_to_source_status @forwarded_to_source_status end |
#from ⇒ Object
Returns the value of attribute from.
62 63 64 |
# File 'lib/brevo/models/conversations_message.rb', line 62 def from @from end |
#id ⇒ Object
Message ID. It can be used for further manipulations with the message.
19 20 21 |
# File 'lib/brevo/models/conversations_message.rb', line 19 def id @id end |
#integrations ⇒ Object
Integration details.
81 82 83 |
# File 'lib/brevo/models/conversations_message.rb', line 81 def integrations @integrations end |
#is_bot ⇒ Object
‘true` for automated messages generated by an AI bot.
84 85 86 |
# File 'lib/brevo/models/conversations_message.rb', line 84 def is_bot @is_bot end |
#is_missed ⇒ Object
‘true` for missed and offline messages.
49 50 51 |
# File 'lib/brevo/models/conversations_message.rb', line 49 def is_missed @is_missed end |
#is_missed_by_visitor ⇒ Object
‘true` for unread agent’s messages in finished chats.
52 53 54 |
# File 'lib/brevo/models/conversations_message.rb', line 52 def is_missed_by_visitor @is_missed_by_visitor end |
#is_pushed ⇒ Object
‘true` for pushed messages
43 44 45 |
# File 'lib/brevo/models/conversations_message.rb', line 43 def is_pushed @is_pushed end |
#is_trigger ⇒ Object
‘true` for automatic messages from “Targeted chats & triggers” and API (developers.brevo.com/docs/javascript-api-reference#sendautomessage)
46 47 48 |
# File 'lib/brevo/models/conversations_message.rb', line 46 def is_trigger @is_trigger end |
#received_from ⇒ Object
In two-way integrations, messages sent via REST API can be marked with receivedFrom property and then filtered out when received in a webhook to avoid infinite loop.
58 59 60 |
# File 'lib/brevo/models/conversations_message.rb', line 58 def received_from @received_from end |
#reply_to ⇒ Object
Returns the value of attribute reply_to.
67 68 69 |
# File 'lib/brevo/models/conversations_message.rb', line 67 def reply_to @reply_to end |
#source_message_id ⇒ Object
The ID of the message assigned by the integration source.
76 77 78 |
# File 'lib/brevo/models/conversations_message.rb', line 76 def @source_message_id end |
#subject ⇒ Object
The subject line of the email message (only for messages sent to email threads).
28 29 30 |
# File 'lib/brevo/models/conversations_message.rb', line 28 def subject @subject end |
#text ⇒ Object
Message text or name of the attached file
25 26 27 |
# File 'lib/brevo/models/conversations_message.rb', line 25 def text @text end |
#to ⇒ Object
An array containing details of the recipients (applicable only to messages in email threads).
65 66 67 |
# File 'lib/brevo/models/conversations_message.rb', line 65 def to @to end |
#type ⇒ Object
‘"agent"` for agents’ messages, `"visitor"` for visitors’ messages.
22 23 24 |
# File 'lib/brevo/models/conversations_message.rb', line 22 def type @type end |
#visitor_id ⇒ Object
visitor’s ID
31 32 33 |
# File 'lib/brevo/models/conversations_message.rb', line 31 def visitor_id @visitor_id end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
# File 'lib/brevo/models/conversations_message.rb', line 112 def self.attribute_map { :'id' => :'id', :'type' => :'type', :'text' => :'text', :'subject' => :'subject', :'visitor_id' => :'visitorId', :'agent_id' => :'agentId', :'agent_name' => :'agentName', :'created_at' => :'createdAt', :'is_pushed' => :'isPushed', :'is_trigger' => :'isTrigger', :'is_missed' => :'isMissed', :'is_missed_by_visitor' => :'isMissedByVisitor', :'agent_userpic' => :'agentUserpic', :'received_from' => :'receivedFrom', :'file' => :'file', :'from' => :'from', :'to' => :'to', :'reply_to' => :'replyTo', :'cc' => :'cc', :'bcc' => :'bcc', :'source_message_id' => :'sourceMessageId', :'forwarded_to_source_status' => :'forwardedToSourceStatus', :'integrations' => :'integrations', :'is_bot' => :'isBot', :'attachments' => :'attachments' } end |
.swagger_types ⇒ Object
Attribute type mapping.
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/brevo/models/conversations_message.rb', line 143 def self.swagger_types { :'id' => :'String', :'type' => :'String', :'text' => :'String', :'subject' => :'String', :'visitor_id' => :'String', :'agent_id' => :'String', :'agent_name' => :'String', :'created_at' => :'Integer', :'is_pushed' => :'BOOLEAN', :'is_trigger' => :'BOOLEAN', :'is_missed' => :'BOOLEAN', :'is_missed_by_visitor' => :'BOOLEAN', :'agent_userpic' => :'String', :'received_from' => :'String', :'file' => :'ConversationsMessageFile', :'from' => :'ConversationsMessageFrom', :'to' => :'Array<ConversationsMessageTo>', :'reply_to' => :'ConversationsMessageReplyTo', :'cc' => :'Array<ConversationsMessageTo>', :'bcc' => :'Array<ConversationsMessageTo>', :'source_message_id' => :'String', :'forwarded_to_source_status' => :'ConversationsMessageForwardedToSourceStatus', :'integrations' => :'Object', :'is_bot' => :'BOOLEAN', :'attachments' => :'Array<ConversationsMessageAttachments>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/brevo/models/conversations_message.rb', line 332 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && type == o.type && text == o.text && subject == o.subject && visitor_id == o.visitor_id && agent_id == o.agent_id && agent_name == o.agent_name && created_at == o.created_at && is_pushed == o.is_pushed && is_trigger == o.is_trigger && is_missed == o.is_missed && is_missed_by_visitor == o.is_missed_by_visitor && agent_userpic == o.agent_userpic && received_from == o.received_from && file == o.file && from == o.from && to == o.to && reply_to == o.reply_to && cc == o.cc && bcc == o.bcc && == o. && forwarded_to_source_status == o.forwarded_to_source_status && integrations == o.integrations && is_bot == o.is_bot && == o. end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 |
# File 'lib/brevo/models/conversations_message.rb', line 398 def _deserialize(type, value) case type.to_sym when :DateTime DateTime.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :BOOLEAN if value.to_s =~ /\A(true|t|yes|y|1)\z/i true else false end when :Object # generic object (usually a Hash), return directly value when /\AArray<(?<inner_type>.+)>\z/ inner_type = Regexp.last_match[:inner_type] value.map { |v| _deserialize(inner_type, v) } when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/ k_type = Regexp.last_match[:k_type] v_type = Regexp.last_match[:v_type] {}.tap do |hash| value.each do |k, v| hash[_deserialize(k_type, k)] = _deserialize(v_type, v) end end else # model temp_model = Brevo.const_get(type).new temp_model.build_from_hash(value) end end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
464 465 466 467 468 469 470 471 472 473 474 475 476 |
# File 'lib/brevo/models/conversations_message.rb', line 464 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
# File 'lib/brevo/models/conversations_message.rb', line 377 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) end elsif !attributes[self.class.attribute_map[key]].nil? self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(o) ⇒ Boolean
364 365 366 |
# File 'lib/brevo/models/conversations_message.rb', line 364 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
370 371 372 |
# File 'lib/brevo/models/conversations_message.rb', line 370 def hash [id, type, text, subject, visitor_id, agent_id, agent_name, created_at, is_pushed, is_trigger, is_missed, is_missed_by_visitor, agent_userpic, received_from, file, from, to, reply_to, cc, bcc, , forwarded_to_source_status, integrations, is_bot, ].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
292 293 294 295 296 297 298 299 |
# File 'lib/brevo/models/conversations_message.rb', line 292 def list_invalid_properties invalid_properties = Array.new if !@created_at.nil? && @created_at < 0 invalid_properties.push('invalid value for "created_at", must be greater than or equal to 0.') end invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
444 445 446 |
# File 'lib/brevo/models/conversations_message.rb', line 444 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
450 451 452 453 454 455 456 457 458 |
# File 'lib/brevo/models/conversations_message.rb', line 450 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) next if value.nil? hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
438 439 440 |
# File 'lib/brevo/models/conversations_message.rb', line 438 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
303 304 305 306 307 308 |
# File 'lib/brevo/models/conversations_message.rb', line 303 def valid? type_validator = EnumAttributeValidator.new('String', ['agent', 'visitor']) return false unless type_validator.valid?(@type) return false if !@created_at.nil? && @created_at < 0 true end |