Class: Verizon::V2LicenseSummary
- Defined in:
- lib/verizon/models/v2_license_summary.rb
Overview
Summary of license assignment.
Instance Attribute Summary collapse
-
#account_name ⇒ String
Account identifier.
-
#assigned_licenses ⇒ Integer
Assigned FOTA license count.
-
#device_list ⇒ Array[V2LicenseDevice]
Device IMEI list.
-
#has_more_data ⇒ TrueClass | FalseClass
True if there are more devices to retrieve.
-
#last_seen_device_id ⇒ String
Last seen device identifier.
-
#max_page_size ⇒ Integer
Maximum page size.
-
#total_license ⇒ Integer
Total FOTA license count.
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 = nil, assigned_licenses = nil, has_more_data = nil, max_page_size = nil, total_license = SKIP, last_seen_device_id = SKIP, device_list = SKIP) ⇒ V2LicenseSummary
constructor
A new instance of V2LicenseSummary.
Methods inherited from BaseModel
Constructor Details
#initialize(account_name = nil, assigned_licenses = nil, has_more_data = nil, max_page_size = nil, total_license = SKIP, last_seen_device_id = SKIP, device_list = SKIP) ⇒ V2LicenseSummary
Returns a new instance of V2LicenseSummary.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/verizon/models/v2_license_summary.rb', line 67 def initialize(account_name = nil, assigned_licenses = nil, has_more_data = nil, max_page_size = nil, total_license = SKIP, last_seen_device_id = SKIP, device_list = SKIP) @account_name = account_name @total_license = total_license unless total_license == SKIP @assigned_licenses = assigned_licenses @has_more_data = has_more_data @last_seen_device_id = last_seen_device_id unless last_seen_device_id == SKIP @max_page_size = max_page_size @device_list = device_list unless device_list == SKIP end |
Instance Attribute Details
#account_name ⇒ String
Account identifier.
14 15 16 |
# File 'lib/verizon/models/v2_license_summary.rb', line 14 def account_name @account_name end |
#assigned_licenses ⇒ Integer
Assigned FOTA license count.
22 23 24 |
# File 'lib/verizon/models/v2_license_summary.rb', line 22 def assigned_licenses @assigned_licenses end |
#device_list ⇒ Array[V2LicenseDevice]
Device IMEI list.
38 39 40 |
# File 'lib/verizon/models/v2_license_summary.rb', line 38 def device_list @device_list end |
#has_more_data ⇒ TrueClass | FalseClass
True if there are more devices to retrieve.
26 27 28 |
# File 'lib/verizon/models/v2_license_summary.rb', line 26 def has_more_data @has_more_data end |
#last_seen_device_id ⇒ String
Last seen device identifier.
30 31 32 |
# File 'lib/verizon/models/v2_license_summary.rb', line 30 def last_seen_device_id @last_seen_device_id end |
#max_page_size ⇒ Integer
Maximum page size.
34 35 36 |
# File 'lib/verizon/models/v2_license_summary.rb', line 34 def max_page_size @max_page_size end |
#total_license ⇒ Integer
Total FOTA license count.
18 19 20 |
# File 'lib/verizon/models/v2_license_summary.rb', line 18 def total_license @total_license end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 113 114 115 |
# File 'lib/verizon/models/v2_license_summary.rb', line 84 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_name = hash.key?('accountName') ? hash['accountName'] : nil assigned_licenses = hash.key?('assignedLicenses') ? hash['assignedLicenses'] : nil has_more_data = hash.key?('hasMoreData') ? hash['hasMoreData'] : nil max_page_size = hash.key?('maxPageSize') ? hash['maxPageSize'] : nil total_license = hash.key?('totalLicense') ? hash['totalLicense'] : SKIP last_seen_device_id = hash.key?('lastSeenDeviceId') ? hash['lastSeenDeviceId'] : SKIP # Parameter is an array, so we need to iterate through it device_list = nil unless hash['deviceList'].nil? device_list = [] hash['deviceList'].each do |structure| device_list << (V2LicenseDevice.from_hash(structure) if structure) end end device_list = SKIP unless hash.key?('deviceList') # Create object from extracted values. V2LicenseSummary.new(account_name, assigned_licenses, has_more_data, max_page_size, total_license, last_seen_device_id, device_list) end |
.names ⇒ Object
A mapping from model property names to API property names.
41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/verizon/models/v2_license_summary.rb', line 41 def self.names @_hash = {} if @_hash.nil? @_hash['account_name'] = 'accountName' @_hash['total_license'] = 'totalLicense' @_hash['assigned_licenses'] = 'assignedLicenses' @_hash['has_more_data'] = 'hasMoreData' @_hash['last_seen_device_id'] = 'lastSeenDeviceId' @_hash['max_page_size'] = 'maxPageSize' @_hash['device_list'] = 'deviceList' @_hash end |
.nullables ⇒ Object
An array for nullable fields
63 64 65 |
# File 'lib/verizon/models/v2_license_summary.rb', line 63 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 |
# File 'lib/verizon/models/v2_license_summary.rb', line 54 def self.optionals %w[ total_license last_seen_device_id device_list ] end |