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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e6df6669e5c15f39ac72709670832be91b8b2aa935ffa593816a18dbe9958eb3
4
- data.tar.gz: a24adc8735234811a9d89a6bebe76d0fac0be474b64641e825e9af67f535305b
3
+ metadata.gz: 34c0014b35fd2c5751cd11b90c99730472099f0218fe121f19add0e28b14d9f9
4
+ data.tar.gz: 9ddee5341711f61bdc51961363b4434dff2cacd11d16ae7791f45327db975ad3
5
5
  SHA512:
6
- metadata.gz: 59dfcb20ad49c457b93e4c4705164703ce31154a924f7a6a654aae15a6015d94de8ad96b6ec75498b17a7ca5f596a3c53eb91ff034a7be3e497898e598776984
7
- data.tar.gz: c2115e2ae5e4e1b138df9889c33ff903d966b4208e8e39b75196f77284819a05d423180d1b49a42b440d2a40a3776028bd061d864223d86e474790c2d98b0502
6
+ metadata.gz: 785311de5a3ce20c3ef733055b001a2af4aae4e035bb2fa3ee07ca816bf32dd45a123cd830237e136cbc741a24bcb3b8e1302a9f15ea7e3e938982f000213da8
7
+ data.tar.gz: 27b1852ba78ada2a75b7ba2dceca80a264e4f67a37bcf19f7b784cceb7985ea2501517187ce60c6e20950664a0df203104992d5182f41eacf0c05c0bbd763350
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ax-track (0.2)
4
+ ax-track (0.2.1)
5
5
  faraday (~> 1.7)
6
6
  faraday_middleware (~> 1.1)
7
7
 
@@ -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
@@ -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?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module AxTrack
4
- VERSION = "0.2"
4
+ VERSION = "0.2.1"
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.2'
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Baumann