ax-track 0.1.9 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: df8a0965e6d150c1d817952ef21243d4c6cde5de9982da627c7eaf62c5612ae4
4
- data.tar.gz: 15880392636fdd11ca36bd70d17f44862afe9b09a0bc464a70e5fd5e6c31089b
3
+ metadata.gz: 0b806d59d64c2fbc85c9d6dc0fd9bbb364fd817276d1c8b35ef59b8eb8cb8b19
4
+ data.tar.gz: 4316ccfdccf8e0e13f6116099a7ab7af70261cd8899c6eadee9c7517fac3ffe6
5
5
  SHA512:
6
- metadata.gz: 0daa74bd47a6ce1f42748d80eaf539ef8f4d93d92e8ef56b1839965b6950187ed9323cc747ffde2de8e276bb7e848ed5ffe7825b05eb20ece53be981e004a6c1
7
- data.tar.gz: 9674635ea14e6987405f9a5ca0b1ce79e030008af98393f620fea3c5dceca6c1ad4075867472d3073b9c5e80fa1426cf05bee4265dcd99bc69d57c48e1177e0c
6
+ metadata.gz: 558c705bc452ab1362c1419f98b2b368f633d0d518d9ebf2cbf9ee09bffbaade1fa9372f45ac283fa61ee07e367e9ccb20de24f7b45d20c99c308a2d1a8ffd83
7
+ data.tar.gz: aab5a0b04004c6101c840f3dcaf5f47bbca15c756b211e67dc35dde2f696794eef1bd7d38536973f63f894e7161004f0cd5e18368fafb19371a09c592378f298
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ax-track (0.1.9)
4
+ ax-track (0.1.11)
5
5
  faraday (~> 1.7)
6
6
  faraday_middleware (~> 1.1)
7
7
 
@@ -2,34 +2,36 @@ module AxTrack
2
2
  class Tracker < Object
3
3
 
4
4
  def initialize(json_response)
5
- @tracker_id = json_response['id']
6
- @asset_id = json_response['asset']
7
- @url = json_response['url']
8
- @active = json_response['active']
9
- @model = json_response['model']
10
- @asset_details = Asset.new json_response['asset_details'] if json_response['asset_details']
11
- @name = json_response.dig('asset_details', 'name')
5
+ @tracker_id = json_response['id']
6
+ @asset_id = json_response['asset']
7
+ @identifier = json_response['identifier']
8
+ @url = json_response['url']
9
+ @active = json_response['active']
10
+ @model = json_response['model']
11
+ @asset_details = Asset.new json_response['asset_details'] if json_response['asset_details']
12
+ @name = json_response.dig('asset_details', 'name')
12
13
  @last_message_timestamp = DateTime.parse(json_response['last_message_timestamp'], false) if json_response['last_message_timestamp']
13
- @url = json_response['url']
14
- @user_url = website_url(@asset_id)
14
+ @url = json_response['url']
15
+ @user_url = website_url
15
16
  @last_gps_position = GPSPosition.new(json_response['last_gps_measurement'] || json_response['asset_details'])
16
17
 
17
- @battery = json_response.dig('asset_details', 'sensor_data', 'battery', 'value')
18
+ @battery = json_response.dig('asset_details', 'sensor_data', 'battery', 'value')
19
+ sensor_data = json_response.dig('asset_details', 'sensor_data')
18
20
 
19
- sensor_data = json_response.dig('asset_details', 'sensor_data')
20
- sensor_data.delete('battery')
21
- @sensor_data = sensor_data
21
+ @sensor_data = sensor_data
22
22
 
23
23
  create_getters
24
24
  end
25
25
 
26
26
  def available_sensor_data
27
27
  # returns a hash with available senson data
28
- self.sensor_data.keys
28
+ sensor_data_temp = self.sensor_data.keys
29
+ sensor_data_temp = sensor_data_temp.unshift('gps') if self.respond_to? :last_gps_position
30
+ sensor_data_temp
29
31
  end
30
32
 
31
33
  def website_url
32
- "https://app.ax-track.ch/#/map/assets/#{id}"
34
+ "https://app.ax-track.ch/#/map/assets/#{@tracker_id}"
33
35
  end
34
36
 
35
37
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AxTrack
4
- VERSION = "0.1.9"
4
+ VERSION = "0.1.11"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ax-track
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Baumann