Class: Pingram::ListPhoneNumbersResponseNumbersInner

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

Overview

Represents a phone number in the account

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 120

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#a2p_statusObject

US 10DLC readiness derived from stored campaign assignment



43
44
45
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 43

def a2p_status
  @a2p_status
end

#billing_statusObject

active or released



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

def billing_status
  @billing_status
end

#country_codeObject

ISO 3166-1 alpha-2 country code



28
29
30
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 28

def country_code
  @country_code
end

#created_atObject

ISO timestamp when the number was registered



25
26
27
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 25

def created_at
  @created_at
end

#labelObject

Returns the value of attribute label.



22
23
24
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 22

def label
  @label
end

#monthly_priceObject

Monthly cost in USD



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

def monthly_price
  @monthly_price
end

#next_billing_dateObject

YYYY-MM-DD next monthly rent charge



37
38
39
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 37

def next_billing_date
  @next_billing_date
end

#number_typeObject

e.g. local, toll_free



31
32
33
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 31

def number_type
  @number_type
end

#phone_numberObject

E.164



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

def phone_number
  @phone_number
end

#released_atObject

ISO timestamp when the number was released (released numbers only)



46
47
48
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 46

def released_at
  @released_at
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



87
88
89
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 87

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



92
93
94
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 92

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 71

def self.attribute_map
  {
    :'phone_number' => :'phoneNumber',
    :'label' => :'label',
    :'created_at' => :'createdAt',
    :'country_code' => :'countryCode',
    :'number_type' => :'numberType',
    :'billing_status' => :'billingStatus',
    :'next_billing_date' => :'nextBillingDate',
    :'monthly_price' => :'monthlyPrice',
    :'a2p_status' => :'a2pStatus',
    :'released_at' => :'releasedAt'
  }
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



355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 355

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



113
114
115
116
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 113

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

.openapi_typesObject

Attribute type mapping.



97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 97

def self.openapi_types
  {
    :'phone_number' => :'String',
    :'label' => :'String',
    :'created_at' => :'String',
    :'country_code' => :'String',
    :'number_type' => :'String',
    :'billing_status' => :'String',
    :'next_billing_date' => :'String',
    :'monthly_price' => :'Float',
    :'a2p_status' => :'String',
    :'released_at' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



325
326
327
328
329
330
331
332
333
334
335
336
337
338
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 325

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      phone_number == o.phone_number &&
      label == o.label &&
      created_at == o.created_at &&
      country_code == o.country_code &&
      number_type == o.number_type &&
      billing_status == o.billing_status &&
      next_billing_date == o.next_billing_date &&
      monthly_price == o.monthly_price &&
      a2p_status == o.a2p_status &&
      released_at == o.released_at
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


342
343
344
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 342

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



348
349
350
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 348

def hash
  [phone_number, label, created_at, country_code, number_type, billing_status, next_billing_date, monthly_price, a2p_status, released_at].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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 191

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

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

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

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

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

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

  if @monthly_price.nil?
    invalid_properties.push('invalid value for "monthly_price", monthly_price 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



377
378
379
380
381
382
383
384
385
386
387
388
389
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 377

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



227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 227

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @phone_number.nil?
  return false if @created_at.nil?
  return false if @country_code.nil?
  return false if @number_type.nil?
  return false if @billing_status.nil?
  billing_status_validator = EnumAttributeValidator.new('String', ["active", "released"])
  return false unless billing_status_validator.valid?(@billing_status)
  return false if @next_billing_date.nil?
  return false if @monthly_price.nil?
  a2p_status_validator = EnumAttributeValidator.new('String', ["pending", "testing", "approved"])
  return false unless a2p_status_validator.valid?(@a2p_status)
  true
end