Class: Verizon::V2AccountDeviceList

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

Overview

List of device information for an account.

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 = nil, has_more_data = nil, max_page_size = nil, device_list = nil, last_seen_device_id = SKIP) ⇒ V2AccountDeviceList

Returns a new instance of V2AccountDeviceList.



55
56
57
58
59
60
61
62
# File 'lib/verizon/models/v2_account_device_list.rb', line 55

def initialize( = nil, has_more_data = nil, max_page_size = nil,
               device_list = nil, last_seen_device_id = SKIP)
  @account_name = 
  @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
end

Instance Attribute Details

#account_nameString

Account name.

Returns:

  • (String)


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

def 
  @account_name
end

#device_listArray[V2AccountDevice]

Account device list.

Returns:



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

def device_list
  @device_list
end

#has_more_dataTrueClass | FalseClass

Has more device flag?

Returns:

  • (TrueClass | FalseClass)


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

def has_more_data
  @has_more_data
end

#last_seen_device_idString

Last seen device identifier.

Returns:

  • (String)


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

def last_seen_device_id
  @last_seen_device_id
end

#max_page_sizeInteger

Maximum page size.

Returns:

  • (Integer)


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

def max_page_size
  @max_page_size
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/verizon/models/v2_account_device_list.rb', line 65

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
   = hash.key?('accountName') ? hash['accountName'] : nil
  has_more_data = hash.key?('hasMoreData') ? hash['hasMoreData'] : nil
  max_page_size = hash.key?('maxPageSize') ? hash['maxPageSize'] : nil
  # 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 << (V2AccountDevice.from_hash(structure) if structure)
    end
  end

  device_list = nil unless hash.key?('deviceList')
  last_seen_device_id =
    hash.key?('lastSeenDeviceId') ? hash['lastSeenDeviceId'] : SKIP

  # Create object from extracted values.
  V2AccountDeviceList.new(,
                          has_more_data,
                          max_page_size,
                          device_list,
                          last_seen_device_id)
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/v2_account_device_list.rb', line 33

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

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/verizon/models/v2_account_device_list.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
# File 'lib/verizon/models/v2_account_device_list.rb', line 44

def self.optionals
  %w[
    last_seen_device_id
  ]
end