Class: Verizon::PositionData
- Defined in:
- lib/verizon/models/position_data.rb
Overview
Position data.
Instance Attribute Summary collapse
-
#qos ⇒ TrueClass | FalseClass
Whether requested accurary is met or not.
-
#radius ⇒ String
Radius of the location in meters.
-
#time ⇒ String
Time location obtained.
-
#utcoffset ⇒ String
UTC offset of time.
-
#x ⇒ String
X coordinate of location.
-
#y ⇒ String
Y coordinate of location.
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.
Instance Method Summary collapse
-
#initialize(time = SKIP, utcoffset = SKIP, x = SKIP, y = SKIP, radius = SKIP, qos = SKIP) ⇒ PositionData
constructor
A new instance of PositionData.
Methods inherited from BaseModel
Constructor Details
#initialize(time = SKIP, utcoffset = SKIP, x = SKIP, y = SKIP, radius = SKIP, qos = SKIP) ⇒ PositionData
Returns a new instance of PositionData.
65 66 67 68 69 70 71 72 73 |
# File 'lib/verizon/models/position_data.rb', line 65 def initialize(time = SKIP, utcoffset = SKIP, x = SKIP, y = SKIP, radius = SKIP, qos = SKIP) @time = time unless time == SKIP @utcoffset = utcoffset unless utcoffset == SKIP @x = x unless x == SKIP @y = y unless y == SKIP @radius = radius unless radius == SKIP @qos = qos unless qos == SKIP end |
Instance Attribute Details
#qos ⇒ TrueClass | FalseClass
Whether requested accurary is met or not.
34 35 36 |
# File 'lib/verizon/models/position_data.rb', line 34 def qos @qos end |
#radius ⇒ String
Radius of the location in meters.
30 31 32 |
# File 'lib/verizon/models/position_data.rb', line 30 def radius @radius end |
#time ⇒ String
Time location obtained.
14 15 16 |
# File 'lib/verizon/models/position_data.rb', line 14 def time @time end |
#utcoffset ⇒ String
UTC offset of time.
18 19 20 |
# File 'lib/verizon/models/position_data.rb', line 18 def utcoffset @utcoffset end |
#x ⇒ String
X coordinate of location.
22 23 24 |
# File 'lib/verizon/models/position_data.rb', line 22 def x @x end |
#y ⇒ String
Y coordinate of location.
26 27 28 |
# File 'lib/verizon/models/position_data.rb', line 26 def y @y end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/verizon/models/position_data.rb', line 76 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. time = hash.key?('time') ? hash['time'] : SKIP utcoffset = hash.key?('utcoffset') ? hash['utcoffset'] : SKIP x = hash.key?('x') ? hash['x'] : SKIP y = hash.key?('y') ? hash['y'] : SKIP radius = hash.key?('radius') ? hash['radius'] : SKIP qos = hash.key?('qos') ? hash['qos'] : SKIP # Create object from extracted values. PositionData.new(time, utcoffset, x, y, radius, qos) end |
.names ⇒ Object
A mapping from model property names to API property names.
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/verizon/models/position_data.rb', line 37 def self.names @_hash = {} if @_hash.nil? @_hash['time'] = 'time' @_hash['utcoffset'] = 'utcoffset' @_hash['x'] = 'x' @_hash['y'] = 'y' @_hash['radius'] = 'radius' @_hash['qos'] = 'qos' @_hash end |
.nullables ⇒ Object
An array for nullable fields
61 62 63 |
# File 'lib/verizon/models/position_data.rb', line 61 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
49 50 51 52 53 54 55 56 57 58 |
# File 'lib/verizon/models/position_data.rb', line 49 def self.optionals %w[ time utcoffset x y radius qos ] end |