Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[codegen] Add support for retrieve source transaction API method #889

Merged
merged 2 commits into from
Jan 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/stripe/resources/source.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ class Source < APIResource

custom_method :verify, http_verb: :post

nested_resource_class_methods :source_transaction, operations: %i[list]
nested_resource_class_methods :source_transaction,
operations: %i[retrieve list]

def verify(params = {}, opts = {})
request_stripe_object(
Expand Down
28 changes: 28 additions & 0 deletions test/stripe/source_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,33 @@ class SourceTest < Test::Unit::TestCase
assert source.is_a?(Stripe::Source)
end
end

context ".retrieve_source_transaction" do
should "retrieve a source transaction" do
Stripe::Source.retrieve_source_transaction(
"src_123",
"srctxn_123"
)
assert_requested :get, "#{Stripe.api_base}/v1/sources/src_123/source_transactions/srctxn_123"
end
end

context ".list_source_transactions" do
should "list source transactions" do
Stripe::Source.list_source_transactions(
"src_123"
)
assert_requested :get, "#{Stripe.api_base}/v1/sources/src_123/source_transactions"
end
end

context "#source_transactions" do
should "list source transactions" do
source = Stripe::Source.construct_from(id: "src_123",
object: "source")
source.source_transactions
assert_requested :get, "#{Stripe.api_base}/v1/sources/src_123/source_transactions"
end
end
end
end
27 changes: 0 additions & 27 deletions test/stripe/source_transaction_test.rb

This file was deleted.