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



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
188
189
190
191
192
193
194
195
196
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 125

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

  if attributes.key?(:'bound_agent_id')
    self.bound_agent_id = attributes[:'bound_agent_id']
  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

#bound_agent_idObject

Voice agent id bound for inbound AI voice, if any



49
50
51
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 49

def bound_agent_id
  @bound_agent_id
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



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

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



96
97
98
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 96

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 74

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',
    :'bound_agent_id' => :'boundAgentId'
  }
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



365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 365

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



118
119
120
121
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 118

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

.openapi_typesObject

Attribute type mapping.



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 101

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',
    :'bound_agent_id' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 334

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 &&
      bound_agent_id == o.bound_agent_id
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


352
353
354
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 352

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



358
359
360
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 358

def hash
  [phone_number, label, created_at, country_code, number_type, billing_status, next_billing_date, monthly_price, a2p_status, released_at, bound_agent_id].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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



387
388
389
390
391
392
393
394
395
396
397
398
399
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 387

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



236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/pingram/models/list_phone_numbers_response_numbers_inner.rb', line 236

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