Skip to content

Commit 002a3ee

Browse files
committed
Generate and move BalanceControl
1 parent ae4c671 commit 002a3ee

File tree

5 files changed

+45
-14
lines changed

5 files changed

+45
-14
lines changed

lib/adyen-ruby-api-library.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
require_relative 'adyen/services/transfers'
1919
require_relative 'adyen/services/management'
2020
require_relative 'adyen/services/storedValue'
21-
require_relative 'adyen/services/balanceControlService'
2221
require_relative 'adyen/services/terminalCloudAPI'
2322
require_relative 'adyen/services/posMobile'
2423
require_relative 'adyen/services/openBanking'
2524
require_relative 'adyen/services/sessionAuthentication'
25+
require_relative 'adyen/services/balanceControl'
2626

lib/adyen/client.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def service_url_base(service)
7676
when 'Account', 'Fund', 'Notification', 'Hop'
7777
url = "https://cal-#{@env}.adyen.com/cal/services/#{service}"
7878
supports_live_url_prefix = false
79-
when 'Recurring', 'Payment', 'Payout', 'BinLookup', 'StoredValue', 'BalanceControlService'
79+
when 'Recurring', 'Payment', 'Payout', 'BinLookup', 'StoredValue', 'BalanceControl'
8080
url = "https://pal-#{@env}.adyen.com/pal/servlet/#{service}"
8181
supports_live_url_prefix = true
8282
when 'PosTerminalManagement'
@@ -292,10 +292,6 @@ def stored_value
292292
@stored_value ||= Adyen::StoredValue.new(self)
293293
end
294294

295-
def balance_control_service
296-
@balance_control_service ||= Adyen::BalanceControlService.new(self)
297-
end
298-
299295
def terminal_cloud_api
300296
@terminal_cloud_api ||= Adyen::TerminalCloudAPI.new(self)
301297
end
@@ -312,6 +308,11 @@ def session_authentication
312308
@open_banking ||= Adyen::SessionAuthentication.new(self)
313309
end
314310

311+
def balance_control
312+
@balance_control ||= Adyen::BalanceControl.new(self)
313+
end
314+
315+
315316
private
316317

317318
def auth_header(auth_type, faraday)

lib/adyen/services/balanceControlService.rb renamed to lib/adyen/services/balanceControl.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
require_relative 'balanceControlService/balance_control_api'
1+
require_relative 'balanceControl/balance_control_api'
22

33
module Adyen
44

55
# NOTE: This class is auto generated by OpenAPI Generator
66
# Ref: https://openapi-generator.tech
77
#
88
# Do not edit the class manually.
9-
class BalanceControlService
9+
class BalanceControl
1010
attr_accessor :service, :version
1111

1212
DEFAULT_VERSION = 1
1313
def initialize(client, version = DEFAULT_VERSION)
14-
@service = 'BalanceControlService'
14+
@service = 'BalanceControl'
1515
@client = client
1616
@version = version
1717
end
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
require_relative '../service'
2+
module Adyen
3+
4+
# NOTE: This class is auto generated by OpenAPI Generator
5+
# Ref: https://openapi-generator.tech
6+
#
7+
# Do not edit the class manually.
8+
class BalanceControlApi < Service
9+
attr_accessor :service, :version
10+
11+
def initialize(client, version = DEFAULT_VERSION)
12+
super(client, version, 'BalanceControl')
13+
end
14+
15+
# Start a balance transfer
16+
#
17+
# Deprecated since Adyen Balance Control API v1
18+
def balance_transfer(request, headers: {})
19+
endpoint = '/balanceTransfer'.gsub(/{.+?}/, '%s')
20+
endpoint = endpoint.gsub(%r{^/}, '')
21+
endpoint = format(endpoint)
22+
23+
action = { method: 'post', url: endpoint }
24+
@client.call_adyen_api(@service, action, request, headers, @version)
25+
end
26+
27+
end
28+
end

spec/balance_control_spec.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
require 'spec_helper'
22
require 'json'
33

4-
RSpec.describe Adyen::BalancePlatform, service: 'balancePlatform' do
4+
RSpec.describe Adyen::BalanceControl, service: 'balanceControl' do
55
before(:all) do
66
@shared_values = {
77
client: create_client(:api_key),
8-
service: 'BalancePlatform'
8+
service: 'BalanceControl'
99
}
1010
end
1111

@@ -15,8 +15,10 @@
1515

1616
response_body = json_from_file('mocks/responses/BalanceControl/balance_transfer.json')
1717

18-
url = @shared_values[:client].service_url(@shared_values[:service], 'balanceTransfer',
19-
@shared_values[:client].balance_control_service.version)
18+
url = @shared_values[:client].service_url(
19+
@shared_values[:service],
20+
'balanceTransfer',
21+
@shared_values[:client].balance_control.version)
2022
WebMock.stub_request(:post, url)
2123
.with(
2224
body: request_body,
@@ -28,7 +30,7 @@
2830
body: response_body
2931
)
3032

31-
result = @shared_values[:client].balance_control_service.balance_control_api.balance_transfer(request_body)
33+
result = @shared_values[:client].balance_control.balance_control_api.balance_transfer(request_body)
3234
response_hash = result.response
3335

3436
expect(result.status)

0 commit comments

Comments
 (0)