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, additional_properties: nil) ⇒ DeviceListQueryResult
constructor
A new instance of DeviceListQueryResult.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(account_name: SKIP, has_more_data: SKIP, last_seen_device_id: SKIP, device_list: SKIP, additional_properties: nil) ⇒ DeviceListQueryResult
Returns a new instance of DeviceListQueryResult.
54 55 56 57 58 59 60 61 62 63 64 65 |
# 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, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @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 @additional_properties = additional_properties 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.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/verizon/models/device_list_query_result.rb', line 68 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 a new hash for additional properties, removing known properties. new_hash = hash.reject { |k, _| names.value?(k) } additional_properties = APIHelper.get_additional_properties( new_hash, proc { |value| value } ) # Create object from extracted values. DeviceListQueryResult.new(account_name: account_name, has_more_data: has_more_data, last_seen_device_id: last_seen_device_id, device_list: device_list, additional_properties: additional_properties) 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 |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
111 112 113 114 115 116 |
# File 'lib/verizon/models/device_list_query_result.rb', line 111 def inspect class_name = self.class.name.split('::').last "<#{class_name} account_name: #{@account_name.inspect}, has_more_data:"\ " #{@has_more_data.inspect}, last_seen_device_id: #{@last_seen_device_id.inspect},"\ " device_list: #{@device_list.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
103 104 105 106 107 108 |
# File 'lib/verizon/models/device_list_query_result.rb', line 103 def to_s class_name = self.class.name.split('::').last "<#{class_name} account_name: #{@account_name}, has_more_data: #{@has_more_data},"\ " last_seen_device_id: #{@last_seen_device_id}, device_list: #{@device_list},"\ " additional_properties: #{@additional_properties}>" end |