treezor_connect 0.11.0 → 0.13.0

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: 63c5794ec9d2eb6adc033b8c7f563e18d1720a1082a8f4cd48fc71b8f3234107
4
- data.tar.gz: fabdb2ac3bc884fc68b7d6ca8676edddde2ca1d5079766bada6ecbd65b7bd954
3
+ metadata.gz: 9e8705aa0d14cb9eb9929d8f1c0b18787cf8098e99e013eeb36babe224009784
4
+ data.tar.gz: e68aaa3d37d5bc6e02de082262104cbccadcdb860504d2152fe32f4c9c253c06
5
5
  SHA512:
6
- metadata.gz: a37966bf58f58ce4890abba4be4f493d65bababdd6d06aaf478d93e1525a8bc4b1c5a22dfce7db170875bf6d25b34d45a1d93bf67befdf3074fe7f6ef180bb18
7
- data.tar.gz: d26117045344203af284241313e53b8fc527bc2bdb4dcae60c0e8d0d4e7e88f09fdfc41d74f3d8cf82993d259a7d2f628771b59e6e4008780b6293ba39b8e73a
6
+ metadata.gz: c809989d08406c0872f23c2c922a758c106961285afdcb1cc9a7ba418413e18cac7000bd1b86be77b5bc7a1abfd102223e3f63392028b68ae58727e85bd8f50e
7
+ data.tar.gz: b811ea9eae971c3f1987f71240e6ab25fe1d2b7e35b06341904e93a3f7561f96ca249ca44e612461363334a0b6d97b824d47f1cbfc492cff98f4dd6fe8b34068
@@ -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 Payout < ApiResource
5
+ extend TreezorConnect::ApiOperations::Create
6
+
7
+ OBJECT_NAME = 'payout'
8
+ OBJECT_KEY = 'payouts'
9
+ OBJECT_PRIMARY_KEY = 'payoutId'
10
+
11
+ def self.resource_url
12
+ '/v1/payouts'
13
+ end
14
+ end
15
+ end
@@ -1,8 +1,10 @@
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'
7
+ require 'treezor_connect/resources/payout'
6
8
  require 'treezor_connect/resources/oauth/token'
7
9
  require 'treezor_connect/resources/sca/external_operation'
8
10
  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.11.0
4
+ version: 0.13.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-11-13 00:00:00.000000000 Z
12
+ date: 2024-11-28 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,9 +29,11 @@ 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
36
+ - lib/treezor_connect/resources/payout.rb
35
37
  - lib/treezor_connect/resources/sca/external_operation.rb
36
38
  - lib/treezor_connect/resources/sca/passcode.rb
37
39
  - lib/treezor_connect/resources/sca/wallet.rb