Class: Verizon::DeviceListQueryResult
- Defined in:
- lib/verizon/models/device_list_query_result.rb
Overview
List of devices.
Instance Attribute Summary collapse
-
#account_name ⇒ String
Account identifier in “##########-#####”.
-
#device_list ⇒ Array[DeviceListQueryItem]
The list of devices in the account.
-
#has_more_data ⇒ TrueClass | FalseClass
True if there are more devices to retrieve.
-
#last_seen_device_id ⇒ Integer
If hasMoreData=true, the startIndex to use for the next request.
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 = SKIP, has_more_data = SKIP, last_seen_device_id = SKIP, device_list = SKIP) ⇒ DeviceListQueryResult
constructor
A new instance of DeviceListQueryResult.
Methods inherited from BaseModel
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(account_name = SKIP, has_more_data = SKIP, last_seen_device_id = SKIP, device_list = SKIP) @account_name = account_name unless account_name == 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_name ⇒ String
Account identifier in “##########-#####”.
14 15 16 |
# File 'lib/verizon/models/device_list_query_result.rb', line 14 def account_name @account_name end |
#device_list ⇒ Array[DeviceListQueryItem]
The list of devices in the account.
27 28 29 |
# File 'lib/verizon/models/device_list_query_result.rb', line 27 def device_list @device_list end |
#has_more_data ⇒ TrueClass | FalseClass
True if there are more devices to retrieve.
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_id ⇒ Integer
If hasMoreData=true, the startIndex to use for the next request. 0 if hasMoreData=false.
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. account_name = 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(account_name, has_more_data, last_seen_device_id, device_list) end |
.names ⇒ Object
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 |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/verizon/models/device_list_query_result.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
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 |