Class: Lockally::V1SendPostRequest

Inherits:
ApiModelBase show all
Defined in:
lib/lockally/models/v1_send_post_request.rb

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 = {}) ⇒ V1SendPostRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



106
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
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
187
# File 'lib/lockally/models/v1_send_post_request.rb', line 106

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#attachmentsObject

Returns the value of attribute attachments.



48
49
50
# File 'lib/lockally/models/v1_send_post_request.rb', line 48

def attachments
  @attachments
end

#bccObject

Returns the value of attribute bcc.



24
25
26
# File 'lib/lockally/models/v1_send_post_request.rb', line 24

def bcc
  @bcc
end

#ccObject

Returns the value of attribute cc.



22
23
24
# File 'lib/lockally/models/v1_send_post_request.rb', line 22

def cc
  @cc
end

#fromObject

Returns the value of attribute from.



18
19
20
# File 'lib/lockally/models/v1_send_post_request.rb', line 18

def from
  @from
end

#headersObject

Returns the value of attribute headers.



34
35
36
# File 'lib/lockally/models/v1_send_post_request.rb', line 34

def headers
  @headers
end

#htmlObject

HTML body. Required if text is absent.



32
33
34
# File 'lib/lockally/models/v1_send_post_request.rb', line 32

def html
  @html
end

#send_atObject

Schedule delivery for a future RFC3339 time (≤ 30 days out). Omit or past = send now. Cancel with DELETE /v1/messages/id while scheduled.



46
47
48
# File 'lib/lockally/models/v1_send_post_request.rb', line 46

def send_at
  @send_at
end

#subjectObject

Returns the value of attribute subject.



26
27
28
# File 'lib/lockally/models/v1_send_post_request.rb', line 26

def subject
  @subject
end

#template_idObject

Render subject/text/html from a stored template (GET /v1/templates). Mutually exclusive with inline subject/text/html.



40
41
42
# File 'lib/lockally/models/v1_send_post_request.rb', line 40

def template_id
  @template_id
end

#textObject

Plain-text body. Required if html is absent.



29
30
31
# File 'lib/lockally/models/v1_send_post_request.rb', line 29

def text
  @text
end

#toObject

Returns the value of attribute to.



20
21
22
# File 'lib/lockally/models/v1_send_post_request.rb', line 20

def to
  @to
end

#unsubscribeObject

Mark as opt-in/broadcast: skips suppressed recipients and adds a managed one-click List-Unsubscribe header.



37
38
39
# File 'lib/lockally/models/v1_send_post_request.rb', line 37

def unsubscribe
  @unsubscribe
end

#variablesObject

Values substituted into the template's {variable} placeholders.



43
44
45
# File 'lib/lockally/models/v1_send_post_request.rb', line 43

def variables
  @variables
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



70
71
72
# File 'lib/lockally/models/v1_send_post_request.rb', line 70

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



75
76
77
# File 'lib/lockally/models/v1_send_post_request.rb', line 75

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/lockally/models/v1_send_post_request.rb', line 51

def self.attribute_map
  {
    :'from' => :'from',
    :'to' => :'to',
    :'cc' => :'cc',
    :'bcc' => :'bcc',
    :'subject' => :'subject',
    :'text' => :'text',
    :'html' => :'html',
    :'headers' => :'headers',
    :'unsubscribe' => :'unsubscribe',
    :'template_id' => :'template_id',
    :'variables' => :'variables',
    :'send_at' => :'send_at',
    :'attachments' => :'attachments'
  }
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



278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
# File 'lib/lockally/models/v1_send_post_request.rb', line 278

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



99
100
101
102
# File 'lib/lockally/models/v1_send_post_request.rb', line 99

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

.openapi_typesObject

Attribute type mapping.



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/lockally/models/v1_send_post_request.rb', line 80

def self.openapi_types
  {
    :'from' => :'String',
    :'to' => :'Array<String>',
    :'cc' => :'Array<String>',
    :'bcc' => :'Array<String>',
    :'subject' => :'String',
    :'text' => :'String',
    :'html' => :'String',
    :'headers' => :'Hash<String, String>',
    :'unsubscribe' => :'Boolean',
    :'template_id' => :'String',
    :'variables' => :'Hash<String, String>',
    :'send_at' => :'Time',
    :'attachments' => :'Array<V1SendPostRequestAttachmentsInner>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/lockally/models/v1_send_post_request.rb', line 245

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      from == o.from &&
      to == o.to &&
      cc == o.cc &&
      bcc == o.bcc &&
      subject == o.subject &&
      text == o.text &&
      html == o.html &&
      headers == o.headers &&
      unsubscribe == o.unsubscribe &&
      template_id == o.template_id &&
      variables == o.variables &&
      send_at == o.send_at &&
      attachments == o.attachments
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


265
266
267
# File 'lib/lockally/models/v1_send_post_request.rb', line 265

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



271
272
273
# File 'lib/lockally/models/v1_send_post_request.rb', line 271

def hash
  [from, to, cc, bcc, subject, text, html, headers, unsubscribe, template_id, variables, send_at, attachments].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
# File 'lib/lockally/models/v1_send_post_request.rb', line 191

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

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

  if @to.length < 1
    invalid_properties.push('invalid value for "to", number of items must be greater than or equal to 1.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



300
301
302
303
304
305
306
307
308
309
310
311
312
# File 'lib/lockally/models/v1_send_post_request.rb', line 300

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



211
212
213
214
215
216
217
# File 'lib/lockally/models/v1_send_post_request.rb', line 211

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @from.nil?
  return false if @to.nil?
  return false if @to.length < 1
  true
end