Class: Sendpost::Message
- Inherits:
-
Object
- Object
- Sendpost::Message
- Defined in:
- lib/sendpost_ruby_sdk/models/message.rb
Instance Attribute Summary collapse
-
#account_id ⇒ Object
Account ID associated with the message.
-
#account_ip_pool_id ⇒ Object
Account IP Pool ID associated with the message.
-
#amp_body ⇒ Object
AMP email content.
-
#attachments ⇒ Object
List of attachments.
-
#attempt ⇒ Object
Number of delivery attempts made for the message.
-
#custom_fields ⇒ Object
Key-Value pair of custom fields at message level.
-
#email_type ⇒ Object
Type of email service used.
-
#from ⇒ Object
Object comprising name and email address of the sender.
-
#groups ⇒ Object
List of groups associated with the message.
-
#header_bcc ⇒ Object
List of BCC recipients from email headers.
-
#header_cc ⇒ Object
List of CC recipients from email headers.
-
#header_to ⇒ Object
Returns the value of attribute header_to.
-
#headers ⇒ Object
Key-Value pair which are added to every email message being sent and also with webhooks triggered on events such as email delivered, open, click etc.
-
#html_body ⇒ Object
HTML email content.
-
#ip_id ⇒ Object
IP ID used for sending the message.
-
#ip_pool ⇒ Object
IP Pool from which emails will go out.
-
#local_ip ⇒ Object
Local IP address used for sending the message.
-
#message_id ⇒ Object
Unique ID for the message.
-
#mx_records ⇒ Object
List of MX records for the recipient domain.
-
#pre_text ⇒ Object
Text which appears on mobile right after email subject line.
-
#public_ip ⇒ Object
Public IP address used for sending the message.
-
#reply_to ⇒ Object
Object comprising name and email addresses to which email replies will go to.
-
#sub_account_id ⇒ Object
Sub-account ID associated with the message.
-
#subject ⇒ Object
Email subject line.
-
#submitted_at ⇒ Object
UNIX epoch nano timestamp when message was submitted.
-
#text_body ⇒ Object
Text email content.
-
#to ⇒ Object
Returns the value of attribute to.
-
#track_clicks ⇒ Object
Indicates if email clicks need to be tracked.
-
#track_opens ⇒ Object
Indicates if email opens need to be tracked.
-
#webhook_endpoint ⇒ Object
Webhook endpoint URL for the message.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Message
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 = {}) ⇒ Message
Initializes the object
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 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 196 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Sendpost::Message` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Sendpost::Message`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'message_id') self. = attributes[:'message_id'] end if attributes.key?(:'account_id') self.account_id = attributes[:'account_id'] end if attributes.key?(:'sub_account_id') self.sub_account_id = attributes[:'sub_account_id'] end if attributes.key?(:'ip_id') self.ip_id = attributes[:'ip_id'] end if attributes.key?(:'account_ip_pool_id') self.account_ip_pool_id = attributes[:'account_ip_pool_id'] end if attributes.key?(:'public_ip') self.public_ip = attributes[:'public_ip'] end if attributes.key?(:'local_ip') self.local_ip = attributes[:'local_ip'] end if attributes.key?(:'email_type') self.email_type = attributes[:'email_type'] end if attributes.key?(:'submitted_at') self.submitted_at = attributes[:'submitted_at'] end if attributes.key?(:'from') self.from = attributes[:'from'] end if attributes.key?(:'reply_to') self.reply_to = attributes[:'reply_to'] end if attributes.key?(:'to') self.to = attributes[:'to'] end if attributes.key?(:'header_to') self.header_to = attributes[:'header_to'] end if attributes.key?(:'header_cc') if (value = attributes[:'header_cc']).is_a?(Array) self.header_cc = value end end if attributes.key?(:'header_bcc') if (value = attributes[:'header_bcc']).is_a?(Array) self.header_bcc = value end end if attributes.key?(:'attachments') if (value = attributes[:'attachments']).is_a?(Array) self. = value end end if attributes.key?(:'groups') if (value = attributes[:'groups']).is_a?(Array) self.groups = value end end if attributes.key?(:'ip_pool') self.ip_pool = attributes[:'ip_pool'] end if attributes.key?(:'headers') if (value = attributes[:'headers']).is_a?(Hash) self.headers = value end end if attributes.key?(:'custom_fields') if (value = attributes[:'custom_fields']).is_a?(Hash) self.custom_fields = value end end if attributes.key?(:'subject') self.subject = attributes[:'subject'] end if attributes.key?(:'pre_text') self.pre_text = attributes[:'pre_text'] end if attributes.key?(:'html_body') self.html_body = attributes[:'html_body'] end if attributes.key?(:'text_body') self.text_body = attributes[:'text_body'] end if attributes.key?(:'amp_body') self.amp_body = attributes[:'amp_body'] end if attributes.key?(:'track_opens') self.track_opens = attributes[:'track_opens'] end if attributes.key?(:'track_clicks') self.track_clicks = attributes[:'track_clicks'] end if attributes.key?(:'attempt') self.attempt = attributes[:'attempt'] end if attributes.key?(:'webhook_endpoint') self.webhook_endpoint = attributes[:'webhook_endpoint'] end if attributes.key?(:'mx_records') if (value = attributes[:'mx_records']).is_a?(Array) self.mx_records = value end end end |
Instance Attribute Details
#account_id ⇒ Object
Account ID associated with the message.
22 23 24 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 22 def account_id @account_id end |
#account_ip_pool_id ⇒ Object
Account IP Pool ID associated with the message.
31 32 33 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 31 def account_ip_pool_id @account_ip_pool_id end |
#amp_body ⇒ Object
AMP email content.
89 90 91 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 89 def amp_body @amp_body end |
#attachments ⇒ Object
List of attachments
62 63 64 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 62 def end |
#attempt ⇒ Object
Number of delivery attempts made for the message.
98 99 100 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 98 def attempt @attempt end |
#custom_fields ⇒ Object
Key-Value pair of custom fields at message level
74 75 76 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 74 def custom_fields @custom_fields end |
#email_type ⇒ Object
Type of email service used.
40 41 42 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 40 def email_type @email_type end |
#from ⇒ Object
Object comprising name and email address of the sender
46 47 48 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 46 def from @from end |
#groups ⇒ Object
List of groups associated with the message
65 66 67 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 65 def groups @groups end |
#header_bcc ⇒ Object
List of BCC recipients from email headers
59 60 61 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 59 def header_bcc @header_bcc end |
#header_cc ⇒ Object
List of CC recipients from email headers
56 57 58 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 56 def header_cc @header_cc end |
#header_to ⇒ Object
Returns the value of attribute header_to.
53 54 55 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 53 def header_to @header_to end |
#headers ⇒ Object
Key-Value pair which are added to every email message being sent and also with webhooks triggered on events such as email delivered, open, click etc. They are useful to identify email, recipient etc. in your internal system
71 72 73 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 71 def headers @headers end |
#html_body ⇒ Object
HTML email content.
83 84 85 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 83 def html_body @html_body end |
#ip_id ⇒ Object
IP ID used for sending the message.
28 29 30 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 28 def ip_id @ip_id end |
#ip_pool ⇒ Object
IP Pool from which emails will go out. Relevant only for customers on dedicated IP plans.
68 69 70 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 68 def ip_pool @ip_pool end |
#local_ip ⇒ Object
Local IP address used for sending the message.
37 38 39 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 37 def local_ip @local_ip end |
#message_id ⇒ Object
Unique ID for the message.
19 20 21 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 19 def end |
#mx_records ⇒ Object
List of MX records for the recipient domain
104 105 106 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 104 def mx_records @mx_records end |
#pre_text ⇒ Object
Text which appears on mobile right after email subject line.
80 81 82 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 80 def pre_text @pre_text end |
#public_ip ⇒ Object
Public IP address used for sending the message.
34 35 36 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 34 def public_ip @public_ip end |
#reply_to ⇒ Object
Object comprising name and email addresses to which email replies will go to
49 50 51 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 49 def reply_to @reply_to end |
#sub_account_id ⇒ Object
Sub-account ID associated with the message.
25 26 27 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 25 def sub_account_id @sub_account_id end |
#subject ⇒ Object
Email subject line.
77 78 79 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 77 def subject @subject end |
#submitted_at ⇒ Object
UNIX epoch nano timestamp when message was submitted.
43 44 45 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 43 def submitted_at @submitted_at end |
#text_body ⇒ Object
Text email content.
86 87 88 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 86 def text_body @text_body end |
#to ⇒ Object
Returns the value of attribute to.
51 52 53 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 51 def to @to end |
#track_clicks ⇒ Object
Indicates if email clicks need to be tracked.
95 96 97 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 95 def track_clicks @track_clicks end |
#track_opens ⇒ Object
Indicates if email opens need to be tracked.
92 93 94 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 92 def track_opens @track_opens end |
#webhook_endpoint ⇒ Object
Webhook endpoint URL for the message.
101 102 103 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 101 def webhook_endpoint @webhook_endpoint end |
Class Method Details
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 436 def self._deserialize(type, value) case type.to_sym when :Time Time.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 # models (e.g. Pet) or oneOf klass = Sendpost.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
143 144 145 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 143 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
148 149 150 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 148 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
107 108 109 110 111 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/sendpost_ruby_sdk/models/message.rb', line 107 def self.attribute_map { :'message_id' => :'messageID', :'account_id' => :'accountID', :'sub_account_id' => :'subAccountID', :'ip_id' => :'ipID', :'account_ip_pool_id' => :'accountIPPoolID', :'public_ip' => :'publicIP', :'local_ip' => :'localIP', :'email_type' => :'emailType', :'submitted_at' => :'submittedAt', :'from' => :'from', :'reply_to' => :'replyTo', :'to' => :'to', :'header_to' => :'headerTo', :'header_cc' => :'headerCc', :'header_bcc' => :'headerBcc', :'attachments' => :'attachments', :'groups' => :'groups', :'ip_pool' => :'ipPool', :'headers' => :'headers', :'custom_fields' => :'customFields', :'subject' => :'subject', :'pre_text' => :'preText', :'html_body' => :'htmlBody', :'text_body' => :'textBody', :'amp_body' => :'ampBody', :'track_opens' => :'trackOpens', :'track_clicks' => :'trackClicks', :'attempt' => :'attempt', :'webhook_endpoint' => :'webhookEndpoint', :'mx_records' => :'mxRecords' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 412 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif 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[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
189 190 191 192 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 189 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 153 def self.openapi_types { :'message_id' => :'String', :'account_id' => :'Integer', :'sub_account_id' => :'Integer', :'ip_id' => :'Integer', :'account_ip_pool_id' => :'Integer', :'public_ip' => :'String', :'local_ip' => :'String', :'email_type' => :'String', :'submitted_at' => :'Integer', :'from' => :'Person', :'reply_to' => :'Person', :'to' => :'MessageTo', :'header_to' => :'MessageHeaderTo', :'header_cc' => :'Array<String>', :'header_bcc' => :'Array<String>', :'attachments' => :'Array<String>', :'groups' => :'Array<String>', :'ip_pool' => :'String', :'headers' => :'Hash<String, String>', :'custom_fields' => :'Hash<String, String>', :'subject' => :'String', :'pre_text' => :'String', :'html_body' => :'String', :'text_body' => :'String', :'amp_body' => :'String', :'track_opens' => :'Boolean', :'track_clicks' => :'Boolean', :'attempt' => :'Integer', :'webhook_endpoint' => :'String', :'mx_records' => :'Array<String>' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 362 def ==(o) return true if self.equal?(o) self.class == o.class && == o. && account_id == o.account_id && sub_account_id == o.sub_account_id && ip_id == o.ip_id && account_ip_pool_id == o.account_ip_pool_id && public_ip == o.public_ip && local_ip == o.local_ip && email_type == o.email_type && submitted_at == o.submitted_at && from == o.from && reply_to == o.reply_to && to == o.to && header_to == o.header_to && header_cc == o.header_cc && header_bcc == o.header_bcc && == o. && groups == o.groups && ip_pool == o.ip_pool && headers == o.headers && custom_fields == o.custom_fields && subject == o.subject && pre_text == o.pre_text && html_body == o.html_body && text_body == o.text_body && amp_body == o.amp_body && track_opens == o.track_opens && track_clicks == o.track_clicks && attempt == o.attempt && webhook_endpoint == o.webhook_endpoint && mx_records == o.mx_records end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
507 508 509 510 511 512 513 514 515 516 517 518 519 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 507 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 |
#eql?(o) ⇒ Boolean
399 400 401 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 399 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
405 406 407 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 405 def hash [, account_id, sub_account_id, ip_id, account_ip_pool_id, public_ip, local_ip, email_type, submitted_at, from, reply_to, to, header_to, header_cc, header_bcc, , groups, ip_pool, headers, custom_fields, subject, pre_text, html_body, text_body, amp_body, track_opens, track_clicks, attempt, webhook_endpoint, mx_records].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
347 348 349 350 351 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 347 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
483 484 485 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 483 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
489 490 491 492 493 494 495 496 497 498 499 500 501 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 489 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
477 478 479 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 477 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
355 356 357 358 |
# File 'lib/sendpost_ruby_sdk/models/message.rb', line 355 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' true end |