Class: Verizon::Account
- Defined in:
- lib/verizon/models/account.rb
Overview
Returns information about a specified account.
Instance Attribute Summary collapse
-
#account_name ⇒ String
The name of the account.
-
#account_number ⇒ String
The billing number of the account.
-
#carriers ⇒ Array[String]
The names of all carriers for the account.
-
#features ⇒ Array[String]
The names of features that are enabled for the account.
-
#i_p_pools ⇒ Array[IPPool]
Array of IP pools that are available to the account.
-
#is_provisioning_allowed ⇒ TrueClass | FalseClass
True if devices can be added to the account and activated with a single request.
-
#organization_name ⇒ String
The name of the organization that the account is part of.
-
#service_plans ⇒ Array[ServicePlan]
Array of service plans that are available to the account.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(account_name = SKIP, account_number = SKIP, organization_name = SKIP, is_provisioning_allowed = SKIP, carriers = SKIP, features = SKIP, i_p_pools = SKIP, service_plans = SKIP) ⇒ Account
constructor
A new instance of Account.
Methods inherited from BaseModel
Constructor Details
#initialize(account_name = SKIP, account_number = SKIP, organization_name = SKIP, is_provisioning_allowed = SKIP, carriers = SKIP, features = SKIP, i_p_pools = SKIP, service_plans = SKIP) ⇒ Account
Returns a new instance of Account.
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/verizon/models/account.rb', line 79 def initialize(account_name = SKIP, account_number = SKIP, organization_name = SKIP, is_provisioning_allowed = SKIP, carriers = SKIP, features = SKIP, i_p_pools = SKIP, service_plans = SKIP) @account_name = account_name unless account_name == SKIP @account_number = account_number unless account_number == SKIP @organization_name = organization_name unless organization_name == SKIP @is_provisioning_allowed = is_provisioning_allowed unless is_provisioning_allowed == SKIP @carriers = carriers unless carriers == SKIP @features = features unless features == SKIP @i_p_pools = i_p_pools unless i_p_pools == SKIP @service_plans = service_plans unless service_plans == SKIP end |
Instance Attribute Details
#account_name ⇒ String
The name of the account.
14 15 16 |
# File 'lib/verizon/models/account.rb', line 14 def account_name @account_name end |
#account_number ⇒ String
The billing number of the account.
18 19 20 |
# File 'lib/verizon/models/account.rb', line 18 def account_number @account_number end |
#carriers ⇒ Array[String]
The names of all carriers for the account.
32 33 34 |
# File 'lib/verizon/models/account.rb', line 32 def carriers @carriers end |
#features ⇒ Array[String]
The names of features that are enabled for the account.
36 37 38 |
# File 'lib/verizon/models/account.rb', line 36 def features @features end |
#i_p_pools ⇒ Array[IPPool]
Array of IP pools that are available to the account.
40 41 42 |
# File 'lib/verizon/models/account.rb', line 40 def i_p_pools @i_p_pools end |
#is_provisioning_allowed ⇒ TrueClass | FalseClass
True if devices can be added to the account and activated with a single request. False if devices must be added to the account before they can be activated.
28 29 30 |
# File 'lib/verizon/models/account.rb', line 28 def is_provisioning_allowed @is_provisioning_allowed end |
#organization_name ⇒ String
The name of the organization that the account is part of.
22 23 24 |
# File 'lib/verizon/models/account.rb', line 22 def organization_name @organization_name end |
#service_plans ⇒ Array[ServicePlan]
Array of service plans that are available to the account.
44 45 46 |
# File 'lib/verizon/models/account.rb', line 44 def service_plans @service_plans end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 132 133 134 135 136 |
# File 'lib/verizon/models/account.rb', line 94 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_name = hash.key?('accountName') ? hash['accountName'] : SKIP account_number = hash.key?('accountNumber') ? hash['accountNumber'] : SKIP organization_name = hash.key?('organizationName') ? hash['organizationName'] : SKIP is_provisioning_allowed = hash.key?('isProvisioningAllowed') ? hash['isProvisioningAllowed'] : SKIP carriers = hash.key?('carriers') ? hash['carriers'] : SKIP features = hash.key?('features') ? hash['features'] : SKIP # Parameter is an array, so we need to iterate through it i_p_pools = nil unless hash['iPPools'].nil? i_p_pools = [] hash['iPPools'].each do |structure| i_p_pools << (IPPool.from_hash(structure) if structure) end end i_p_pools = SKIP unless hash.key?('iPPools') # Parameter is an array, so we need to iterate through it service_plans = nil unless hash['servicePlans'].nil? service_plans = [] hash['servicePlans'].each do |structure| service_plans << (ServicePlan.from_hash(structure) if structure) end end service_plans = SKIP unless hash.key?('servicePlans') # Create object from extracted values. Account.new(account_name, account_number, organization_name, is_provisioning_allowed, carriers, features, i_p_pools, service_plans) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/verizon/models/account.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['account_name'] = 'accountName' @_hash['account_number'] = 'accountNumber' @_hash['organization_name'] = 'organizationName' @_hash['is_provisioning_allowed'] = 'isProvisioningAllowed' @_hash['carriers'] = 'carriers' @_hash['features'] = 'features' @_hash['i_p_pools'] = 'iPPools' @_hash['service_plans'] = 'servicePlans' @_hash end |
.nullables ⇒ Object
An array for nullable fields
75 76 77 |
# File 'lib/verizon/models/account.rb', line 75 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/verizon/models/account.rb', line 61 def self.optionals %w[ account_name account_number organization_name is_provisioning_allowed carriers features i_p_pools service_plans ] end |