treezor_connect 0.20.2 → 0.21.0
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/lib/treezor_connect/client.rb +23 -13
- data/lib/treezor_connect.rb +1 -1
- metadata +4 -7
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f42fbc240623d62e13b086515e5e3d0bd709f9b8f3b8700a10fbd213db2cce6a
|
|
4
|
+
data.tar.gz: 85e14d31652d27fe8189921dc6220d2974ed4761e54fcaecce8531797cfd412c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cc3ee88a1189859357ec0b782bcabef1e47efb37dafeb0c759d48bc509de883facecd0e3dbe8404a432ecd0bed614a80fff72561fb11e9568fb19540b04de762
|
|
7
|
+
data.tar.gz: 4448aa73525211e191755873caf1ac1cac04f695a33d925855c654e193f9e4cf433c9c451362c97ff57c098f18306b9118bd8d97c2449f6184141b748b6ddc2b
|
|
@@ -5,14 +5,22 @@ module TreezorConnect
|
|
|
5
5
|
attr_reader :access_token
|
|
6
6
|
|
|
7
7
|
def initialize(access_token)
|
|
8
|
-
@conn = build_default_conn
|
|
9
8
|
@access_token = access_token.nil? ? default_access_token : access_token
|
|
9
|
+
@conn = Faraday.new(
|
|
10
|
+
url: TreezorConnect.api_base_url,
|
|
11
|
+
headers: { 'Authorization' => "Bearer #{@access_token}" }
|
|
12
|
+
) do |f|
|
|
13
|
+
f.response :logger, Logger.new($stdout) if ENV['ENABLE_HTTP_LOGGING']
|
|
14
|
+
f.adapter Faraday.default_adapter
|
|
15
|
+
end
|
|
10
16
|
end
|
|
11
17
|
|
|
12
18
|
def execute_request(method, path, headers: {}, params: {})
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
19
|
+
response = conn.public_send(method, path) do |req|
|
|
20
|
+
req.headers.merge!(headers)
|
|
21
|
+
req.params.merge!(params[:query]) if params[:query]
|
|
22
|
+
apply_body(req, params)
|
|
23
|
+
end
|
|
16
24
|
|
|
17
25
|
process_response(response)
|
|
18
26
|
end
|
|
@@ -21,11 +29,14 @@ module TreezorConnect
|
|
|
21
29
|
|
|
22
30
|
attr_reader :conn
|
|
23
31
|
|
|
24
|
-
def
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
32
|
+
def apply_body(req, params)
|
|
33
|
+
if params[:form]
|
|
34
|
+
req.headers['Content-Type'] = 'application/x-www-form-urlencoded'
|
|
35
|
+
req.body = URI.encode_www_form(params[:form])
|
|
36
|
+
elsif params[:body]
|
|
37
|
+
req.headers['Content-Type'] = 'application/json'
|
|
38
|
+
req.body = params[:body].to_json
|
|
39
|
+
end
|
|
29
40
|
end
|
|
30
41
|
|
|
31
42
|
def oauth_client
|
|
@@ -41,13 +52,12 @@ module TreezorConnect
|
|
|
41
52
|
end
|
|
42
53
|
|
|
43
54
|
def process_response(response)
|
|
44
|
-
|
|
45
|
-
if http_status.success?
|
|
55
|
+
if response.success?
|
|
46
56
|
response
|
|
47
|
-
elsif
|
|
57
|
+
elsif response.status == 303
|
|
48
58
|
raise AlreadyCreatedError, response
|
|
49
59
|
else
|
|
50
|
-
raise_api_error(http_status
|
|
60
|
+
raise_api_error(http_status: response.status, http_body: JSON.parse(response.body))
|
|
51
61
|
end
|
|
52
62
|
end
|
|
53
63
|
|
data/lib/treezor_connect.rb
CHANGED
metadata
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: treezor_connect
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.21.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- stefakins
|
|
8
8
|
- jbauzone
|
|
9
|
-
autorequire:
|
|
10
9
|
bindir: bin
|
|
11
10
|
cert_chain: []
|
|
12
|
-
date: 2026-06-
|
|
11
|
+
date: 2026-06-08 00:00:00.000000000 Z
|
|
13
12
|
dependencies: []
|
|
14
13
|
description: A gem for making HTTP calls to Treezor Connect.
|
|
15
14
|
email: stefan.atkinson69@gmail.com
|
|
@@ -52,7 +51,6 @@ licenses:
|
|
|
52
51
|
- MIT
|
|
53
52
|
metadata:
|
|
54
53
|
rubygems_mfa_required: 'true'
|
|
55
|
-
post_install_message:
|
|
56
54
|
rdoc_options: []
|
|
57
55
|
require_paths:
|
|
58
56
|
- lib
|
|
@@ -60,15 +58,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
60
58
|
requirements:
|
|
61
59
|
- - ">="
|
|
62
60
|
- !ruby/object:Gem::Version
|
|
63
|
-
version: 3.1.4
|
|
61
|
+
version: 3.1.4
|
|
64
62
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
65
63
|
requirements:
|
|
66
64
|
- - ">="
|
|
67
65
|
- !ruby/object:Gem::Version
|
|
68
66
|
version: '0'
|
|
69
67
|
requirements: []
|
|
70
|
-
rubygems_version: 3.
|
|
71
|
-
signing_key:
|
|
68
|
+
rubygems_version: 3.6.5
|
|
72
69
|
specification_version: 4
|
|
73
70
|
summary: A gem for making HTTP calls to Treezor Connect.
|
|
74
71
|
test_files: []
|