Class: Zernio::CreatePhoneNumberPortInRequest

Inherits:
ApiModelBase
  • Object
show all
Defined in:
lib/zernio-sdk/models/create_phone_number_port_in_request.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 = {}) ⇒ CreatePhoneNumberPortInRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



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
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
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 108

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

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

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

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

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

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

  if attributes.key?(:'port_type')
    self.port_type = attributes[:'port_type']
  else
    self.port_type = 'full'
  end

  if attributes.key?(:'requirements')
    if (value = attributes[:'requirements']).is_a?(Array)
      self.requirements = value
    end
  end
end

Instance Attribute Details

#customer_referenceObject

Returns the value of attribute customer_reference.



32
33
34
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 32

def customer_reference
  @customer_reference
end

#end_userObject

Returns the value of attribute end_user.



21
22
23
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 21

def end_user
  @end_user
end

#foc_datetime_requestedObject

Requested port date; the carrier confirms the actual FOC later. US/CA default is one week out (shifted off weekends); international orders are scheduled into the carrier's next allowed porting window at or after this date.



30
31
32
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 30

def foc_datetime_requested
  @foc_datetime_requested
end

#invoice_document_idObject

Document id from POST /v1/phone-numbers/port-in/documents (kind=invoice).



27
28
29
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 27

def invoice_document_id
  @invoice_document_id
end

#loa_document_idObject

Document id from POST /v1/phone-numbers/port-in/documents (kind=loa).



24
25
26
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 24

def loa_document_id
  @loa_document_id
end

#phone_numbersObject

E.164 numbers to port in.



19
20
21
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 19

def phone_numbers
  @phone_numbers
end

#port_typeObject

Whether the losing account ports all its numbers (full) or keeps some (partial).



35
36
37
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 35

def port_type
  @port_type
end

#requirementsObject

Country-specific requirement values for international ports (from GET /v1/phone-numbers/port-in/requirements). Not needed for US/CA. The LOA and invoice requirements are satisfied automatically by loaDocumentId/invoiceDocumentId, and address-type requirements by the endUser service address.



38
39
40
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 38

def requirements
  @requirements
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



77
78
79
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 77

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



82
83
84
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 82

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 63

def self.attribute_map
  {
    :'phone_numbers' => :'phoneNumbers',
    :'end_user' => :'endUser',
    :'loa_document_id' => :'loaDocumentId',
    :'invoice_document_id' => :'invoiceDocumentId',
    :'foc_datetime_requested' => :'focDatetimeRequested',
    :'customer_reference' => :'customerReference',
    :'port_type' => :'portType',
    :'requirements' => :'requirements'
  }
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



342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 342

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



101
102
103
104
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 101

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

.openapi_typesObject

Attribute type mapping.



87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 87

def self.openapi_types
  {
    :'phone_numbers' => :'Array<String>',
    :'end_user' => :'CreatePhoneNumberPortInRequestEndUser',
    :'loa_document_id' => :'String',
    :'invoice_document_id' => :'String',
    :'foc_datetime_requested' => :'Time',
    :'customer_reference' => :'String',
    :'port_type' => :'String',
    :'requirements' => :'Array<CreatePhoneNumberPortInRequestRequirementsInner>'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



314
315
316
317
318
319
320
321
322
323
324
325
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 314

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      phone_numbers == o.phone_numbers &&
      end_user == o.end_user &&
      loa_document_id == o.loa_document_id &&
      invoice_document_id == o.invoice_document_id &&
      foc_datetime_requested == o.foc_datetime_requested &&
      customer_reference == o.customer_reference &&
      port_type == o.port_type &&
      requirements == o.requirements
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


329
330
331
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 329

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



335
336
337
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 335

def hash
  [phone_numbers, end_user, loa_document_id, invoice_document_id, foc_datetime_requested, customer_reference, port_type, requirements].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 171

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

  if @phone_numbers.length > 50
    invalid_properties.push('invalid value for "phone_numbers", number of items must be less than or equal to 50.')
  end

  if @phone_numbers.length < 1
    invalid_properties.push('invalid value for "phone_numbers", number of items must be greater than or equal to 1.')
  end

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

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

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

  if !@customer_reference.nil? && @customer_reference.to_s.length > 100
    invalid_properties.push('invalid value for "customer_reference", the character length must be smaller than or equal to 100.')
  end

  if !@requirements.nil? && @requirements.length > 30
    invalid_properties.push('invalid value for "requirements", number of items must be less than or equal to 30.')
  end

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 364

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



211
212
213
214
215
216
217
218
219
220
221
222
223
224
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 211

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @phone_numbers.nil?
  return false if @phone_numbers.length > 50
  return false if @phone_numbers.length < 1
  return false if @end_user.nil?
  return false if @loa_document_id.nil?
  return false if @invoice_document_id.nil?
  return false if !@customer_reference.nil? && @customer_reference.to_s.length > 100
  port_type_validator = EnumAttributeValidator.new('String', ["full", "partial"])
  return false unless port_type_validator.valid?(@port_type)
  return false if !@requirements.nil? && @requirements.length > 30
  true
end