Class: Verizon::SecuritySubscription

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

Overview

Subscription of the device.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(extended_attributes = SKIP, license_assigned = SKIP, license_available = SKIP, license_purchased = SKIP, license_type = SKIP, sku_number = SKIP) ⇒ SecuritySubscription

Returns a new instance of SecuritySubscription.



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/verizon/models/security_subscription.rb', line 67

def initialize(extended_attributes = SKIP,
               license_assigned = SKIP,
               license_available = SKIP,
               license_purchased = SKIP,
               license_type = SKIP,
               sku_number = SKIP)
  @extended_attributes = extended_attributes unless extended_attributes == SKIP
  @license_assigned = license_assigned unless license_assigned == SKIP
  @license_available = license_available unless license_available == SKIP
  @license_purchased = license_purchased unless license_purchased == SKIP
  @license_type = license_type unless license_type == SKIP
  @sku_number = sku_number unless sku_number == SKIP
end

Instance Attribute Details

#extended_attributesArray[ExtendedAttributes]

Attributes of the subscription.

Returns:



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

def extended_attributes
  @extended_attributes
end

#license_assignedInteger

The total number of licenses for this license type that are assigned to device SIMs.

Returns:

  • (Integer)


19
20
21
# File 'lib/verizon/models/security_subscription.rb', line 19

def license_assigned
  @license_assigned
end

#license_availableInteger

The total number of licenses for this license type that are available to assign to device SIMs.

Returns:

  • (Integer)


24
25
26
# File 'lib/verizon/models/security_subscription.rb', line 24

def license_available
  @license_available
end

#license_purchasedInteger

The total number of licenses purchased for the license type.

Returns:

  • (Integer)


28
29
30
# File 'lib/verizon/models/security_subscription.rb', line 28

def license_purchased
  @license_purchased
end

#license_typeString

The license type associated with the skuNumber.

Returns:

  • (String)


32
33
34
# File 'lib/verizon/models/security_subscription.rb', line 32

def license_type
  @license_type
end

#sku_numberString

The skuNumber that identifies the license type.

Returns:

  • (String)


36
37
38
# File 'lib/verizon/models/security_subscription.rb', line 36

def sku_number
  @sku_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/verizon/models/security_subscription.rb', line 82

def self.from_hash(hash)
  return nil unless hash

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

  extended_attributes = SKIP unless hash.key?('extendedAttributes')
  license_assigned =
    hash.key?('licenseAssigned') ? hash['licenseAssigned'] : SKIP
  license_available =
    hash.key?('licenseAvailable') ? hash['licenseAvailable'] : SKIP
  license_purchased =
    hash.key?('licensePurchased') ? hash['licensePurchased'] : SKIP
  license_type = hash.key?('licenseType') ? hash['licenseType'] : SKIP
  sku_number = hash.key?('skuNumber') ? hash['skuNumber'] : SKIP

  # Create object from extracted values.
  SecuritySubscription.new(extended_attributes,
                           license_assigned,
                           license_available,
                           license_purchased,
                           license_type,
                           sku_number)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
46
47
48
# File 'lib/verizon/models/security_subscription.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['extended_attributes'] = 'extendedAttributes'
  @_hash['license_assigned'] = 'licenseAssigned'
  @_hash['license_available'] = 'licenseAvailable'
  @_hash['license_purchased'] = 'licensePurchased'
  @_hash['license_type'] = 'licenseType'
  @_hash['sku_number'] = 'skuNumber'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/verizon/models/security_subscription.rb', line 63

def self.nullables
  []
end

.optionalsObject

An array for optional fields



51
52
53
54
55
56
57
58
59
60
# File 'lib/verizon/models/security_subscription.rb', line 51

def self.optionals
  %w[
    extended_attributes
    license_assigned
    license_available
    license_purchased
    license_type
    sku_number
  ]
end