Class: Verizon::AltitudeConfidenceEnum

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

Overview

Absolute accuracy of a reported altitude value. The value shall be set to: - 0 - ‘alt-000-01` - if the confidence value is equal to or less than 0,01 metre, - 1 - `alt-000-02` - if the confidence value is equal to or less than 0,02 metre and greater than 0,01 metre, - 2 - `alt-000-05` - if the confidence value is equal to or less than 0,05 metre and greater than 0,02 metre, - 3 - `alt-000-10` - if the confidence value is equal to or less than 0,1 metre and greater than 0,05 metre, - 4 - `alt-000-20` - if the confidence value is equal to or less than 0,2 metre and greater than 0,1 metre, - 5 - `alt-000-50` - if the confidence value is equal to or less than 0,5 metre and greater than 0,2 metre, - 6 - `alt-001-00` - if the confidence value is equal to or less than 1 metre and greater than 0,5 metre, - 7 - `alt-002-00` - if the confidence value is equal to or less than 2 metres and greater than 1 metre, - 8 - `alt-005-00` - if the confidence value is equal to or less than 5 metres and greater than 2 metres, - 9 - `alt-010-00` - if the confidence value is equal to or less than 10 metres and greater than 5 metres, - 10 - `alt-020-00` - if the confidence value is equal to or less than 20 metres and greater than 10 metres, - 11 - `alt-050-00` - if the confidence value is equal to or less than 50 metres and greater than 20 metres, - 12 - `alt-100-00` - if the confidence value is equal to or less than 100 metres and greater than 50 metres, - 13 - `alt-200-00` - if the confidence value is equal to or less than 200 metres and greater than 100 metres, - 14 - `outOfRange` - if the confidence value is out of range, i.e. greater than 200 metres, - 15 - `unavailable` - if the confidence value is unavailable.

Constant Summary collapse

ALTITUDE_CONFIDENCE_ENUM =
[
  # TODO: Write general description for ALT00001
  ALT00001 = 'alt-000-01'.freeze,

  # TODO: Write general description for ALT00002
  ALT00002 = 'alt-000-02'.freeze,

  # TODO: Write general description for ALT00005
  ALT00005 = 'alt-000-05'.freeze,

  # TODO: Write general description for ALT00010
  ALT00010 = 'alt-000-10'.freeze,

  # TODO: Write general description for ALT00020
  ALT00020 = 'alt-000-20'.freeze,

  # TODO: Write general description for ALT00050
  ALT00050 = 'alt-000-50'.freeze,

  # TODO: Write general description for ALT00100
  ALT00100 = 'alt-001-00'.freeze,

  # TODO: Write general description for ALT00200
  ALT00200 = 'alt-002-00'.freeze,

  # TODO: Write general description for ALT00500
  ALT00500 = 'alt-005-00'.freeze,

  # TODO: Write general description for ALT01000
  ALT01000 = 'alt-010-00'.freeze,

  # TODO: Write general description for ALT02000
  ALT02000 = 'alt-020-00'.freeze,

  # TODO: Write general description for ALT05000
  ALT05000 = 'alt-050-00'.freeze,

  # TODO: Write general description for ALT10000
  ALT10000 = 'alt-100-00'.freeze,

  # TODO: Write general description for ALT20000
  ALT20000 = 'alt-200-00'.freeze,

  # TODO: Write general description for OUTOFRANGE
  OUTOFRANGE = 'outOfRange'.freeze,

  # TODO: Write general description for UNAVAILABLE
  UNAVAILABLE = 'unavailable'.freeze
].freeze

Class Method Summary collapse

Class Method Details

.from_value(value, default_value = ALT00001) ⇒ Object



88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# File 'lib/verizon/models/altitude_confidence_enum.rb', line 88

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

  str = value.to_s.strip

  case str.downcase
  when 'alt00001' then ALT00001
  when 'alt00002' then ALT00002
  when 'alt00005' then ALT00005
  when 'alt00010' then ALT00010
  when 'alt00020' then ALT00020
  when 'alt00050' then ALT00050
  when 'alt00100' then ALT00100
  when 'alt00200' then ALT00200
  when 'alt00500' then ALT00500
  when 'alt01000' then ALT01000
  when 'alt02000' then ALT02000
  when 'alt05000' then ALT05000
  when 'alt10000' then ALT10000
  when 'alt20000' then ALT20000
  when 'outofrange' then OUTOFRANGE
  when 'unavailable' then UNAVAILABLE
  else
    default_value
  end
end

.validate(value) ⇒ Object



82
83
84
85
86
# File 'lib/verizon/models/altitude_confidence_enum.rb', line 82

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

  ALTITUDE_CONFIDENCE_ENUM.include?(value)
end