Class: Verizon::FotaV2Subscription

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

Overview

FOTA Subscription.

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: SKIP, purchase_type: SKIP, license_count: SKIP, license_used_count: SKIP, update_time: SKIP, additional_properties: nil) ⇒ FotaV2Subscription

Returns a new instance of FotaV2Subscription.



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

def initialize(account_name: SKIP, purchase_type: SKIP, license_count: SKIP,
               license_used_count: SKIP, update_time: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @account_name =  unless  == SKIP
  @purchase_type = purchase_type unless purchase_type == SKIP
  @license_count = license_count unless license_count == SKIP
  @license_used_count = license_used_count unless license_used_count == SKIP
  @update_time = update_time unless update_time == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_nameString

Account identifier in “##########-#####”.

Returns:

  • (String)


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

def 
  @account_name
end

#license_countInteger

Number of monthly licenses in an MRC subscription.

Returns:

  • (Integer)


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

def license_count
  @license_count
end

#license_used_countInteger

Number of licenses currently assigned to devices.

Returns:

  • (Integer)


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

def license_used_count
  @license_used_count
end

#purchase_typeString

Subscription models used by the account.

Returns:

  • (String)


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

def purchase_type
  @purchase_type
end

#update_timeString

The date and time of when the subscription was last updated.

Returns:

  • (String)


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

def update_time
  @update_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/verizon/models/fota_v2_subscription.rb', line 74

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : SKIP
  purchase_type = hash.key?('purchaseType') ? hash['purchaseType'] : SKIP
  license_count = hash.key?('licenseCount') ? hash['licenseCount'] : SKIP
  license_used_count =
    hash.key?('licenseUsedCount') ? hash['licenseUsedCount'] : SKIP
  update_time = hash.key?('updateTime') ? hash['updateTime'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  FotaV2Subscription.new(account_name: ,
                         purchase_type: purchase_type,
                         license_count: license_count,
                         license_used_count: license_used_count,
                         update_time: update_time,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/verizon/models/fota_v2_subscription.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['purchase_type'] = 'purchaseType'
  @_hash['license_count'] = 'licenseCount'
  @_hash['license_used_count'] = 'licenseUsedCount'
  @_hash['update_time'] = 'updateTime'
  @_hash
end

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/verizon/models/fota_v2_subscription.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
52
# File 'lib/verizon/models/fota_v2_subscription.rb', line 44

def self.optionals
  %w[
    account_name
    purchase_type
    license_count
    license_used_count
    update_time
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



110
111
112
113
114
115
116
# File 'lib/verizon/models/fota_v2_subscription.rb', line 110

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name.inspect}, purchase_type:"\
  " #{@purchase_type.inspect}, license_count: #{@license_count.inspect}, license_used_count:"\
  " #{@license_used_count.inspect}, update_time: #{@update_time.inspect},"\
  " additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



102
103
104
105
106
107
# File 'lib/verizon/models/fota_v2_subscription.rb', line 102

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} account_name: #{@account_name}, purchase_type: #{@purchase_type},"\
  " license_count: #{@license_count}, license_used_count: #{@license_used_count}, update_time:"\
  " #{@update_time}, additional_properties: #{@additional_properties}>"
end