Class: Verizon::EventPosition
- Defined in:
- lib/verizon/models/event_position.rb
Overview
EventPosition Model.
Instance Attribute Summary collapse
-
#altitude ⇒ Altitude
Longitude of the event location in microdegrees (1800000001 shall be used when unavailable).
-
#latitude ⇒ Integer
Latitude of the event location in microdegrees (900000001 shall be used when unavailable).
-
#longitude ⇒ Integer
Longitude of the event location in microdegrees (1800000001 shall be used when unavailable).
-
#position_confidence_ellipse ⇒ PosConfidenceEllipse
Longitude of the event location in microdegrees (1800000001 shall be used when unavailable).
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(latitude = nil, longitude = nil, position_confidence_ellipse = nil, altitude = nil) ⇒ EventPosition
constructor
A new instance of EventPosition.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(latitude = nil, longitude = nil, position_confidence_ellipse = nil, altitude = nil) ⇒ EventPosition
Returns a new instance of EventPosition.
52 53 54 55 56 57 58 |
# File 'lib/verizon/models/event_position.rb', line 52 def initialize(latitude = nil, longitude = nil, position_confidence_ellipse = nil, altitude = nil) @latitude = latitude @longitude = longitude @position_confidence_ellipse = position_confidence_ellipse @altitude = altitude end |
Instance Attribute Details
#altitude ⇒ Altitude
Longitude of the event location in microdegrees (1800000001 shall be used when unavailable).
30 31 32 |
# File 'lib/verizon/models/event_position.rb', line 30 def altitude @altitude end |
#latitude ⇒ Integer
Latitude of the event location in microdegrees (900000001 shall be used when unavailable).
15 16 17 |
# File 'lib/verizon/models/event_position.rb', line 15 def latitude @latitude end |
#longitude ⇒ Integer
Longitude of the event location in microdegrees (1800000001 shall be used when unavailable).
20 21 22 |
# File 'lib/verizon/models/event_position.rb', line 20 def longitude @longitude end |
#position_confidence_ellipse ⇒ PosConfidenceEllipse
Longitude of the event location in microdegrees (1800000001 shall be used when unavailable).
25 26 27 |
# File 'lib/verizon/models/event_position.rb', line 25 def position_confidence_ellipse @position_confidence_ellipse end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/verizon/models/event_position.rb', line 61 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. latitude = hash.key?('latitude') ? hash['latitude'] : nil longitude = hash.key?('longitude') ? hash['longitude'] : nil if hash['positionConfidenceEllipse'] position_confidence_ellipse = PosConfidenceEllipse.from_hash(hash['positionConfidenceEllipse']) end altitude = Altitude.from_hash(hash['altitude']) if hash['altitude'] # Create object from extracted values. EventPosition.new(latitude, longitude, position_confidence_ellipse, altitude) end |
.names ⇒ Object
A mapping from model property names to API property names.
33 34 35 36 37 38 39 40 |
# File 'lib/verizon/models/event_position.rb', line 33 def self.names @_hash = {} if @_hash.nil? @_hash['latitude'] = 'latitude' @_hash['longitude'] = 'longitude' @_hash['position_confidence_ellipse'] = 'positionConfidenceEllipse' @_hash['altitude'] = 'altitude' @_hash end |
.nullables ⇒ Object
An array for nullable fields
48 49 50 |
# File 'lib/verizon/models/event_position.rb', line 48 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
43 44 45 |
# File 'lib/verizon/models/event_position.rb', line 43 def self.optionals [] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/verizon/models/event_position.rb', line 81 def self.validate(value) if value.instance_of? self return ( APIHelper.valid_type?(value.latitude, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.longitude, ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value.position_confidence_ellipse, ->(val) { PosConfidenceEllipse.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value.altitude, ->(val) { Altitude.validate(val) }, is_model_hash: true) ) end return false unless value.instance_of? Hash ( APIHelper.valid_type?(value['latitude'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['longitude'], ->(val) { val.instance_of? Integer }) and APIHelper.valid_type?(value['positionConfidenceEllipse'], ->(val) { PosConfidenceEllipse.validate(val) }, is_model_hash: true) and APIHelper.valid_type?(value['altitude'], ->(val) { Altitude.validate(val) }, is_model_hash: true) ) end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
121 122 123 124 125 126 |
# File 'lib/verizon/models/event_position.rb', line 121 def inspect class_name = self.class.name.split('::').last "<#{class_name} latitude: #{@latitude.inspect}, longitude: #{@longitude.inspect},"\ " position_confidence_ellipse: #{@position_confidence_ellipse.inspect}, altitude:"\ " #{@altitude.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
114 115 116 117 118 |
# File 'lib/verizon/models/event_position.rb', line 114 def to_s class_name = self.class.name.split('::').last "<#{class_name} latitude: #{@latitude}, longitude: #{@longitude},"\ " position_confidence_ellipse: #{@position_confidence_ellipse}, altitude: #{@altitude}>" end |