Class: Findi::Device
- Inherits:
-
Object
- Object
- Findi::Device
- Defined in:
- lib/findi/device.rb
Instance Attribute Summary collapse
-
#battery_level ⇒ Object
readonly
Returns the value of attribute battery_level.
-
#battery_status ⇒ Object
readonly
Returns the value of attribute battery_status.
-
#horizontal_accuracy ⇒ Object
readonly
Returns the value of attribute horizontal_accuracy.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#kind ⇒ Object
readonly
Returns the value of attribute kind.
-
#latitude ⇒ Object
readonly
Returns the value of attribute latitude.
-
#location_timestamp ⇒ Object
readonly
Returns the value of attribute location_timestamp.
-
#location_type ⇒ Object
readonly
Returns the value of attribute location_type.
-
#longitude ⇒ Object
readonly
Returns the value of attribute longitude.
-
#model ⇒ Object
readonly
Returns the value of attribute model.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(json) ⇒ Device
constructor
A new instance of Device.
- #is_locating? ⇒ Boolean
- #location_finished? ⇒ Boolean
Constructor Details
#initialize(json) ⇒ Device
Returns a new instance of Device.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/findi/device.rb', line 5 def initialize(json) if location = json['location'] and location.is_a?(Hash) @location_timestamp = Time.at(location['timeStamp'] / 1000) @location_type = location['positionType'] @horizontal_accuracy = location['horizontalAccuracy'] @location_finished = location['locationFinished'] @longitude = location['longitude'] @latitude = location['latitude'] end @is_locating = json['isLocating'] @model = json['deviceModel'] @status = json['deviceStatus'] @id = json['id'] @name = json['name'] @kind = json['deviceClass'] @battery_status = json['batteryStatus'] @battery_level = json['batteryLevel'] end |
Instance Attribute Details
#battery_level ⇒ Object (readonly)
Returns the value of attribute battery_level.
3 4 5 |
# File 'lib/findi/device.rb', line 3 def battery_level @battery_level end |
#battery_status ⇒ Object (readonly)
Returns the value of attribute battery_status.
3 4 5 |
# File 'lib/findi/device.rb', line 3 def battery_status @battery_status end |
#horizontal_accuracy ⇒ Object (readonly)
Returns the value of attribute horizontal_accuracy.
3 4 5 |
# File 'lib/findi/device.rb', line 3 def horizontal_accuracy @horizontal_accuracy end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/findi/device.rb', line 3 def id @id end |
#kind ⇒ Object (readonly)
Returns the value of attribute kind.
3 4 5 |
# File 'lib/findi/device.rb', line 3 def kind @kind end |
#latitude ⇒ Object (readonly)
Returns the value of attribute latitude.
3 4 5 |
# File 'lib/findi/device.rb', line 3 def latitude @latitude end |
#location_timestamp ⇒ Object (readonly)
Returns the value of attribute location_timestamp.
3 4 5 |
# File 'lib/findi/device.rb', line 3 def @location_timestamp end |
#location_type ⇒ Object (readonly)
Returns the value of attribute location_type.
3 4 5 |
# File 'lib/findi/device.rb', line 3 def location_type @location_type end |
#longitude ⇒ Object (readonly)
Returns the value of attribute longitude.
3 4 5 |
# File 'lib/findi/device.rb', line 3 def longitude @longitude end |
#model ⇒ Object (readonly)
Returns the value of attribute model.
3 4 5 |
# File 'lib/findi/device.rb', line 3 def model @model end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/findi/device.rb', line 3 def name @name end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/findi/device.rb', line 3 def status @status end |
Instance Method Details
#is_locating? ⇒ Boolean
25 26 27 |
# File 'lib/findi/device.rb', line 25 def is_locating? @is_locating end |
#location_finished? ⇒ Boolean
29 30 31 |
# File 'lib/findi/device.rb', line 29 def location_finished? @location_finished end |