From 3eaf6baa0ef67c9e5b8569ee62d6092e070a1b6b Mon Sep 17 00:00:00 2001 From: ankitdas13 Date: Mon, 27 May 2024 12:15:36 +0530 Subject: [PATCH] removed chaining --- documents/transfers.md | 2 +- lib/razorpay/transfer.rb | 4 ++-- test/razorpay/test_transfer.rb | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/documents/transfers.md b/documents/transfers.md index 1540dd1..4a4d7c2 100644 --- a/documents/transfers.md +++ b/documents/transfers.md @@ -778,7 +778,7 @@ Razorpay::Transfer.fetch(transferId).edit(para_attr) ### Fetch Reversals for a Transfer ```rb transferId = "trf_JhemwjNekar9Za" -Razorpay::Transfer.fetch(transferId).reversals +Razorpay::Transfer.reversals(transferId) ``` **Parameters:** diff --git a/lib/razorpay/transfer.rb b/lib/razorpay/transfer.rb index 87a0246..690657b 100644 --- a/lib/razorpay/transfer.rb +++ b/lib/razorpay/transfer.rb @@ -32,8 +32,8 @@ def self.fetch_settlements request.get "?expand[]=recipient_settlement" end - def reversals - self.class.request.get "#{id}/reversals" + def self.reversals(id) + request.get "#{id}/reversals" end end end diff --git a/test/razorpay/test_transfer.rb b/test/razorpay/test_transfer.rb index 37cf051..52a29f7 100644 --- a/test/razorpay/test_transfer.rb +++ b/test/razorpay/test_transfer.rb @@ -76,7 +76,7 @@ def test_transfer_direct_transfer def test_fetch_reversals stub_get(%r{/transfers/#{@transfer_id}/reversals$}, 'reversals_collection') - transfer = Razorpay::Transfer.fetch(@transfer_id).reversals + transfer = Razorpay::Transfer.reversals(@transfer_id) assert_instance_of Razorpay::Collection, transfer , 'Transfer should be an array' refute_empty transfer.items , 'Transfer should be more than one' end @@ -84,7 +84,7 @@ def test_fetch_reversals def test_fetch_reversals_exception stub_get(%r{/transfers/#{@transfer_id}/reversals$}, 'transfer_error') assert_raises(Razorpay::Error) do - transfer = Razorpay::Transfer.fetch(@transfer_id).reversals + transfer = Razorpay::Transfer.reversals(@transfer_id) if transfer.error raise Razorpay::Error.new, transfer.error['code'] end