Class: Sendpost::QEmailMessage

Inherits:
Object
  • Object
show all
Defined in:
lib/sendpost_ruby/models/q_email_message.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ QEmailMessage

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



151
152
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
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
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 151

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Sendpost::QEmailMessage` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!self.class.attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Sendpost::QEmailMessage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'account_id')
    self. = attributes[:'account_id']
  end

  if attributes.key?(:'amp_body')
    self.amp_body = attributes[:'amp_body']
  end

  if attributes.key?(:'attachments')
    if (value = attributes[:'attachments']).is_a?(Array)
      self.attachments = value
    end
  end

  if attributes.key?(:'attempt')
    self.attempt = attributes[:'attempt']
  end

  if attributes.key?(:'custom_fields')
    self.custom_fields = attributes[:'custom_fields']
  end

  if attributes.key?(:'email_type')
    self.email_type = attributes[:'email_type']
  end

  if attributes.key?(:'from')
    self.from = attributes[:'from']
  end

  if attributes.key?(:'groups')
    if (value = attributes[:'groups']).is_a?(Array)
      self.groups = 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?(:'header_cc')
    if (value = attributes[:'header_cc']).is_a?(Array)
      self.header_cc = value
    end
  end

  if attributes.key?(:'header_to')
    self.header_to = attributes[:'header_to']
  end

  if attributes.key?(:'headers')
    self.headers = attributes[:'headers']
  end

  if attributes.key?(:'html_body')
    self.html_body = attributes[:'html_body']
  end

  if attributes.key?(:'ip_id')
    self.ip_id = attributes[:'ip_id']
  end

  if attributes.key?(:'ip_pool')
    self.ip_pool = attributes[:'ip_pool']
  end

  if attributes.key?(:'local_ip')
    self.local_ip = attributes[:'local_ip']
  end

  if attributes.key?(:'message_id')
    self.message_id = attributes[:'message_id']
  end

  if attributes.key?(:'pre_text')
    self.pre_text = attributes[:'pre_text']
  end

  if attributes.key?(:'public_ip')
    self.public_ip = attributes[:'public_ip']
  end

  if attributes.key?(:'reply_to')
    self.reply_to = attributes[:'reply_to']
  end

  if attributes.key?(:'sub_account_id')
    self. = attributes[:'sub_account_id']
  end

  if attributes.key?(:'subject')
    self.subject = attributes[:'subject']
  end

  if attributes.key?(:'submitted_at')
    self. = attributes[:'submitted_at']
  end

  if attributes.key?(:'text_body')
    self.text_body = attributes[:'text_body']
  end

  if attributes.key?(:'to')
    self.to = attributes[:'to']
  end

  if attributes.key?(:'track_clicks')
    self.track_clicks = attributes[:'track_clicks']
  end

  if attributes.key?(:'track_opens')
    self.track_opens = attributes[:'track_opens']
  end
end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



18
19
20
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 18

def 
  @account_id
end

#amp_bodyObject

Returns the value of attribute amp_body.



20
21
22
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 20

def amp_body
  @amp_body
end

#attachmentsObject

Returns the value of attribute attachments.



22
23
24
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 22

def attachments
  @attachments
end

#attemptObject

Returns the value of attribute attempt.



24
25
26
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 24

def attempt
  @attempt
end

#custom_fieldsObject

Returns the value of attribute custom_fields.



26
27
28
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 26

def custom_fields
  @custom_fields
end

#email_typeObject

Returns the value of attribute email_type.



28
29
30
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 28

def email_type
  @email_type
end

#fromObject

Returns the value of attribute from.



30
31
32
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 30

def from
  @from
end

#groupsObject

Returns the value of attribute groups.



32
33
34
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 32

def groups
  @groups
end

#header_bccObject

Returns the value of attribute header_bcc.



34
35
36
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 34

def header_bcc
  @header_bcc
end

#header_ccObject

Returns the value of attribute header_cc.



36
37
38
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 36

def header_cc
  @header_cc
end

#header_toObject

Returns the value of attribute header_to.



38
39
40
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 38

def header_to
  @header_to
end

#headersObject

Returns the value of attribute headers.



40
41
42
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 40

def headers
  @headers
end

#html_bodyObject

Returns the value of attribute html_body.



42
43
44
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 42

def html_body
  @html_body
end

#ip_idObject

Returns the value of attribute ip_id.



44
45
46
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 44

def ip_id
  @ip_id
end

#ip_poolObject

Returns the value of attribute ip_pool.



46
47
48
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 46

def ip_pool
  @ip_pool
end

#local_ipObject

Returns the value of attribute local_ip.



48
49
50
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 48

def local_ip
  @local_ip
end

#message_idObject

Returns the value of attribute message_id.



50
51
52
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 50

def message_id
  @message_id
end

#pre_textObject

Returns the value of attribute pre_text.



52
53
54
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 52

def pre_text
  @pre_text
end

#public_ipObject

Returns the value of attribute public_ip.



54
55
56
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 54

def public_ip
  @public_ip
end

#reply_toObject

Returns the value of attribute reply_to.



56
57
58
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 56

def reply_to
  @reply_to
end

#sub_account_idObject

Returns the value of attribute sub_account_id.



58
59
60
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 58

def 
  @sub_account_id
end

#subjectObject

Returns the value of attribute subject.



60
61
62
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 60

def subject
  @subject
end

#submitted_atObject

Returns the value of attribute submitted_at.



62
63
64
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 62

def 
  @submitted_at
end

#text_bodyObject

Returns the value of attribute text_body.



64
65
66
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 64

def text_body
  @text_body
end

#toObject

Returns the value of attribute to.



66
67
68
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 66

def to
  @to
end

#track_clicksObject

Returns the value of attribute track_clicks.



68
69
70
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 68

def track_clicks
  @track_clicks
end

#track_opensObject

Returns the value of attribute track_opens.



70
71
72
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 70

def track_opens
  @track_opens
end

Class Method Details

.acceptable_attributesObject

Returns all the JSON keys this model knows about



106
107
108
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 106

def self.acceptable_attributes
  attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 73

def self.attribute_map
  {
    :'account_id' => :'accountID',
    :'amp_body' => :'ampBody',
    :'attachments' => :'attachments',
    :'attempt' => :'attempt',
    :'custom_fields' => :'customFields',
    :'email_type' => :'emailType',
    :'from' => :'from',
    :'groups' => :'groups',
    :'header_bcc' => :'headerBcc',
    :'header_cc' => :'headerCc',
    :'header_to' => :'headerTo',
    :'headers' => :'headers',
    :'html_body' => :'htmlBody',
    :'ip_id' => :'ipID',
    :'ip_pool' => :'ipPool',
    :'local_ip' => :'localIP',
    :'message_id' => :'messageID',
    :'pre_text' => :'preText',
    :'public_ip' => :'publicIP',
    :'reply_to' => :'replyTo',
    :'sub_account_id' => :'subAccountID',
    :'subject' => :'subject',
    :'submitted_at' => :'submittedAt',
    :'text_body' => :'textBody',
    :'to' => :'to',
    :'track_clicks' => :'trackClicks',
    :'track_opens' => :'trackOpens'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



343
344
345
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 343

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullableObject

List of attributes with nullable: true



144
145
146
147
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 144

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_typesObject

Attribute type mapping.



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
141
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 111

def self.openapi_types
  {
    :'account_id' => :'Integer',
    :'amp_body' => :'String',
    :'attachments' => :'Array<Attachment>',
    :'attempt' => :'Integer',
    :'custom_fields' => :'Object',
    :'email_type' => :'String',
    :'from' => :'From',
    :'groups' => :'Array<String>',
    :'header_bcc' => :'Array<CopyTo>',
    :'header_cc' => :'Array<CopyTo>',
    :'header_to' => :'To',
    :'headers' => :'Object',
    :'html_body' => :'String',
    :'ip_id' => :'Integer',
    :'ip_pool' => :'String',
    :'local_ip' => :'String',
    :'message_id' => :'String',
    :'pre_text' => :'String',
    :'public_ip' => :'String',
    :'reply_to' => :'ReplyTo',
    :'sub_account_id' => :'Integer',
    :'subject' => :'String',
    :'submitted_at' => :'Integer',
    :'text_body' => :'String',
    :'to' => :'To',
    :'track_clicks' => :'Boolean',
    :'track_opens' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 296

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
       == o. &&
      amp_body == o.amp_body &&
      attachments == o.attachments &&
      attempt == o.attempt &&
      custom_fields == o.custom_fields &&
      email_type == o.email_type &&
      from == o.from &&
      groups == o.groups &&
      header_bcc == o.header_bcc &&
      header_cc == o.header_cc &&
      header_to == o.header_to &&
      headers == o.headers &&
      html_body == o.html_body &&
      ip_id == o.ip_id &&
      ip_pool == o.ip_pool &&
      local_ip == o.local_ip &&
      message_id == o.message_id &&
      pre_text == o.pre_text &&
      public_ip == o.public_ip &&
      reply_to == o.reply_to &&
       == o. &&
      subject == o.subject &&
       == o. &&
      text_body == o.text_body &&
      to == o.to &&
      track_clicks == o.track_clicks &&
      track_opens == o.track_opens
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string

    type Data type

  • string

    value Value to be deserialized

Returns:

  • (Object)

    Deserialized data



374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 374

def _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_one_of) ? klass.build(value) : klass.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

Parameters:

  • value (Object)

    Any valid value

Returns:

  • (Hash)

    Returns the value in the form of hash



445
446
447
448
449
450
451
452
453
454
455
456
457
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 445

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 350

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[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
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


330
331
332
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 330

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



336
337
338
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 336

def hash
  [, amp_body, attachments, attempt, custom_fields, email_type, from, groups, header_bcc, header_cc, header_to, headers, html_body, ip_id, ip_pool, local_ip, message_id, pre_text, public_ip, reply_to, , subject, , text_body, to, track_clicks, track_opens].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



283
284
285
286
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 283

def list_invalid_properties
  invalid_properties = Array.new
  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



421
422
423
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 421

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



427
428
429
430
431
432
433
434
435
436
437
438
439
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 427

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



415
416
417
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 415

def to_s
  to_hash.to_s
end

#valid?Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean)

    true if the model is valid



290
291
292
# File 'lib/sendpost_ruby/models/q_email_message.rb', line 290

def valid?
  true
end