Class: Verizon::ProfileRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/profile_request.rb

Overview

ProfileRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(account_name:, devices:, carrier_name: SKIP, service_plan: SKIP, mdn_zip_code: SKIP, primary_place_of_use: SKIP, smsr_oid: SKIP, carrier_ip_pool_name: SKIP) ⇒ ProfileRequest

Returns a new instance of ProfileRequest.



75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/verizon/models/profile_request.rb', line 75

def initialize(account_name:, devices:, carrier_name: SKIP,
               service_plan: SKIP, mdn_zip_code: SKIP,
               primary_place_of_use: SKIP, smsr_oid: SKIP,
               carrier_ip_pool_name: SKIP)
  @account_name = 
  @devices = devices
  @carrier_name = carrier_name unless carrier_name == SKIP
  @service_plan = service_plan unless service_plan == SKIP
  @mdn_zip_code = mdn_zip_code unless mdn_zip_code == SKIP
  @primary_place_of_use = primary_place_of_use unless primary_place_of_use == SKIP
  @smsr_oid = smsr_oid unless smsr_oid == SKIP
  @carrier_ip_pool_name = carrier_ip_pool_name unless carrier_ip_pool_name == SKIP
end

Instance Attribute Details

#account_nameString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/verizon/models/profile_request.rb', line 14

def 
  @account_name
end

#carrier_ip_pool_nameString

The name of the pool of IP addresses assigned to the profile.

Returns:

  • (String)


42
43
44
# File 'lib/verizon/models/profile_request.rb', line 42

def carrier_ip_pool_name
  @carrier_ip_pool_name
end

#carrier_nameString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/verizon/models/profile_request.rb', line 22

def carrier_name
  @carrier_name
end

#devicesArray[DeviceList]

TODO: Write general description for this method

Returns:



18
19
20
# File 'lib/verizon/models/profile_request.rb', line 18

def devices
  @devices
end

#mdn_zip_codeString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/verizon/models/profile_request.rb', line 30

def mdn_zip_code
  @mdn_zip_code
end

#primary_place_of_useArray[Object]

TODO: Write general description for this method

Returns:

  • (Array[Object])


34
35
36
# File 'lib/verizon/models/profile_request.rb', line 34

def primary_place_of_use
  @primary_place_of_use
end

#service_planString

TODO: Write general description for this method

Returns:

  • (String)


26
27
28
# File 'lib/verizon/models/profile_request.rb', line 26

def service_plan
  @service_plan
end

#smsr_oidString

TODO: Write general description for this method

Returns:

  • (String)


38
39
40
# File 'lib/verizon/models/profile_request.rb', line 38

def smsr_oid
  @smsr_oid
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/verizon/models/profile_request.rb', line 90

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : nil
  # Parameter is an array, so we need to iterate through it
  devices = nil
  unless hash['devices'].nil?
    devices = []
    hash['devices'].each do |structure|
      devices << (DeviceList.from_hash(structure) if structure)
    end
  end

  devices = nil unless hash.key?('devices')
  carrier_name = hash.key?('carrierName') ? hash['carrierName'] : SKIP
  service_plan = hash.key?('servicePlan') ? hash['servicePlan'] : SKIP
  mdn_zip_code = hash.key?('mdnZipCode') ? hash['mdnZipCode'] : SKIP
  primary_place_of_use = hash.key?('primaryPlaceOfUse') ? APIHelper.deserialize_union_type(
    UnionTypeLookUp.get(:ProfileRequestPrimaryPlaceOfUse), hash['primaryPlaceOfUse']
  ) : SKIP
  smsr_oid = hash.key?('smsrOid') ? hash['smsrOid'] : SKIP
  carrier_ip_pool_name =
    hash.key?('carrierIpPoolName') ? hash['carrierIpPoolName'] : SKIP

  # Create object from extracted values.
  ProfileRequest.new(account_name: ,
                     devices: devices,
                     carrier_name: carrier_name,
                     service_plan: service_plan,
                     mdn_zip_code: mdn_zip_code,
                     primary_place_of_use: primary_place_of_use,
                     smsr_oid: smsr_oid,
                     carrier_ip_pool_name: carrier_ip_pool_name)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/verizon/models/profile_request.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['devices'] = 'devices'
  @_hash['carrier_name'] = 'carrierName'
  @_hash['service_plan'] = 'servicePlan'
  @_hash['mdn_zip_code'] = 'mdnZipCode'
  @_hash['primary_place_of_use'] = 'primaryPlaceOfUse'
  @_hash['smsr_oid'] = 'smsrOid'
  @_hash['carrier_ip_pool_name'] = 'carrierIpPoolName'
  @_hash
end

.nullablesObject

An array for nullable fields



71
72
73
# File 'lib/verizon/models/profile_request.rb', line 71

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
68
# File 'lib/verizon/models/profile_request.rb', line 59

def self.optionals
  %w[
    carrier_name
    service_plan
    mdn_zip_code
    primary_place_of_use
    smsr_oid
    carrier_ip_pool_name
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (ProfileRequest | Hash)

    value against the validation is performed.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/verizon/models/profile_request.rb', line 128

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.devices,
                              ->(val) { DeviceList.validate(val) },
                              is_model_hash: true,
                              is_inner_model_hash: true)
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['accountName'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['devices'],
                            ->(val) { DeviceList.validate(val) },
                            is_model_hash: true,
                            is_inner_model_hash: true)
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



162
163
164
165
166
167
168
169
# File 'lib/verizon/models/profile_request.rb', line 162

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name.inspect}, devices: #{@devices.inspect},"\
  " carrier_name: #{@carrier_name.inspect}, service_plan: #{@service_plan.inspect},"\
  " mdn_zip_code: #{@mdn_zip_code.inspect}, primary_place_of_use:"\
  " #{@primary_place_of_use.inspect}, smsr_oid: #{@smsr_oid.inspect}, carrier_ip_pool_name:"\
  " #{@carrier_ip_pool_name.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



153
154
155
156
157
158
159
# File 'lib/verizon/models/profile_request.rb', line 153

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name}, devices: #{@devices}, carrier_name:"\
  " #{@carrier_name}, service_plan: #{@service_plan}, mdn_zip_code: #{@mdn_zip_code},"\
  " primary_place_of_use: #{@primary_place_of_use}, smsr_oid: #{@smsr_oid},"\
  " carrier_ip_pool_name: #{@carrier_ip_pool_name}>"
end