ax-track 0.1.7 → 0.1.12

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: 213508465fedc4ac5d5ed77a7b3e868a2b3a409cb7fccb199ef4e64bebd4b35c
4
- data.tar.gz: 1e86ff7dc00fc65068345b9ec109a2b1c75ea8d9e22c1bea0494ee69c0a6a0ad
3
+ metadata.gz: 3fa4b99e8a29421bcac73b9d8d3191c5071af4b09b5d5310c1e151ed1693ce04
4
+ data.tar.gz: b2365bc080c408a30d0f2d5a810dbd1bf76884d79de66275a0c2fac954eaeae5
5
5
  SHA512:
6
- metadata.gz: c477e3d72782467652a58dbb93e6e7a451e941808729835f26dfd46a5bc51d922541a434c49b8d3ddf1087a72ecc46a97bfcfbbdece6ede07774bbf2aeb79c1d
7
- data.tar.gz: 0c4f184ac8f812f2657a8cf18be46273811a20a1c638623868f3ec892d2a3dea14c38162810a6caaab3fb70e5b1fcd69d8e3d3249b7256fcc05a0acf475f0e78
6
+ metadata.gz: 149e09e93ba9bd1cd2f51d92517cd3c188ae016960639c9d76878a5a0b7d36a95d579b48f0c149a2f05af6f540f6a550433c1ea34c965a0cf2aa1ebdab155f9f
7
+ data.tar.gz: 8a4fc87c81f411c861a7f684219bfaad36ac54ed3ae7733557baa3a0a1121e9d40f126feb596fd45dab42dd87e670995040d61d1b196139ab3f1ab400031d0ba
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ax-track (0.1.7)
4
+ ax-track (0.1.12)
5
5
  faraday (~> 1.7)
6
6
  faraday_middleware (~> 1.1)
7
7
 
@@ -2,35 +2,41 @@ module AxTrack
2
2
  class Tracker < Object
3
3
 
4
4
  def initialize(json_response)
5
- @id = json_response['id']
6
- @url = json_response['url']
7
- @active = json_response['active']
8
- @model = json_response['model']
9
- @axtrack_asset_id = json_response['asset']
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
+ @url = json_response['url']
15
+ @user_url = website_url
14
16
  @last_gps_position = GPSPosition.new(json_response['last_gps_measurement'] || json_response['asset_details'])
15
17
 
16
- @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')
17
20
 
18
- sensor_data = json_response.dig('asset_details', 'sensor_data')
19
- sensor_data.delete('battery')
20
- @sensor_data = sensor_data
21
+ @sensor_data = sensor_data
22
+
23
+ @network = json_response['network']
21
24
 
22
25
  create_getters
23
26
  end
24
27
 
25
28
  def available_sensor_data
26
29
  # returns a hash with available senson data
27
- self.senson_data.keys
30
+ sensor_data_temp = self.sensor_data.keys
31
+ sensor_data_temp = sensor_data_temp.unshift('gps') if self.respond_to? :last_gps_position
32
+ sensor_data_temp
28
33
  end
29
34
 
30
- def last_gps_position
31
- self.last_gps_position
35
+ def website_url
36
+ "https://app.ax-track.ch/#/map/assets/#{@tracker_id}"
32
37
  end
33
38
 
39
+
34
40
  class GPSPosition < Object
35
41
 
36
42
  def initialize(json_response)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AxTrack
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.12"
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.7
4
+ version: 0.1.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Baumann