bitzlato 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bitzlato/client.rb +5 -3
- data/lib/bitzlato/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: 707a2f72f5adaeb757672ac13814f34f3267f2ae3684c4ec4b7c020d9b89d401
|
4
|
+
data.tar.gz: 12068b06536e13d3e3879e7e54e20207e922e4837c5b139243f44e650020604f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e7d97b43bfd1a6b155fbd2fa987aeb5d391c2a4217d6b0e6f8428639346adcedc9d207385faa3db32b8d49822bfb8b0700ef618701e9709ba1ed82f6f169176c
|
7
|
+
data.tar.gz: b4e46dc07bb667a69977a196833fc0619d7e904354948c8693bb797ad56d757d5e6194dfd5c823ba2aa147df1039215d7c0f8e0747055888924ea3a2520b826b
|
data/lib/bitzlato/client.rb
CHANGED
@@ -35,7 +35,8 @@ module Bitzlato
|
|
35
35
|
|
36
36
|
def parse_response(response)
|
37
37
|
raise WrongResponse, "Wrong response status (#{response.status})" unless response.success?
|
38
|
-
|
38
|
+
return nil if response.body.emtpy?
|
39
|
+
raise WrongResponse, "Wrong content type (#{response['content-type']})" if response['content-type'] != 'application/json'
|
39
40
|
JSON.parse response.body
|
40
41
|
end
|
41
42
|
|
@@ -50,14 +51,15 @@ module Bitzlato
|
|
50
51
|
}
|
51
52
|
end
|
52
53
|
|
54
|
+
# Every time build new connection to have fresh jwt token
|
53
55
|
def connection
|
54
|
-
|
56
|
+
Faraday.new url: @home_url do |c|
|
55
57
|
c.use Faraday::Response::Logger unless @logger.nil?
|
56
58
|
c.headers = {
|
57
59
|
'Content-Type' => 'application/json',
|
58
60
|
'Accept' => 'application/json'
|
59
61
|
}
|
60
|
-
c.request :curl, logger, :warn if ENV['BITZLATO_CURL_LOGGER']
|
62
|
+
c.request :curl, @logger, :warn if ENV['BITZLATO_CURL_LOGGER']
|
61
63
|
c.authorization :Bearer, bearer
|
62
64
|
c.adapter @adapter
|
63
65
|
end
|
data/lib/bitzlato/version.rb
CHANGED