diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index 0e632c42..ec0c8a4a 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1011 \ No newline at end of file +v1013 \ No newline at end of file diff --git a/test/stripe/api_resource_test.rb b/test/stripe/api_resource_test.rb index 1530549a..82974f6c 100644 --- a/test/stripe/api_resource_test.rb +++ b/test/stripe/api_resource_test.rb @@ -187,6 +187,18 @@ module Stripe ch = Stripe::Charge.retrieve("ch_123", "sk_test_local") ch.refunds.create end + + should "use the per-object credential when making subsequent requests on the object" do + stub_request(:get, "#{Stripe.api_base}/v1/customers/cus_123") + .with(headers: { "Authorization" => "Bearer sk_test_local", "Stripe-Account" => "acct_12345" }) + .to_return(body: JSON.generate(charge_fixture)) + stub_request(:delete, "#{Stripe.api_base}/v1/customers/cus_123") + .with(headers: { "Authorization" => "Bearer sk_test_local", "Stripe-Account" => "acct_12345" }) + .to_return(body: "{}") + + cus = Stripe::Customer.retrieve("cus_123", { api_key: "sk_test_local", stripe_account: "acct_12345" }) + cus.delete + end end end diff --git a/test/stripe/list_object_test.rb b/test/stripe/list_object_test.rb index ccbaff0e..7debc8bf 100644 --- a/test/stripe/list_object_test.rb +++ b/test/stripe/list_object_test.rb @@ -109,6 +109,28 @@ module Stripe assert_equal expected, list.auto_paging_each.to_a end + should "forward api key through #auto_paging_iter" do + arr = [ + { id: "ch_001" }, + { id: "ch_002" }, + ] + expected = Util.convert_to_stripe_object(arr, {}) + + stub_request(:get, "#{Stripe.api_base}/v1/charges") + .with(headers: { "Authorization" => "Bearer sk_test_iter_forwards_options" }) + .to_return(body: JSON.generate(data: [{ id: "ch_001" }], has_more: true, url: "/v1/charges", + object: "list")) + stub_request(:get, "#{Stripe.api_base}/v1/charges") + .with(headers: { "Authorization" => "Bearer sk_test_iter_forwards_options" }) + .with(query: { starting_after: "ch_001" }) + .to_return(body: JSON.generate(data: [{ id: "ch_002" }], has_more: false, url: "/v1/charges", + object: "list")) + + list = Stripe::Charge.list({}, { api_key: "sk_test_iter_forwards_options" }) + + assert_equal expected, list.auto_paging_each.to_a + end + should "provide #auto_paging_each that responds to a block" do arr = [ { id: 1 },