ax-track 0.1.6 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '02813bb03bbdae12acc66ad967ab18af1dbe704c1c5e6dcdd9050ae50920f859'
4
- data.tar.gz: a01c20a2eae5bbcfc115657eae3bfc7bd16a3f1a5a54cfc5161d241f547f0f0c
3
+ metadata.gz: 213508465fedc4ac5d5ed77a7b3e868a2b3a409cb7fccb199ef4e64bebd4b35c
4
+ data.tar.gz: 1e86ff7dc00fc65068345b9ec109a2b1c75ea8d9e22c1bea0494ee69c0a6a0ad
5
5
  SHA512:
6
- metadata.gz: 3fdd57611cf426cda622a067d98f2e30c97f2649e9d440019f245de167480667072ab01386a839a952f58bf539e83418684c91fc69e7c1ae99388ca84ed1f9bc
7
- data.tar.gz: 5102fb92eb961a55f2a1dfd7341c27f1d79a11f231499ba9e0809eb21d62001c5491faae9e908031ca922d94e67991e3c468e26431b00d06d224374845300e3d
6
+ metadata.gz: c477e3d72782467652a58dbb93e6e7a451e941808729835f26dfd46a5bc51d922541a434c49b8d3ddf1087a72ecc46a97bfcfbbdece6ede07774bbf2aeb79c1d
7
+ data.tar.gz: 0c4f184ac8f812f2657a8cf18be46273811a20a1c638623868f3ec892d2a3dea14c38162810a6caaab3fb70e5b1fcd69d8e3d3249b7256fcc05a0acf475f0e78
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ax-track (0.1.6)
4
+ ax-track (0.1.7)
5
5
  faraday (~> 1.7)
6
6
  faraday_middleware (~> 1.1)
7
7
 
data/README.md CHANGED
@@ -1,9 +1,12 @@
1
- # AxTrack
1
+ # AxTrack API Ruby Wrapper
2
2
 
3
3
  Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/axTrack`. To experiment with that code, run `bin/console` for an interactive prompt.
4
4
 
5
5
  TODO: Delete this and the text above, and describe your gem
6
6
 
7
+ ## Open questions
8
+ * how do I know what type of sensors are available.
9
+
7
10
  ## Installation
8
11
 
9
12
  Add this line to your application's Gemfile:
@@ -23,7 +26,7 @@ Or install it yourself as:
23
26
  ## Usage
24
27
 
25
28
  ```ruby
26
- client == AxTrack::Client.new(api_key: your_api_key)
29
+ client = AxTrack::Client.new(api_key: your_api_key)
27
30
  ```
28
31
 
29
32
  ### Trackers
data/bin/console CHANGED
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require "bundler/setup"
5
- require "ax_track"
5
+ require "ax-track"
6
6
 
7
7
  # You can add fixtures and/or initialization code here to make experimenting
8
8
  # with your gem easier. You can also use a different console, if you like.
@@ -9,10 +9,14 @@ module AxTrack
9
9
 
10
10
  BASE_URL = 'https://prod.api.ax-track.ch/api/v1'.freeze
11
11
 
12
+ APIKeyMissing = Class.new(StandardError)
13
+
12
14
  attr_reader :api_key, :adapter
13
15
  def initialize(api_key: ENV['AXTRACK_API_KEY'], adapter: Faraday.default_adapter)
14
16
  @api_key = api_key
15
17
  @adapter = adapter
18
+
19
+ raise APIKeyMissing, "No API key provided" if !defined?(api_key) || api_key.nil? || api_key.empty?
16
20
  end
17
21
 
18
22
  def trackers
@@ -7,6 +7,7 @@ module AxTrack
7
7
  @active = json_response['active']
8
8
  @model = json_response['model']
9
9
  @axtrack_asset_id = json_response['asset']
10
+ @asset_details = Asset.new json_response['asset_details'] if json_response['asset_details']
10
11
  @name = json_response.dig('asset_details', 'name')
11
12
  @last_message_timestamp = DateTime.parse(json_response['last_message_timestamp'], false) if json_response['last_message_timestamp']
12
13
  @url = json_response['url']
@@ -21,6 +22,15 @@ module AxTrack
21
22
  create_getters
22
23
  end
23
24
 
25
+ def available_sensor_data
26
+ # returns a hash with available senson data
27
+ self.senson_data.keys
28
+ end
29
+
30
+ def last_gps_position
31
+ self.last_gps_position
32
+ end
33
+
24
34
  class GPSPosition < Object
25
35
 
26
36
  def initialize(json_response)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AxTrack
4
- VERSION = "0.1.6"
4
+ VERSION = "0.1.7"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ax-track
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Baumann
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-10-04 00:00:00.000000000 Z
11
+ date: 2021-10-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday