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 ⇒ AccuracyModeEnum
Accurary, currently only 0-coarse supported.
-
#cache_mode ⇒ CacheModeEnum
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 = nil, device_list = nil, accuracy_mode = SKIP, cache_mode = SKIP) ⇒ LocationRequest
constructor
A new instance of LocationRequest.
Methods inherited from BaseModel
Constructor Details
#initialize(account_name = nil, device_list = nil, accuracy_mode = SKIP, cache_mode = SKIP) ⇒ LocationRequest
Returns a new instance of LocationRequest.
52 53 54 55 56 57 58 |
# File 'lib/verizon/models/location_request.rb', line 52 def initialize(account_name = nil, device_list = nil, accuracy_mode = SKIP, cache_mode = SKIP) @account_name = account_name @device_list = device_list @accuracy_mode = accuracy_mode unless accuracy_mode == SKIP @cache_mode = cache_mode unless cache_mode == SKIP 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 ⇒ AccuracyModeEnum
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 ⇒ CacheModeEnum
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.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/verizon/models/location_request.rb', line 61 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 object from extracted values. LocationRequest.new(account_name, device_list, accuracy_mode, cache_mode) 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 |