Class: Verizon::LocationReport

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/verizon/models/location_report.rb

Overview

Location information for up to 1,000 devices.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

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
70
71
72
# 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_listArray[Location]

Device location information.

Returns:



14
15
16
# File 'lib/verizon/models/location_report.rb', line 14

def dev_location_list
  @dev_location_list
end

#has_more_dataTrueClass | FalseClass

True if there are more device locations to retrieve.

Returns:

  • (TrueClass | FalseClass)


18
19
20
# File 'lib/verizon/models/location_report.rb', line 18

def has_more_data
  @has_more_data
end

#start_indexString

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.

Returns:

  • (String)


25
26
27
# File 'lib/verizon/models/location_report.rb', line 25

def start_index
  @start_index
end

#total_countInteger

The total number of devices in the original request and in the report.

Returns:

  • (Integer)


29
30
31
# File 'lib/verizon/models/location_report.rb', line 29

def total_count
  @total_count
end

#txidString

The transaction ID of the report.

Returns:

  • (String)


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.



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/location_report.rb', line 75

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

.namesObject

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

.nullablesObject

An array for nullable fields



58
59
60
# File 'lib/verizon/models/location_report.rb', line 58

def self.nullables
  []
end

.optionalsObject

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