Class: Bandwidth::ListMessageItem

Inherits:
ApiModelBase show all
Defined in:
lib/bandwidth-sdk/models/list_message_item.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 = {}) ⇒ ListMessageItem

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 194

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::ListMessageItem` 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 `Bandwidth::ListMessageItem`. 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.message_id = attributes[:'message_id']
  end

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#account_idObject

The account id associated with this message.



22
23
24
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 22

def 
  @account_id
end

#attachment_countObject

The number of attachments the message has.



55
56
57
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 55

def attachment_count
  @attachment_count
end

#bw_latencyObject

The Bandwidth latency of the message in seconds. Only available for accounts with the Advanced Quality Metrics feature enabled.



67
68
69
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 67

def bw_latency
  @bw_latency
end

#called_number_country_a3Object

The A3 country code of the called number.



76
77
78
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 76

def called_number_country_a3
  @called_number_country_a3
end

#calling_number_country_a3Object

The A3 country code of the calling number.



73
74
75
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 73

def calling_number_country_a3
  @calling_number_country_a3
end

#campaign_classObject

The campaign class of the message if it has one.



61
62
63
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 61

def campaign_class
  @campaign_class
end

#campaign_idObject

The campaign ID of the message if it has one.



64
65
66
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 64

def campaign_id
  @campaign_id
end

#carrier_latencyObject

The carrier latency of the message in seconds. Only available for OUTBOUND messages from accounts with the Advanced Quality Metrics feature enabled.



70
71
72
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 70

def carrier_latency
  @carrier_latency
end

#carrier_nameObject

The name of the carrier. Not currently supported for MMS coming soon.



46
47
48
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 46

def carrier_name
  @carrier_name
end

#destination_tnObject

The recipient phone number of the message.



28
29
30
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 28

def destination_tn
  @destination_tn
end

#error_codeObject

The numeric error code of the message.



40
41
42
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 40

def error_code
  @error_code
end

#locationObject

The location ID associated with this message.



82
83
84
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 82

def location
  @location
end

#message_directionObject

Returns the value of attribute message_direction.



32
33
34
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 32

def message_direction
  @message_direction
end

#message_idObject

The message id



19
20
21
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 19

def message_id
  @message_id
end

#message_lengthObject

The length of the message content.



52
53
54
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 52

def message_length
  @message_length
end

#message_sizeObject

The size of the message including message content and headers.



49
50
51
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 49

def message_size
  @message_size
end

#message_statusObject

Returns the value of attribute message_status.



30
31
32
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 30

def message_status
  @message_status
end

#message_typeObject

Returns the value of attribute message_type.



34
35
36
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 34

def message_type
  @message_type
end

#productObject

The messaging product associated with the message.



79
80
81
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 79

def product
  @product
end

#receive_timeObject

The ISO 8601 datetime of the message.



43
44
45
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 43

def receive_time
  @receive_time
end

#recipient_countObject

The number of recipients the message has.



58
59
60
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 58

def recipient_count
  @recipient_count
end

#segment_countObject

The number of segments the user’s message is broken into before sending over carrier networks.



37
38
39
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 37

def segment_count
  @segment_count
end

#source_tnObject

The source phone number of the message.



25
26
27
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 25

def source_tn
  @source_tn
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



136
137
138
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 136

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



141
142
143
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 141

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 107

def self.attribute_map
  {
    :'message_id' => :'messageId',
    :'account_id' => :'accountId',
    :'source_tn' => :'sourceTn',
    :'destination_tn' => :'destinationTn',
    :'message_status' => :'messageStatus',
    :'message_direction' => :'messageDirection',
    :'message_type' => :'messageType',
    :'segment_count' => :'segmentCount',
    :'error_code' => :'errorCode',
    :'receive_time' => :'receiveTime',
    :'carrier_name' => :'carrierName',
    :'message_size' => :'messageSize',
    :'message_length' => :'messageLength',
    :'attachment_count' => :'attachmentCount',
    :'recipient_count' => :'recipientCount',
    :'campaign_class' => :'campaignClass',
    :'campaign_id' => :'campaignId',
    :'bw_latency' => :'bwLatency',
    :'carrier_latency' => :'carrierLatency',
    :'calling_number_country_a3' => :'callingNumberCountryA3',
    :'called_number_country_a3' => :'calledNumberCountryA3',
    :'product' => :'product',
    :'location' => :'location'
  }
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



361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 361

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



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 175

def self.openapi_nullable
  Set.new([
    :'carrier_name',
    :'message_size',
    :'attachment_count',
    :'recipient_count',
    :'campaign_class',
    :'campaign_id',
    :'bw_latency',
    :'carrier_latency',
    :'calling_number_country_a3',
    :'called_number_country_a3',
    :'product',
    :'location'
  ])
end

.openapi_typesObject

Attribute type mapping.



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
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 146

def self.openapi_types
  {
    :'message_id' => :'String',
    :'account_id' => :'String',
    :'source_tn' => :'String',
    :'destination_tn' => :'String',
    :'message_status' => :'MessageStatusEnum',
    :'message_direction' => :'ListMessageDirectionEnum',
    :'message_type' => :'MessageTypeEnum',
    :'segment_count' => :'Integer',
    :'error_code' => :'Integer',
    :'receive_time' => :'Time',
    :'carrier_name' => :'String',
    :'message_size' => :'Integer',
    :'message_length' => :'Integer',
    :'attachment_count' => :'Integer',
    :'recipient_count' => :'Integer',
    :'campaign_class' => :'String',
    :'campaign_id' => :'String',
    :'bw_latency' => :'Integer',
    :'carrier_latency' => :'Integer',
    :'calling_number_country_a3' => :'String',
    :'called_number_country_a3' => :'String',
    :'product' => :'String',
    :'location' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



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
344
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 318

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      message_id == o.message_id &&
       == o. &&
      source_tn == o.source_tn &&
      destination_tn == o.destination_tn &&
      message_status == o.message_status &&
      message_direction == o.message_direction &&
      message_type == o.message_type &&
      segment_count == o.segment_count &&
      error_code == o.error_code &&
      receive_time == o.receive_time &&
      carrier_name == o.carrier_name &&
      message_size == o.message_size &&
      message_length == o.message_length &&
      attachment_count == o.attachment_count &&
      recipient_count == o.recipient_count &&
      campaign_class == o.campaign_class &&
      campaign_id == o.campaign_id &&
      bw_latency == o.bw_latency &&
      carrier_latency == o.carrier_latency &&
      calling_number_country_a3 == o.calling_number_country_a3 &&
      called_number_country_a3 == o.called_number_country_a3 &&
      product == o.product &&
      location == o.location
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


348
349
350
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 348

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



354
355
356
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 354

def hash
  [message_id, , source_tn, destination_tn, message_status, message_direction, message_type, segment_count, error_code, receive_time, carrier_name, message_size, message_length, attachment_count, recipient_count, campaign_class, campaign_id, bw_latency, carrier_latency, calling_number_country_a3, called_number_country_a3, product, location].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



303
304
305
306
307
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 303

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



383
384
385
386
387
388
389
390
391
392
393
394
395
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 383

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



311
312
313
314
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 311

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end