Class: MistApi::StatsApGpsStatSrcEnum

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

Overview

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`

Constant Summary collapse

STATS_AP_GPS_STAT_SRC_ENUM =
[
  # TODO: Write general description for GPS
  GPS = 'gps'.freeze,

  # TODO: Write general description for OTHER_AP
  OTHER_AP = 'other_ap'.freeze,

  # TODO: Write general description for OTHER_APS
  OTHER_APS = 'other_aps'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = GPS) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/mist_api/models/stats_ap_gps_stat_src_enum.rb', line 28

def self.from_value(value, default_value = GPS)
  return default_value if value.nil?

  str = value.to_s.strip

  case str.downcase
  when 'gps' then GPS
  when 'other_ap' then OTHER_AP
  when 'other_aps' then OTHER_APS
  else
    default_value
  end
end

.validate(value) ⇒ Object



22
23
24
25
26
# File 'lib/mist_api/models/stats_ap_gps_stat_src_enum.rb', line 22

def self.validate(value)
  return false if value.nil?

  STATS_AP_GPS_STAT_SRC_ENUM.include?(value)
end