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



103
104
105
106
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 103

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
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. Defaults to one week out (shifted off weekends) when omitted.



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

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



73
74
75
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 73

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 60

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'
  }
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



311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 311

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



96
97
98
99
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 96

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

.openapi_typesObject

Attribute type mapping.



83
84
85
86
87
88
89
90
91
92
93
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 83

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'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



284
285
286
287
288
289
290
291
292
293
294
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 284

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
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


298
299
300
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 298

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



304
305
306
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 304

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

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



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

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

  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



333
334
335
336
337
338
339
340
341
342
343
344
345
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 333

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



196
197
198
199
200
201
202
203
204
205
206
207
208
# File 'lib/zernio-sdk/models/create_phone_number_port_in_request.rb', line 196

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)
  true
end