Class: Pingram::SendEmailRequest

Inherits:
ApiModelBase show all
Defined in:
lib/pingram/models/send_email_request.rb

Overview

Request body for ‘POST /email` (send email without a template).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ SendEmailRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
141
142
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/pingram/models/send_email_request.rb', line 109

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::SendEmailRequest` 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 `Pingram::SendEmailRequest`. 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?(:'type')
    self.type = attributes[:'type']
  else
    self.type = nil
  end

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

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

  if attributes.key?(:'html')
    self.html = attributes[:'html']
  else
    self.html = nil
  end

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

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

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

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

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

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

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

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

Instance Attribute Details

#attachmentsObject

The attachments of the email.



50
51
52
# File 'lib/pingram/models/send_email_request.rb', line 50

def attachments
  @attachments
end

#bcc_addressesObject

The BCC addresses of the email.



47
48
49
# File 'lib/pingram/models/send_email_request.rb', line 47

def bcc_addresses
  @bcc_addresses
end

#cc_addressesObject

The CC addresses of the email.



44
45
46
# File 'lib/pingram/models/send_email_request.rb', line 44

def cc_addresses
  @cc_addresses
end

#from_addressObject

The email address of the sender.



35
36
37
# File 'lib/pingram/models/send_email_request.rb', line 35

def from_address
  @from_address
end

#from_nameObject

The display name of the sender.



32
33
34
# File 'lib/pingram/models/send_email_request.rb', line 32

def from_name
  @from_name
end

#htmlObject

The HTML body of the email.



29
30
31
# File 'lib/pingram/models/send_email_request.rb', line 29

def html
  @html
end

#preview_textObject

The preview text of the email.



38
39
40
# File 'lib/pingram/models/send_email_request.rb', line 38

def preview_text
  @preview_text
end

#reply_to_addressesObject

The reply-to addresses of the email.



41
42
43
# File 'lib/pingram/models/send_email_request.rb', line 41

def reply_to_addresses
  @reply_to_addresses
end

#scheduleObject

The ISO 8601 datetime to schedule the email.



53
54
55
# File 'lib/pingram/models/send_email_request.rb', line 53

def schedule
  @schedule
end

#subjectObject

The subject of the email.



26
27
28
# File 'lib/pingram/models/send_email_request.rb', line 26

def subject
  @subject
end

#toObject

The email address of the recipient.



23
24
25
# File 'lib/pingram/models/send_email_request.rb', line 23

def to
  @to
end

#typeObject

The notification type to send.



20
21
22
# File 'lib/pingram/models/send_email_request.rb', line 20

def type
  @type
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



74
75
76
# File 'lib/pingram/models/send_email_request.rb', line 74

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



79
80
81
# File 'lib/pingram/models/send_email_request.rb', line 79

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/pingram/models/send_email_request.rb', line 56

def self.attribute_map
  {
    :'type' => :'type',
    :'to' => :'to',
    :'subject' => :'subject',
    :'html' => :'html',
    :'from_name' => :'fromName',
    :'from_address' => :'fromAddress',
    :'preview_text' => :'previewText',
    :'reply_to_addresses' => :'replyToAddresses',
    :'cc_addresses' => :'ccAddresses',
    :'bcc_addresses' => :'bccAddresses',
    :'attachments' => :'attachments',
    :'schedule' => :'schedule'
  }
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



297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
# File 'lib/pingram/models/send_email_request.rb', line 297

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_nullableObject

List of attributes with nullable: true



102
103
104
105
# File 'lib/pingram/models/send_email_request.rb', line 102

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

.openapi_typesObject

Attribute type mapping.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/pingram/models/send_email_request.rb', line 84

def self.openapi_types
  {
    :'type' => :'String',
    :'to' => :'String',
    :'subject' => :'String',
    :'html' => :'String',
    :'from_name' => :'String',
    :'from_address' => :'String',
    :'preview_text' => :'String',
    :'reply_to_addresses' => :'Array<String>',
    :'cc_addresses' => :'Array<String>',
    :'bcc_addresses' => :'Array<String>',
    :'attachments' => :'Array<SendEmailRequestAttachmentsInner>',
    :'schedule' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/pingram/models/send_email_request.rb', line 265

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      type == o.type &&
      to == o.to &&
      subject == o.subject &&
      html == o.html &&
      from_name == o.from_name &&
      from_address == o.from_address &&
      preview_text == o.preview_text &&
      reply_to_addresses == o.reply_to_addresses &&
      cc_addresses == o.cc_addresses &&
      bcc_addresses == o.bcc_addresses &&
      attachments == o.attachments &&
      schedule == o.schedule
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


284
285
286
# File 'lib/pingram/models/send_email_request.rb', line 284

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



290
291
292
# File 'lib/pingram/models/send_email_request.rb', line 290

def hash
  [type, to, subject, html, from_name, from_address, preview_text, reply_to_addresses, cc_addresses, bcc_addresses, attachments, schedule].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/pingram/models/send_email_request.rb', line 190

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @type.nil?
    invalid_properties.push('invalid value for "type", type cannot be nil.')
  end

  if @to.nil?
    invalid_properties.push('invalid value for "to", to cannot be nil.')
  end

  if @subject.nil?
    invalid_properties.push('invalid value for "subject", subject cannot be nil.')
  end

  if @html.nil?
    invalid_properties.push('invalid value for "html", html cannot be nil.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/pingram/models/send_email_request.rb', line 319

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

#valid?Boolean

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

Returns:

  • (Boolean)

    true if the model is valid



214
215
216
217
218
219
220
221
# File 'lib/pingram/models/send_email_request.rb', line 214

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @type.nil?
  return false if @to.nil?
  return false if @subject.nil?
  return false if @html.nil?
  true
end