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

#to_hash, #to_json

Constructor Details

#initialize(account_name = nil, devices = nil, 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( = nil, devices = nil, 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[PrimaryPlaceOfUse]

TODO: Write general description for this method

Returns:



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
125
126
127
128
129
130
131
# 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
  # Parameter is an array, so we need to iterate through it
  primary_place_of_use = nil
  unless hash['primaryPlaceOfUse'].nil?
    primary_place_of_use = []
    hash['primaryPlaceOfUse'].each do |structure|
      primary_place_of_use << (PrimaryPlaceOfUse.from_hash(structure) if structure)
    end
  end

  primary_place_of_use = SKIP unless hash.key?('primaryPlaceOfUse')
  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(,
                     devices,
                     carrier_name,
                     service_plan,
                     mdn_zip_code,
                     primary_place_of_use,
                     smsr_oid,
                     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