Class: Pingram::ListBroadcastsResponseBroadcastsInner

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb

Defined Under Namespace

Classes: EnumAttributeValidator

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 136

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#archived_at ⇒ Object

Set when the user archives the broadcast; hidden from the default list.



48
49
50
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 48

def archived_at
  @archived_at
end

#audience ⇒ Object

Returns the value of attribute audience.



34
35
36
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 34

def audience
  @audience
end

#broadcast_id ⇒ Object

UUIDv7 (time-ordered).



19
20
21
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 19

def broadcast_id
  @broadcast_id
end

#channel ⇒ Object

Email-only in v1; forward-compatible field.



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

def channel
  @channel
end

#created_at ⇒ Object

Returns the value of attribute created_at.



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

def created_at
  @created_at
end

#from_address ⇒ Object

Returns the value of attribute from_address.



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

def from_address
  @from_address
end

#from_name ⇒ Object

Returns the value of attribute from_name.



36
37
38
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 36

def from_name
  @from_name
end

#name ⇒ Object

Returns the value of attribute name.



21
22
23
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 21

def name
  @name
end

#paused_reason ⇒ Object

Returns the value of attribute paused_reason.



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

def paused_reason
  @paused_reason
end

#reply_to_address ⇒ Object

Returns the value of attribute reply_to_address.



40
41
42
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 40

def reply_to_address
  @reply_to_address
end

#schedule_at ⇒ Object

ISO datetime for scheduled broadcasts.



45
46
47
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 45

def schedule_at
  @schedule_at
end

#status ⇒ Object

Lifecycle status of an email broadcast.



24
25
26
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 24

def status
  @status
end

#subject ⇒ Object

Returns the value of attribute subject.



42
43
44
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 42

def subject
  @subject
end

#type ⇒ Object

Notification type id. Required before send or schedule.



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

def type
  @type
end

#updated_at ⇒ Object

Returns the value of attribute updated_at.



52
53
54
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 52

def updated_at
  @updated_at
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



98
99
100
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 98

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

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



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 77

def self.attribute_map
  {
    :'broadcast_id' => :'broadcastId',
    :'name' => :'name',
    :'status' => :'status',
    :'paused_reason' => :'pausedReason',
    :'type' => :'type',
    :'channel' => :'channel',
    :'audience' => :'audience',
    :'from_name' => :'fromName',
    :'from_address' => :'fromAddress',
    :'reply_to_address' => :'replyToAddress',
    :'subject' => :'subject',
    :'schedule_at' => :'scheduleAt',
    :'archived_at' => :'archivedAt',
    :'created_at' => :'createdAt',
    :'updated_at' => :'updatedAt'
  }
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



449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 449

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



129
130
131
132
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 129

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

.openapi_types ⇒ Object

Attribute type mapping.



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 108

def self.openapi_types
  {
    :'broadcast_id' => :'String',
    :'name' => :'String',
    :'status' => :'String',
    :'paused_reason' => :'String',
    :'type' => :'String',
    :'channel' => :'String',
    :'audience' => :'BroadcastResponseAudience',
    :'from_name' => :'String',
    :'from_address' => :'String',
    :'reply_to_address' => :'String',
    :'subject' => :'String',
    :'schedule_at' => :'String',
    :'archived_at' => :'String',
    :'created_at' => :'String',
    :'updated_at' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 414

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      broadcast_id == o.broadcast_id &&
      name == o.name &&
      status == o.status &&
      paused_reason == o.paused_reason &&
      type == o.type &&
      channel == o.channel &&
      audience == o.audience &&
      from_name == o.from_name &&
      from_address == o.from_address &&
      reply_to_address == o.reply_to_address &&
      subject == o.subject &&
      schedule_at == o.schedule_at &&
      archived_at == o.archived_at &&
      created_at == o.created_at &&
      updated_at == o.updated_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


436
437
438
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 436

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



442
443
444
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 442

def hash
  [broadcast_id, name, status, paused_reason, type, channel, audience, from_name, from_address, reply_to_address, subject, schedule_at, archived_at, created_at, updated_at].hash
end

#list_invalid_properties ⇒ Object

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 233

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

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

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

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

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

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

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

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

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

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

  invalid_properties
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



471
472
473
474
475
476
477
478
479
480
481
482
483
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 471

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



281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/pingram/models/list_broadcasts_response_broadcasts_inner.rb', line 281

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @broadcast_id.nil?
  return false if @name.nil?
  return false if @status.nil?
  status_validator = EnumAttributeValidator.new('String', ["draft", "scheduled", "sending", "sent", "paused", "canceled"])
  return false unless status_validator.valid?(@status)
  paused_reason_validator = EnumAttributeValidator.new('String', ["PAUSED_BY_USER", "REPUTATION_GUARD", "PLAN_EXCEEDED", "PENDING_VERIFICATION", "AUDIENCE_LIMITS_EXCEEDED", "UNVERIFIED_DOMAIN", "SPAM_CONTENT"])
  return false unless paused_reason_validator.valid?(@paused_reason)
  return false if @channel.nil?
  channel_validator = EnumAttributeValidator.new('String', ["email"])
  return false unless channel_validator.valid?(@channel)
  return false if @audience.nil?
  return false if @from_name.nil?
  return false if @from_address.nil?
  return false if @subject.nil?
  return false if @created_at.nil?
  return false if @updated_at.nil?
  true
end