ax-track 0.2 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/ax_track/client.rb +2 -1
- data/lib/ax_track/objects/tracker.rb +2 -1
- data/lib/ax_track/resource.rb +8 -0
- data/lib/ax_track/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34c0014b35fd2c5751cd11b90c99730472099f0218fe121f19add0e28b14d9f9
|
4
|
+
data.tar.gz: 9ddee5341711f61bdc51961363b4434dff2cacd11d16ae7791f45327db975ad3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 785311de5a3ce20c3ef733055b001a2af4aae4e035bb2fa3ee07ca816bf32dd45a123cd830237e136cbc741a24bcb3b8e1302a9f15ea7e3e938982f000213da8
|
7
|
+
data.tar.gz: 27b1852ba78ada2a75b7ba2dceca80a264e4f67a37bcf19f7b784cceb7985ea2501517187ce60c6e20950664a0df203104992d5182f41eacf0c05c0bbd763350
|
data/Gemfile.lock
CHANGED
data/lib/ax_track/client.rb
CHANGED
@@ -12,6 +12,8 @@ module AxTrack
|
|
12
12
|
APIKeyMissing = Class.new(StandardError)
|
13
13
|
|
14
14
|
attr_reader :api_key, :adapter
|
15
|
+
attr_writer :connection
|
16
|
+
|
15
17
|
def initialize(api_key: nil, adapter: nil, stubs: nil)
|
16
18
|
@api_key = api_key || ENV['AXTRACK_API_KEY']
|
17
19
|
@adapter = adapter || Faraday.default_adapter
|
@@ -38,6 +40,5 @@ module AxTrack
|
|
38
40
|
conn.headers['Authorization'] = "Token #{api_key}" unless api_key.empty?
|
39
41
|
end
|
40
42
|
end
|
41
|
-
|
42
43
|
end
|
43
44
|
end
|
@@ -15,7 +15,8 @@ module AxTrack
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def last_gps_position
|
18
|
-
GPSPosition.new(@last_gps_measurement || { lat: asset_details.lat, lng: asset_details.lng } )
|
18
|
+
#GPSPosition.new(@last_gps_measurement || { lat: asset_details.lat, lng: asset_details.lng } )
|
19
|
+
GPSPosition.new(@last_gps_measurement)
|
19
20
|
end
|
20
21
|
|
21
22
|
def battery
|
data/lib/ax_track/resource.rb
CHANGED
@@ -27,6 +27,14 @@ module AxTrack
|
|
27
27
|
def request(http_method: :get, endpoint:, headers: {}, params: {}, body: {}, result_subset: nil)
|
28
28
|
raise "Client not defined" unless defined? @client
|
29
29
|
endpoint = endpoint + "/" unless endpoint[-1] == "/"
|
30
|
+
|
31
|
+
body['picture'] = Faraday::UploadIO.new(
|
32
|
+
body['picture'].tempfile.path,
|
33
|
+
body['picture'].content_type,
|
34
|
+
body['picture'].filename
|
35
|
+
) if body.key? :picture
|
36
|
+
|
37
|
+
# client.connection['headers']['Content-Type'] = 'multipart/form-data' if body.key? :picture
|
30
38
|
@response = client.connection.public_send(http_method, endpoint, params.merge(body))
|
31
39
|
|
32
40
|
unless response_successful?
|
data/lib/ax_track/version.rb
CHANGED