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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +5 -2
- data/lib/ax_track/objects/tracker.rb +3 -1
- data/lib/ax_track/resource.rb +9 -11
- data/lib/ax_track/resources/asset_resource.rb +3 -2
- data/lib/ax_track/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2c016c0f8b6b21a305c193d350b3a1bf003bc4022da5116c56eb9eb46bd87689
|
4
|
+
data.tar.gz: fb56d8a6ad760e23c4d90d513d28d1bc46a06832cc8fe25e18e0332556021fac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '02385bde367ee4eb289955f65e8516d9e0b548ba4e5539d6da4bd1838307c99fdcc1940f6fa53460887ddb821fb95939b4fe8de224627cd0c6ecc4b148eecd69'
|
7
|
+
data.tar.gz: ec3105555b83b46efecf619c04794e9e7873620fffaa82d7574d6a309b32949e93c84f929714687ca17b7cf798c920e54ed3f3d2c46b3cc4caf941fe509e00f8
|
data/Gemfile.lock
CHANGED
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
|
-
|
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
|
|
data/lib/ax_track/resource.rb
CHANGED
@@ -3,14 +3,14 @@ module AxTrack
|
|
3
3
|
class Resource
|
4
4
|
attr_reader :client, :response
|
5
5
|
|
6
|
-
|
7
|
-
BadRequestError = Class.new(
|
8
|
-
UnauthorizedError = Class.new(
|
9
|
-
ForbiddenError = Class.new(
|
10
|
-
ApiRequestsQuotaReachedError = Class.new(
|
11
|
-
NotFoundError = Class.new(
|
12
|
-
UnprocessableEntityError = Class.new(
|
13
|
-
ApiError = Class.new(
|
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
|
19
|
+
body: attributes,
|
20
|
+
headers: {}).body
|
20
21
|
|
21
22
|
end
|
22
23
|
end
|
data/lib/ax_track/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2021-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|