ax-track 0.1.12 → 0.1.14

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: 3fa4b99e8a29421bcac73b9d8d3191c5071af4b09b5d5310c1e151ed1693ce04
4
- data.tar.gz: b2365bc080c408a30d0f2d5a810dbd1bf76884d79de66275a0c2fac954eaeae5
3
+ metadata.gz: 2c016c0f8b6b21a305c193d350b3a1bf003bc4022da5116c56eb9eb46bd87689
4
+ data.tar.gz: fb56d8a6ad760e23c4d90d513d28d1bc46a06832cc8fe25e18e0332556021fac
5
5
  SHA512:
6
- metadata.gz: 149e09e93ba9bd1cd2f51d92517cd3c188ae016960639c9d76878a5a0b7d36a95d579b48f0c149a2f05af6f540f6a550433c1ea34c965a0cf2aa1ebdab155f9f
7
- data.tar.gz: 8a4fc87c81f411c861a7f684219bfaad36ac54ed3ae7733557baa3a0a1121e9d40f126feb596fd45dab42dd87e670995040d61d1b196139ab3f1ab400031d0ba
6
+ metadata.gz: '02385bde367ee4eb289955f65e8516d9e0b548ba4e5539d6da4bd1838307c99fdcc1940f6fa53460887ddb821fb95939b4fe8de224627cd0c6ecc4b148eecd69'
7
+ data.tar.gz: ec3105555b83b46efecf619c04794e9e7873620fffaa82d7574d6a309b32949e93c84f929714687ca17b7cf798c920e54ed3f3d2c46b3cc4caf941fe509e00f8
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ax-track (0.1.12)
4
+ ax-track (0.1.14)
5
5
  faraday (~> 1.7)
6
6
  faraday_middleware (~> 1.1)
7
7
 
data/README.md CHANGED
@@ -34,7 +34,7 @@ client = AxTrack::Client.new(api_key: your_api_key)
34
34
  # Get a list of all trackers
35
35
  client.tracker.list
36
36
 
37
- # Get the specific information of a specific tracker
37
+ # Get the specific information of a specific tracker. If :asset_id is invalid, a AxTrack::Resource::NotFoundError is returned
38
38
  client.tracker.retrieve(:tracker_id)
39
39
  ```
40
40
 
@@ -43,7 +43,7 @@ client.tracker.retrieve(:tracker_id)
43
43
  # Get a list of all assets
44
44
  client.asset.list
45
45
 
46
- # Get a specific asset
46
+ # Get a specific asset. If :asset_id is invalid, a AxTrack::Resource::NotFoundError is returned
47
47
  client.asset.retrieve(:asset_id)
48
48
 
49
49
  # Update a specif asset
@@ -52,6 +52,9 @@ client.asset.update(:tracker_id, params)
52
52
  client.tracker.update(:tracker_id, name: 'New name')
53
53
  ```
54
54
 
55
+ ### Errors
56
+
57
+
55
58
  ## Development
56
59
 
57
60
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -28,7 +28,9 @@ module AxTrack
28
28
  def available_sensor_data
29
29
  # returns a hash with available senson data
30
30
  sensor_data_temp = self.sensor_data.keys
31
- sensor_data_temp = sensor_data_temp.unshift('gps') if self.respond_to? :last_gps_position
31
+ # if no timestamp is available in the GPSPosition, then there wasn't a last_gps_measurement returned in the json
32
+ # hence the sensor doesn't contain a GPS module.
33
+ sensor_data_temp = sensor_data_temp.unshift('gps') if self.last_gps_position.respond_to? :timestamp
32
34
  sensor_data_temp
33
35
  end
34
36
 
@@ -3,14 +3,14 @@ module AxTrack
3
3
  class Resource
4
4
  attr_reader :client, :response
5
5
 
6
- GithubAPIError = Class.new(StandardError)
7
- BadRequestError = Class.new(GithubAPIError)
8
- UnauthorizedError = Class.new(GithubAPIError)
9
- ForbiddenError = Class.new(GithubAPIError)
10
- ApiRequestsQuotaReachedError = Class.new(GithubAPIError)
11
- NotFoundError = Class.new(GithubAPIError)
12
- UnprocessableEntityError = Class.new(GithubAPIError)
13
- ApiError = Class.new(GithubAPIError)
6
+ ApiError = Class.new(StandardError)
7
+ BadRequestError = Class.new(ApiError)
8
+ UnauthorizedError = Class.new(ApiError)
9
+ ForbiddenError = Class.new(ApiError)
10
+ ApiRequestsQuotaReachedError = Class.new(ApiError)
11
+ NotFoundError = Class.new(ApiError)
12
+ UnprocessableEntityError = Class.new(ApiError)
13
+ ApiError = Class.new(ApiError)
14
14
 
15
15
  HTTP_OK_CODE = 200
16
16
 
@@ -43,9 +43,7 @@ module AxTrack
43
43
  BadRequestError
44
44
  when HTTP_UNAUTHORIZED_CODE
45
45
  UnauthorizedError
46
- when HTTP_FORBIDDEN_CODE
47
- ForbiddenError
48
- when HTTP_NOT_FOUND_CODE
46
+ when HTTP_NOT_FOUND_CODE, HTTP_FORBIDDEN_CODE
49
47
  NotFoundError
50
48
  when HTTP_UNPROCESSABLE_ENTITY_CODE
51
49
  UnprocessableEntityError
@@ -13,10 +13,11 @@ module AxTrack
13
13
  endpoint: "assets/#{asset_id}").body
14
14
  end
15
15
 
16
- def update(asset_id, **attributes)
16
+ def update(asset_id, headers: {}, **attributes)
17
17
  Asset.new request(http_method: :patch,
18
18
  endpoint: "assets/#{asset_id}",
19
- body: attributes).body
19
+ body: attributes,
20
+ headers: {}).body
20
21
 
21
22
  end
22
23
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AxTrack
4
- VERSION = "0.1.12"
4
+ VERSION = "0.1.14"
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.12
4
+ version: 0.1.14
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-06 00:00:00.000000000 Z
11
+ date: 2021-10-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday