Class: Verizon::LocationRequest
- Defined in:
- lib/verizon/models/location_request.rb
Overview
The body contains the the account name and list of devices that you want to locate, plus other options.
Instance Attribute Summary collapse
-
#account_name ⇒ String
Account identifier in “##########-#####”.
-
#accuracy_mode ⇒ AccuracyMode
Accurary, currently only 0-coarse supported.
-
#cache_mode ⇒ CacheMode
Location cache mode.
-
#device_list ⇒ Array[DeviceInfo]
Device list.
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:, device_list:, accuracy_mode: SKIP, cache_mode: SKIP, additional_properties: nil) ⇒ LocationRequest
constructor
A new instance of LocationRequest.
-
#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:, device_list:, accuracy_mode: SKIP, cache_mode: SKIP, additional_properties: nil) ⇒ LocationRequest
Returns a new instance of LocationRequest.
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/verizon/models/location_request.rb', line 52 def initialize(account_name:, device_list:, accuracy_mode: SKIP, cache_mode: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @account_name = account_name @device_list = device_list @accuracy_mode = accuracy_mode unless accuracy_mode == SKIP @cache_mode = cache_mode unless cache_mode == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#account_name ⇒ String
Account identifier in “##########-#####”.
15 16 17 |
# File 'lib/verizon/models/location_request.rb', line 15 def account_name @account_name end |
#accuracy_mode ⇒ AccuracyMode
Accurary, currently only 0-coarse supported.
23 24 25 |
# File 'lib/verizon/models/location_request.rb', line 23 def accuracy_mode @accuracy_mode end |
#cache_mode ⇒ CacheMode
Location cache mode.
27 28 29 |
# File 'lib/verizon/models/location_request.rb', line 27 def cache_mode @cache_mode end |
#device_list ⇒ Array[DeviceInfo]
Device list.
19 20 21 |
# File 'lib/verizon/models/location_request.rb', line 19 def device_list @device_list 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 92 93 94 95 96 |
# File 'lib/verizon/models/location_request.rb', line 65 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. account_name = hash.key?('accountName') ? hash['accountName'] : 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 << (DeviceInfo.from_hash(structure) if structure) end end device_list = nil unless hash.key?('deviceList') accuracy_mode = hash.key?('accuracyMode') ? hash['accuracyMode'] : SKIP cache_mode = hash.key?('cacheMode') ? hash['cacheMode'] : SKIP # 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. LocationRequest.new(account_name: account_name, device_list: device_list, accuracy_mode: accuracy_mode, cache_mode: cache_mode, 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/location_request.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['account_name'] = 'accountName' @_hash['device_list'] = 'deviceList' @_hash['accuracy_mode'] = 'accuracyMode' @_hash['cache_mode'] = 'cacheMode' @_hash end |
.nullables ⇒ Object
An array for nullable fields
48 49 50 |
# File 'lib/verizon/models/location_request.rb', line 48 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 |
# File 'lib/verizon/models/location_request.rb', line 40 def self.optionals %w[ accuracy_mode cache_mode ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
107 108 109 110 111 112 |
# File 'lib/verizon/models/location_request.rb', line 107 def inspect class_name = self.class.name.split('::').last "<#{class_name} account_name: #{@account_name.inspect}, device_list:"\ " #{@device_list.inspect}, accuracy_mode: #{@accuracy_mode.inspect}, cache_mode:"\ " #{@cache_mode.inspect}, additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
99 100 101 102 103 104 |
# File 'lib/verizon/models/location_request.rb', line 99 def to_s class_name = self.class.name.split('::').last "<#{class_name} account_name: #{@account_name}, device_list: #{@device_list},"\ " accuracy_mode: #{@accuracy_mode}, cache_mode: #{@cache_mode}, additional_properties:"\ " #{@additional_properties}>" end |