Class: Verizon::DeviceListQueryResult

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

Overview

List of devices.

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

Returns a new instance of DeviceListQueryResult.



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

def initialize( = SKIP,
               has_more_data = SKIP,
               last_seen_device_id = SKIP,
               device_list = SKIP)
  @account_name =  unless  == 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/device_list_query_result.rb', line 14

def 
  @account_name
end

#device_listArray[DeviceListQueryItem]

The list of devices in the account.

Returns:



27
28
29
# File 'lib/verizon/models/device_list_query_result.rb', line 27

def device_list
  @device_list
end

#has_more_dataTrueClass | FalseClass

True if there are more devices to retrieve.

Returns:

  • (TrueClass | FalseClass)


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

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)


23
24
25
# File 'lib/verizon/models/device_list_query_result.rb', line 23

def last_seen_device_id
  @last_seen_device_id
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
# File 'lib/verizon/models/device_list_query_result.rb', line 65

def self.from_hash(hash)
  return nil unless hash

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

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

  # Create object from extracted values.
  DeviceListQueryResult.new(,
                            has_more_data,
                            last_seen_device_id,
                            device_list)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/verizon/models/device_list_query_result.rb', line 30

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

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/verizon/models/device_list_query_result.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

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