diff --git a/lib/gocardless_pro/client.rb b/lib/gocardless_pro/client.rb index 1b1672b..157bcd6 100644 --- a/lib/gocardless_pro/client.rb +++ b/lib/gocardless_pro/client.rb @@ -218,7 +218,7 @@ def default_options 'User-Agent' => "#{user_agent}", 'Content-Type' => 'application/json', 'GoCardless-Client-Library' => 'gocardless-pro-ruby', - 'GoCardless-Client-Version' => '2.51.0', + 'GoCardless-Client-Version' => '2.52.0', }, } end diff --git a/lib/gocardless_pro/resources/transferred_mandate.rb b/lib/gocardless_pro/resources/transferred_mandate.rb index fa863e4..55b437a 100644 --- a/lib/gocardless_pro/resources/transferred_mandate.rb +++ b/lib/gocardless_pro/resources/transferred_mandate.rb @@ -12,19 +12,19 @@ module Resources # Mandates that have been transferred using Current Account Switch Service class TransferredMandate - attr_reader :encrypted_data - attr_reader :key - attr_reader :kid + attr_reader :encrypted_customer_bank_details + attr_reader :encrypted_decryption_key + attr_reader :public_key_id # Initialize a transferred_mandate resource instance # @param object [Hash] an object returned from the API def initialize(object, response = nil) @object = object - @encrypted_data = object['encrypted_data'] - @key = object['key'] - @kid = object['kid'] + @encrypted_customer_bank_details = object['encrypted_customer_bank_details'] + @encrypted_decryption_key = object['encrypted_decryption_key'] @links = object['links'] + @public_key_id = object['public_key_id'] @response = response end diff --git a/lib/gocardless_pro/services/transferred_mandates_service.rb b/lib/gocardless_pro/services/transferred_mandates_service.rb index 4357793..6dac69d 100644 --- a/lib/gocardless_pro/services/transferred_mandates_service.rb +++ b/lib/gocardless_pro/services/transferred_mandates_service.rb @@ -10,14 +10,15 @@ module GoCardlessPro module Services # Service for making requests to the TransferredMandate endpoints class TransferredMandatesService < BaseService - # Returns encrypted bank details for the transferred mandate - # Example URL: /transferred_mandate/:identity + # Returns new customer bank details for a mandate that's been recently + # transferred + # Example URL: /transferred_mandates/:identity # # @param identity # Unique identifier, beginning with "MD". Note that this prefix may not # apply to mandates created before 2016. # @param options [Hash] parameters as a hash, under a params key. def transferred_mandates(identity, options = {}) - path = sub_url('/transferred_mandate/:identity', { + path = sub_url('/transferred_mandates/:identity', { 'identity' => identity, }) @@ -41,7 +42,7 @@ def unenvelope_body(body) # return the key which API responses will envelope data under def envelope_key - 'transferred_mandate' + 'transferred_mandates' end end end diff --git a/lib/gocardless_pro/version.rb b/lib/gocardless_pro/version.rb index c1ffa13..da48c03 100644 --- a/lib/gocardless_pro/version.rb +++ b/lib/gocardless_pro/version.rb @@ -3,5 +3,5 @@ module GoCardlessPro module GoCardlessPro # Current version of the GC gem - VERSION = '2.51.0' + VERSION = '2.52.0' end diff --git a/spec/resources/transferred_mandate_spec.rb b/spec/resources/transferred_mandate_spec.rb index 66f80bf..54f7562 100644 --- a/spec/resources/transferred_mandate_spec.rb +++ b/spec/resources/transferred_mandate_spec.rb @@ -15,16 +15,16 @@ let(:resource_id) { 'ABC123' } let!(:stub) do - # /transferred_mandate/%v - stub_url = '/transferred_mandate/:identity'.gsub(':identity', resource_id) + # /transferred_mandates/%v + stub_url = '/transferred_mandates/:identity'.gsub(':identity', resource_id) stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( body: { - 'transferred_mandate' => { + 'transferred_mandates' => { - 'encrypted_data' => 'encrypted_data-input', - 'key' => 'key-input', - 'kid' => 'kid-input', + 'encrypted_customer_bank_details' => 'encrypted_customer_bank_details-input', + 'encrypted_decryption_key' => 'encrypted_decryption_key-input', 'links' => 'links-input', + 'public_key_id' => 'public_key_id-input', }, }.to_json, @@ -46,20 +46,20 @@ let(:resource_id) { 'ABC123' } let!(:stub) do - # /transferred_mandate/%v - stub_url = '/transferred_mandate/:identity'.gsub(':identity', resource_id) + # /transferred_mandates/%v + stub_url = '/transferred_mandates/:identity'.gsub(':identity', resource_id) stub_request(:get, /.*api.gocardless.com#{stub_url}/). with( body: { foo: 'bar' }, headers: { 'Foo' => 'Bar' } ).to_return( body: { - 'transferred_mandate' => { + 'transferred_mandates' => { - 'encrypted_data' => 'encrypted_data-input', - 'key' => 'key-input', - 'kid' => 'kid-input', + 'encrypted_customer_bank_details' => 'encrypted_customer_bank_details-input', + 'encrypted_decryption_key' => 'encrypted_decryption_key-input', 'links' => 'links-input', + 'public_key_id' => 'public_key_id-input', }, }.to_json, headers: response_headers diff --git a/spec/services/transferred_mandates_service_spec.rb b/spec/services/transferred_mandates_service_spec.rb index 3064ef9..3d78d3f 100644 --- a/spec/services/transferred_mandates_service_spec.rb +++ b/spec/services/transferred_mandates_service_spec.rb @@ -15,16 +15,16 @@ let(:resource_id) { 'ABC123' } let!(:stub) do - # /transferred_mandate/%v - stub_url = '/transferred_mandate/:identity'.gsub(':identity', resource_id) + # /transferred_mandates/%v + stub_url = '/transferred_mandates/:identity'.gsub(':identity', resource_id) stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( body: { - 'transferred_mandate' => { + 'transferred_mandates' => { - 'encrypted_data' => 'encrypted_data-input', - 'key' => 'key-input', - 'kid' => 'kid-input', + 'encrypted_customer_bank_details' => 'encrypted_customer_bank_details-input', + 'encrypted_decryption_key' => 'encrypted_decryption_key-input', 'links' => 'links-input', + 'public_key_id' => 'public_key_id-input', }, }.to_json, @@ -40,7 +40,7 @@ describe 'retry behaviour' do it "doesn't retry errors" do - stub_url = '/transferred_mandate/:identity'.gsub(':identity', resource_id) + stub_url = '/transferred_mandates/:identity'.gsub(':identity', resource_id) stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/). to_timeout @@ -57,20 +57,20 @@ let(:resource_id) { 'ABC123' } let!(:stub) do - # /transferred_mandate/%v - stub_url = '/transferred_mandate/:identity'.gsub(':identity', resource_id) + # /transferred_mandates/%v + stub_url = '/transferred_mandates/:identity'.gsub(':identity', resource_id) stub_request(:get, /.*api.gocardless.com#{stub_url}/). with( body: { foo: 'bar' }, headers: { 'Foo' => 'Bar' } ).to_return( body: { - 'transferred_mandate' => { + 'transferred_mandates' => { - 'encrypted_data' => 'encrypted_data-input', - 'key' => 'key-input', - 'kid' => 'kid-input', + 'encrypted_customer_bank_details' => 'encrypted_customer_bank_details-input', + 'encrypted_decryption_key' => 'encrypted_decryption_key-input', 'links' => 'links-input', + 'public_key_id' => 'public_key_id-input', }, }.to_json, headers: response_headers