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

Add support for the SetupAttempt resource and List API #949

Merged
merged 2 commits into from
Sep 30, 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
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ notifications:
env:
global:
# If changing this number, please also change it in `test/test_helper.rb`.
- STRIPE_MOCK_VERSION=0.98.0
- STRIPE_MOCK_VERSION=0.99.0

cache:
directories:
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/object_types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def self.object_names_to_classes
Reversal::OBJECT_NAME => Reversal,
Review::OBJECT_NAME => Review,
SKU::OBJECT_NAME => SKU,
SetupAttempt::OBJECT_NAME => SetupAttempt,
SetupIntent::OBJECT_NAME => SetupIntent,
Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
Source::OBJECT_NAME => Source,
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/resources.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
require "stripe/resources/reporting/report_type"
require "stripe/resources/reversal"
require "stripe/resources/review"
require "stripe/resources/setup_attempt"
require "stripe/resources/setup_intent"
require "stripe/resources/sigma/scheduled_query_run"
require "stripe/resources/sku"
Expand Down
10 changes: 10 additions & 0 deletions lib/stripe/resources/setup_attempt.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
class SetupAttempt < APIResource
extend Stripe::APIOperations::List

OBJECT_NAME = "setup_attempt"
end
end
3 changes: 1 addition & 2 deletions test/stripe/product_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ class ProductTest < Test::Unit::TestCase

should "be creatable" do
product = Stripe::Product.create(
name: "My Product",
type: "good"
name: "My Product"
)
assert_requested :post, "#{Stripe.api_base}/v1/products"
assert product.is_a?(Stripe::Product)
Expand Down
16 changes: 16 additions & 0 deletions test/stripe/setup_attempt_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# frozen_string_literal: true

require ::File.expand_path("../test_helper", __dir__)

module Stripe
class SetupAttemptTest < Test::Unit::TestCase
should "be listable" do
setup_attempts = Stripe::SetupAttempt.list({
setup_intent: "seti_123",
})
assert_requested :get, "#{Stripe.api_base}/v1/setup_attempts?setup_intent=seti_123"
assert setup_attempts.data.is_a?(Array)
assert setup_attempts.data[0].is_a?(Stripe::SetupAttempt)
end
end
end
2 changes: 1 addition & 1 deletion test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
require ::File.expand_path("stripe_mock", __dir__)

# If changing this number, please also change it in `.travis.yml`.
MOCK_MINIMUM_VERSION = "0.98.0"
MOCK_MINIMUM_VERSION = "0.99.0"
MOCK_PORT = Stripe::StripeMock.start

# Disable all real network connections except those that are outgoing to
Expand Down