Skip to content

Commit

Permalink
Add support for the SetupAttempt resource and List API (#949)
Browse files Browse the repository at this point in the history
* Codegen for openapi 3854362

* Fix and add tests
  • Loading branch information
remi-stripe committed Sep 30, 2020
1 parent eb84249 commit 29f321b
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
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
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
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
@@ -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
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
@@ -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
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

0 comments on commit 29f321b

Please sign in to comment.