Class: Bandwidth::ListMessageItem
- Inherits:
-
Object
- Object
- Bandwidth::ListMessageItem
- Defined in:
- lib/bandwidth-sdk/models/list_message_item.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#account_id ⇒ Object
The account id associated with this message.
-
#attachment_count ⇒ Object
The number of attachments the message has.
-
#campaign_class ⇒ Object
The campaign class of the message if it has one.
-
#campaign_id ⇒ Object
The campaign ID of the message if it has one.
-
#carrier_name ⇒ Object
The name of the carrier.
-
#destination_tn ⇒ Object
The recipient phone number of the message.
-
#error_code ⇒ Object
The numeric error code of the message.
-
#message_direction ⇒ Object
Returns the value of attribute message_direction.
-
#message_id ⇒ Object
The message id.
-
#message_length ⇒ Object
The length of the message content.
-
#message_size ⇒ Object
The size of the message including message content and headers.
-
#message_status ⇒ Object
Returns the value of attribute message_status.
-
#message_type ⇒ Object
Returns the value of attribute message_type.
-
#receive_time ⇒ Object
The ISO 8601 datetime of the message.
-
#recipient_count ⇒ Object
The number of recipients the message has.
-
#segment_count ⇒ Object
The number of segments the message was sent as.
-
#source_tn ⇒ Object
The source phone number of the message.
Class Method Summary collapse
-
._deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ ListMessageItem
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ ListMessageItem
Initializes the object
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 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 153 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 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 `Bandwidth::ListMessageItem`. 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?(:'message_id') self. = attributes[:'message_id'] end if attributes.key?(:'account_id') self.account_id = 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. = attributes[:'message_status'] end if attributes.key?(:'message_direction') self. = attributes[:'message_direction'] end if attributes.key?(:'message_type') self. = 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. = attributes[:'message_size'] end if attributes.key?(:'message_length') self. = attributes[:'message_length'] end if attributes.key?(:'attachment_count') self. = 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 end |
Instance Attribute Details
#account_id ⇒ Object
The account id associated with this message.
22 23 24 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 22 def account_id @account_id end |
#attachment_count ⇒ Object
The number of attachments the message has.
55 56 57 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 55 def @attachment_count end |
#campaign_class ⇒ Object
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_id ⇒ Object
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_name ⇒ Object
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_tn ⇒ Object
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_code ⇒ Object
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 |
#message_direction ⇒ Object
Returns the value of attribute message_direction.
32 33 34 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 32 def @message_direction end |
#message_id ⇒ Object
The message id
19 20 21 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 19 def @message_id end |
#message_length ⇒ Object
The length of the message content.
52 53 54 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 52 def @message_length end |
#message_size ⇒ Object
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 end |
#message_status ⇒ Object
Returns the value of attribute message_status.
30 31 32 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 30 def @message_status end |
#message_type ⇒ Object
Returns the value of attribute message_type.
34 35 36 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 34 def @message_type end |
#receive_time ⇒ Object
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_count ⇒ Object
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_count ⇒ Object
The number of segments the message was sent as.
37 38 39 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 37 def segment_count @segment_count end |
#source_tn ⇒ Object
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
._deserialize(type, value) ⇒ Object
Deserializes the data based on type
313 314 315 316 317 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 345 346 347 348 349 350 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 313 def self._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 = Bandwidth.const_get(type) klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) end end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
112 113 114 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 112 def self.acceptable_attributes attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 89 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' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 289 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
140 141 142 143 144 145 146 147 148 149 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 140 def self.openapi_nullable Set.new([ :'carrier_name', :'message_size', :'attachment_count', :'recipient_count', :'campaign_class', :'campaign_id' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 117 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' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 252 def ==(o) return true if self.equal?(o) self.class == o.class && == o. && account_id == o.account_id && source_tn == o.source_tn && destination_tn == o.destination_tn && == o. && == o. && == o. && segment_count == o.segment_count && error_code == o.error_code && receive_time == o.receive_time && carrier_name == o.carrier_name && == o. && == o. && == o. && recipient_count == o.recipient_count && campaign_class == o.campaign_class && campaign_id == o.campaign_id end |
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value
384 385 386 387 388 389 390 391 392 393 394 395 396 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 384 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 |
#eql?(o) ⇒ Boolean
276 277 278 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 276 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
282 283 284 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 282 def hash [, account_id, source_tn, destination_tn, , , , segment_count, error_code, receive_time, carrier_name, , , , recipient_count, campaign_class, campaign_id].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
237 238 239 240 241 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 237 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
360 361 362 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 360 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 366 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_s ⇒ String
Returns the string representation of the object
354 355 356 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 354 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
245 246 247 248 |
# File 'lib/bandwidth-sdk/models/list_message_item.rb', line 245 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' true end |