Class: Verizon::Altitude

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

Overview

Altitude 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(altitude_value = SKIP, altitude_confidence = SKIP) ⇒ Altitude

Returns a new instance of Altitude.



79
80
81
82
# File 'lib/verizon/models/altitude.rb', line 79

def initialize(altitude_value = SKIP, altitude_confidence = SKIP)
  @altitude_value = altitude_value unless altitude_value == SKIP
  @altitude_confidence = altitude_confidence unless altitude_confidence == SKIP
end

Instance Attribute Details

#altitude_confidenceAltitudeConfidenceEnum

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.



56
57
58
# File 'lib/verizon/models/altitude.rb', line 56

def altitude_confidence
  @altitude_confidence
end

#altitude_valueInteger

Altitude in a WGS84 co-ordinate system (set to 800001 when unavailable). The value shall be set to:

  • ‘-100000` if the altitude is equal to or less than -1000 m,

  • ‘n` (`n > -100000` and `n < 800000`) if the altitude is equal to or less

than n x 0,01 metre and greater than (n-1) x 0,01 metre,

  • ‘800000` if the altitude greater than 7999,99 m,

  • ‘800001` if the information is not available.

Returns:

  • (Integer)


20
21
22
# File 'lib/verizon/models/altitude.rb', line 20

def altitude_value
  @altitude_value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/verizon/models/altitude.rb', line 85

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  altitude_value = hash.key?('altitudeValue') ? hash['altitudeValue'] : SKIP
  altitude_confidence =
    hash.key?('altitudeConfidence') ? hash['altitudeConfidence'] : SKIP

  # Create object from extracted values.
  Altitude.new(altitude_value,
               altitude_confidence)
end

.namesObject

A mapping from model property names to API property names.



59
60
61
62
63
64
# File 'lib/verizon/models/altitude.rb', line 59

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['altitude_value'] = 'altitudeValue'
  @_hash['altitude_confidence'] = 'altitudeConfidence'
  @_hash
end

.nullablesObject

An array for nullable fields



75
76
77
# File 'lib/verizon/models/altitude.rb', line 75

def self.nullables
  []
end

.optionalsObject

An array for optional fields



67
68
69
70
71
72
# File 'lib/verizon/models/altitude.rb', line 67

def self.optionals
  %w[
    altitude_value
    altitude_confidence
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:

  • The (Altitude | Hash)

    value against the validation is performed.



100
101
102
103
104
105
106
# File 'lib/verizon/models/altitude.rb', line 100

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



116
117
118
119
120
# File 'lib/verizon/models/altitude.rb', line 116

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} altitude_value: #{@altitude_value.inspect}, altitude_confidence:"\
  " #{@altitude_confidence.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



109
110
111
112
113
# File 'lib/verizon/models/altitude.rb', line 109

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} altitude_value: #{@altitude_value}, altitude_confidence:"\
  " #{@altitude_confidence}>"
end