Class: Verizon::LocationReport
- Defined in:
- lib/verizon/models/location_report.rb
Overview
Location information for up to 1,000 devices.
Instance Attribute Summary collapse
-
#dev_location_list ⇒ Array[Location]
Device location information.
-
#has_more_data ⇒ TrueClass | FalseClass
True if there are more device locations to retrieve.
-
#start_index ⇒ String
The zero-based number of the first record to return.
-
#total_count ⇒ Integer
The total number of devices in the original request and in the report.
-
#txid ⇒ String
The transaction ID of the report.
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(dev_location_list = SKIP, has_more_data = SKIP, start_index = SKIP, total_count = SKIP, txid = SKIP) ⇒ LocationReport
constructor
A new instance of LocationReport.
Methods inherited from BaseModel
Constructor Details
#initialize(dev_location_list = SKIP, has_more_data = SKIP, start_index = SKIP, total_count = SKIP, txid = SKIP) ⇒ LocationReport
Returns a new instance of LocationReport.
62 63 64 65 66 67 68 69 |
# File 'lib/verizon/models/location_report.rb', line 62 def initialize(dev_location_list = SKIP, has_more_data = SKIP, start_index = SKIP, total_count = SKIP, txid = SKIP) @dev_location_list = dev_location_list unless dev_location_list == SKIP @has_more_data = has_more_data unless has_more_data == SKIP @start_index = start_index unless start_index == SKIP @total_count = total_count unless total_count == SKIP @txid = txid unless txid == SKIP end |
Instance Attribute Details
#dev_location_list ⇒ Array[Location]
Device location information.
14 15 16 |
# File 'lib/verizon/models/location_report.rb', line 14 def dev_location_list @dev_location_list end |
#has_more_data ⇒ TrueClass | FalseClass
True if there are more device locations to retrieve.
18 19 20 |
# File 'lib/verizon/models/location_report.rb', line 18 def has_more_data @has_more_data end |
#start_index ⇒ String
The zero-based number of the first record to return. Set startIndex=0 for the first request. If there are more than 1,000 devices to be returned (hasMoreData=true), set startIndex=1000 for the second request, 2000 for the third request, etc.
25 26 27 |
# File 'lib/verizon/models/location_report.rb', line 25 def start_index @start_index end |
#total_count ⇒ Integer
The total number of devices in the original request and in the report.
29 30 31 |
# File 'lib/verizon/models/location_report.rb', line 29 def total_count @total_count end |
#txid ⇒ String
The transaction ID of the report.
33 34 35 |
# File 'lib/verizon/models/location_report.rb', line 33 def txid @txid end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
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 |
# File 'lib/verizon/models/location_report.rb', line 72 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it dev_location_list = nil unless hash['devLocationList'].nil? dev_location_list = [] hash['devLocationList'].each do |structure| dev_location_list << (Location.from_hash(structure) if structure) end end dev_location_list = SKIP unless hash.key?('devLocationList') has_more_data = hash.key?('hasMoreData') ? hash['hasMoreData'] : SKIP start_index = hash.key?('startIndex') ? hash['startIndex'] : SKIP total_count = hash.key?('totalCount') ? hash['totalCount'] : SKIP txid = hash.key?('txid') ? hash['txid'] : SKIP # Create object from extracted values. LocationReport.new(dev_location_list, has_more_data, start_index, total_count, txid) end |
.names ⇒ Object
A mapping from model property names to API property names.
36 37 38 39 40 41 42 43 44 |
# File 'lib/verizon/models/location_report.rb', line 36 def self.names @_hash = {} if @_hash.nil? @_hash['dev_location_list'] = 'devLocationList' @_hash['has_more_data'] = 'hasMoreData' @_hash['start_index'] = 'startIndex' @_hash['total_count'] = 'totalCount' @_hash['txid'] = 'txid' @_hash end |
.nullables ⇒ Object
An array for nullable fields
58 59 60 |
# File 'lib/verizon/models/location_report.rb', line 58 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
47 48 49 50 51 52 53 54 55 |
# File 'lib/verizon/models/location_report.rb', line 47 def self.optionals %w[ dev_location_list has_more_data start_index total_count txid ] end |