Class: MistApi::StatsApGpsStat

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/mist_api/models/stats_ap_gps_stat.rb

Overview

StatsApGpsStat Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(accuracy = SKIP, altitude = SKIP, latitude = SKIP, longitude = SKIP, src = SKIP, timestamp = SKIP) ⇒ StatsApGpsStat

Returns a new instance of StatsApGpsStat.



68
69
70
71
72
73
74
75
76
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 68

def initialize(accuracy = SKIP, altitude = SKIP, latitude = SKIP,
               longitude = SKIP, src = SKIP, timestamp = SKIP)
  @accuracy = accuracy unless accuracy == SKIP
  @altitude = altitude unless altitude == SKIP
  @latitude = latitude unless latitude == SKIP
  @longitude = longitude unless longitude == SKIP
  @src = src unless src == SKIP
  @timestamp = timestamp unless timestamp == SKIP
end

Instance Attribute Details

#accuracyFloat

The estimated accuracy or accuracy of the GPS coordinates, measured in meters.

Returns:

  • (Float)


15
16
17
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 15

def accuracy
  @accuracy
end

#altitudeFloat

The elevation of the AP above sea level, measured in meters.

Returns:

  • (Float)


19
20
21
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 19

def altitude
  @altitude
end

#latitudeFloat

The geographic latitude of the AP, measured in degrees.

Returns:

  • (Float)


23
24
25
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 23

def latitude
  @latitude
end

#longitudeFloat

The geographic longitude of the AP, measured in degrees.

Returns:

  • (Float)


27
28
29
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 27

def longitude
  @longitude
end

#srcStatsApGpsStatSrcEnum

The origin of the GPS data. enum: ‘gps`: from this device GPS estimates, `other_ap` from neighboring device GPS estimates. Note: API responses may return `other_aps` which should be treated as `other_ap`



33
34
35
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 33

def src
  @src
end

#timestampFloat

Epoch (seconds)

Returns:

  • (Float)


37
38
39
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 37

def timestamp
  @timestamp
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 79

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  accuracy = hash.key?('accuracy') ? hash['accuracy'] : SKIP
  altitude = hash.key?('altitude') ? hash['altitude'] : SKIP
  latitude = hash.key?('latitude') ? hash['latitude'] : SKIP
  longitude = hash.key?('longitude') ? hash['longitude'] : SKIP
  src = hash.key?('src') ? hash['src'] : SKIP
  timestamp = hash.key?('timestamp') ? hash['timestamp'] : SKIP

  # Create object from extracted values.
  StatsApGpsStat.new(accuracy,
                     altitude,
                     latitude,
                     longitude,
                     src,
                     timestamp)
end

.namesObject

A mapping from model property names to API property names.



40
41
42
43
44
45
46
47
48
49
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 40

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['accuracy'] = 'accuracy'
  @_hash['altitude'] = 'altitude'
  @_hash['latitude'] = 'latitude'
  @_hash['longitude'] = 'longitude'
  @_hash['src'] = 'src'
  @_hash['timestamp'] = 'timestamp'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
55
56
57
58
59
60
61
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 52

def self.optionals
  %w[
    accuracy
    altitude
    latitude
    longitude
    src
    timestamp
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



107
108
109
110
111
112
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 107

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} accuracy: #{@accuracy.inspect}, altitude: #{@altitude.inspect}, latitude:"\
  " #{@latitude.inspect}, longitude: #{@longitude.inspect}, src: #{@src.inspect}, timestamp:"\
  " #{@timestamp.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



100
101
102
103
104
# File 'lib/mist_api/models/stats_ap_gps_stat.rb', line 100

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} accuracy: #{@accuracy}, altitude: #{@altitude}, latitude: #{@latitude},"\
  " longitude: #{@longitude}, src: #{@src}, timestamp: #{@timestamp}>"
end