treezor_connect 0.12.0 → 0.14.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be8521db96d02266f7a596240f39cc17d8741613f004908be4be1e9a13bf3e4b
|
4
|
+
data.tar.gz: 3c6b31cfa4998d21f4d391d4881105e8af007c3856333a18f342bf74ebb5a8d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1ea75968193a6c2d07d40b70eab44b2667d07a39a7370d70d798278a215b1a6e36bed58052634387b3d2204419972aef127b3c8f33e63a4caf8fb80f0d722690
|
7
|
+
data.tar.gz: eb4320448da51e60b853d5e4a9ca5d94412933db2ab9d0f39602e63b4867755b654fcce31773ce66cdf5c01baaf6c08e7d9d1d30f7307f3a11a22ea0d695e270
|
@@ -11,13 +11,13 @@ module TreezorConnect
|
|
11
11
|
'on its subclasses (Payin, Payout, Transfer ...)'
|
12
12
|
end
|
13
13
|
|
14
|
-
def custom_action(http_method, *actions, ignores_id: false)
|
14
|
+
def custom_action(http_method, *actions, ignores_id: false, first_letter_upcased: false)
|
15
15
|
actions.each do |action|
|
16
16
|
case http_method
|
17
17
|
when :post
|
18
|
-
define_method_with_params(http_method, action)
|
18
|
+
define_method_with_params(http_method, action, first_letter_upcased)
|
19
19
|
when :put, :patch
|
20
|
-
define_put_path_methods(http_method, action, ignores_id)
|
20
|
+
define_put_path_methods(http_method, action, ignores_id, first_letter_upcased)
|
21
21
|
else
|
22
22
|
raise ArgumentError, "Unsupported HTTP method: #{http_method}"
|
23
23
|
end
|
@@ -26,42 +26,42 @@ module TreezorConnect
|
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
-
def define_method_with_params(http_method, action)
|
29
|
+
def define_method_with_params(http_method, action, first_letter_upcased)
|
30
30
|
define_singleton_method(action) do |params = {}, access_token = nil|
|
31
|
-
url = build_url(action)
|
31
|
+
url = build_url(action, first_letter_upcased)
|
32
32
|
response = request(http_method, url, params: { body: params }, access_token:)
|
33
33
|
process_response(response)
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
-
def define_put_path_methods(http_method, action, ignores_id)
|
37
|
+
def define_put_path_methods(http_method, action, ignores_id, first_letter_upcased)
|
38
38
|
if ignores_id
|
39
|
-
define_method_without_id_and_params(http_method, action)
|
39
|
+
define_method_without_id_and_params(http_method, action, first_letter_upcased)
|
40
40
|
else
|
41
|
-
define_method_with_id_and_params(http_method, action)
|
41
|
+
define_method_with_id_and_params(http_method, action, first_letter_upcased)
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
def define_method_with_id_and_params(http_method, action)
|
45
|
+
def define_method_with_id_and_params(http_method, action, first_letter_upcased)
|
46
46
|
define_singleton_method(action) do |id, params = {}, access_token = nil|
|
47
|
-
url = build_url(action, id)
|
47
|
+
url = build_url(action, first_letter_upcased, id)
|
48
48
|
response = request(http_method, url, params: { body: params }, access_token:)
|
49
49
|
process_response(response)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
def define_method_without_id_and_params(http_method, action)
|
53
|
+
def define_method_without_id_and_params(http_method, action, first_letter_upcased)
|
54
54
|
define_singleton_method(action) do |params = {}, access_token = nil|
|
55
|
-
url = build_url(action)
|
55
|
+
url = build_url(action, first_letter_upcased)
|
56
56
|
response = request(http_method, url, params: { body: params }, access_token:)
|
57
57
|
process_response(response)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
def build_url(action, id = nil)
|
61
|
+
def build_url(action, first_letter_upcased, id = nil)
|
62
62
|
parts = [resource_url]
|
63
63
|
parts << id if id
|
64
|
-
parts << camelize(action.to_s)
|
64
|
+
parts << camelize(action.to_s, capitalize_first_letter: first_letter_upcased)
|
65
65
|
parts.join('/')
|
66
66
|
end
|
67
67
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TreezorConnect
|
4
|
+
class Card < ApiResource
|
5
|
+
custom_action :put, :lock_unlock, first_letter_upcased: true
|
6
|
+
|
7
|
+
OBJECT_NAME = 'card'
|
8
|
+
OBJECT_KEY = 'cards'
|
9
|
+
OBJECT_PRIMARY_KEY = 'cardId'
|
10
|
+
|
11
|
+
def self.resource_url
|
12
|
+
'/v1/cards'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TreezorConnect
|
4
|
+
class User < ApiResource
|
5
|
+
extend TreezorConnect::ApiOperations::Update
|
6
|
+
|
7
|
+
OBJECT_NAME = 'user'
|
8
|
+
OBJECT_KEY = 'users'
|
9
|
+
OBJECT_PRIMARY_KEY = 'userId'
|
10
|
+
|
11
|
+
def self.resource_url
|
12
|
+
'/v1/users'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -1,9 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'treezor_connect/resources/beneficiary'
|
4
|
+
require 'treezor_connect/resources/card'
|
4
5
|
require 'treezor_connect/resources/card_image'
|
5
6
|
require 'treezor_connect/resources/payin'
|
6
7
|
require 'treezor_connect/resources/payout'
|
8
|
+
require 'treezor_connect/resources/user'
|
7
9
|
require 'treezor_connect/resources/oauth/token'
|
8
10
|
require 'treezor_connect/resources/sca/external_operation'
|
9
11
|
require 'treezor_connect/resources/sca/passcode'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: treezor_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.14.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- stefakins
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-12-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A gem for making HTTP calls to Treezor Connect.
|
15
15
|
email: stefan.atkinson69@gmail.com
|
@@ -29,6 +29,7 @@ files:
|
|
29
29
|
- lib/treezor_connect/errors.rb
|
30
30
|
- lib/treezor_connect/resources.rb
|
31
31
|
- lib/treezor_connect/resources/beneficiary.rb
|
32
|
+
- lib/treezor_connect/resources/card.rb
|
32
33
|
- lib/treezor_connect/resources/card_image.rb
|
33
34
|
- lib/treezor_connect/resources/oauth/token.rb
|
34
35
|
- lib/treezor_connect/resources/payin.rb
|
@@ -38,6 +39,7 @@ files:
|
|
38
39
|
- lib/treezor_connect/resources/sca/wallet.rb
|
39
40
|
- lib/treezor_connect/resources/sct_inst/payin.rb
|
40
41
|
- lib/treezor_connect/resources/sct_inst/recall.rb
|
42
|
+
- lib/treezor_connect/resources/user.rb
|
41
43
|
- lib/treezor_connect/treezor_object.rb
|
42
44
|
- lib/treezor_connect/treezor_response.rb
|
43
45
|
- lib/treezor_connect/util.rb
|