Class: Verizon::AccountLicenseInfo

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

Overview

Account license information.

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 = SKIP, total_licenses = SKIP, assigned_licenses = SKIP, has_more_data = SKIP, last_seen_device_id = SKIP, device_list = SKIP) ⇒ AccountLicenseInfo

Returns a new instance of AccountLicenseInfo.



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

def initialize( = SKIP, total_licenses = SKIP,
               assigned_licenses = SKIP, has_more_data = SKIP,
               last_seen_device_id = SKIP, device_list = SKIP)
  @account_name =  unless  == SKIP
  @total_licenses = total_licenses unless total_licenses == SKIP
  @assigned_licenses = assigned_licenses unless assigned_licenses == SKIP
  @has_more_data = has_more_data unless has_more_data == SKIP
  @last_seen_device_id = last_seen_device_id unless last_seen_device_id == SKIP
  @device_list = device_list unless device_list == SKIP
end

Instance Attribute Details

#account_nameString

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

Returns:

  • (String)


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

def 
  @account_name
end

#assigned_licensesInteger

Number of licenses currently assigned to devices.

Returns:

  • (Integer)


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

def assigned_licenses
  @assigned_licenses
end

#device_listArray[AccountLicenseDeviceListItem]

The list of devices that have licenses assigned, including the date and time of when each license was assigned.

Returns:



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

def device_list
  @device_list
end

#has_more_dataTrueClass | FalseClass

True if there are more devices to retrieve.

Returns:

  • (TrueClass | FalseClass)


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

def has_more_data
  @has_more_data
end

#last_seen_device_idInteger

If hasMoreData=true, the startIndex to use for the next request. 0 if hasMoreData=false.

Returns:

  • (Integer)


31
32
33
# File 'lib/verizon/models/account_license_info.rb', line 31

def last_seen_device_id
  @last_seen_device_id
end

#total_licensesInteger

Number of monthly licenses in an MRC subscription.

Returns:

  • (Integer)


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

def total_licenses
  @total_licenses
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
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
# File 'lib/verizon/models/account_license_info.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : SKIP
  total_licenses = hash.key?('totalLicenses') ? hash['totalLicenses'] : SKIP
  assigned_licenses =
    hash.key?('assignedLicenses') ? hash['assignedLicenses'] : SKIP
  has_more_data = hash.key?('hasMoreData') ? hash['hasMoreData'] : 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 << (AccountLicenseDeviceListItem.from_hash(structure) if structure)
    end
  end

  device_list = SKIP unless hash.key?('deviceList')

  # Create object from extracted values.
  AccountLicenseInfo.new(,
                         total_licenses,
                         assigned_licenses,
                         has_more_data,
                         last_seen_device_id,
                         device_list)
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/account_license_info.rb', line 39

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['account_name'] = 'accountName'
  @_hash['total_licenses'] = 'totalLicenses'
  @_hash['assigned_licenses'] = 'assignedLicenses'
  @_hash['has_more_data'] = 'hasMoreData'
  @_hash['last_seen_device_id'] = 'lastSeenDeviceId'
  @_hash['device_list'] = 'deviceList'
  @_hash
end

.nullablesObject

An array for nullable fields



63
64
65
# File 'lib/verizon/models/account_license_info.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/account_license_info.rb', line 51

def self.optionals
  %w[
    account_name
    total_licenses
    assigned_licenses
    has_more_data
    last_seen_device_id
    device_list
  ]
end