diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af023413..2fe900f4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,16 +20,17 @@ on: jobs: build: name: Build - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: + - uses: extractions/setup-just@v2 - uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 with: ruby-version: 3.1 - name: Lint - run: bundle install && bundle exec rake rubocop + run: just lint - name: Build run: gem build stripe.gemspec - name: 'Upload Artifact' @@ -40,12 +41,13 @@ jobs: test: name: Test (${{ matrix.ruby-version }}) - # this is needed because our JRuby test version isnt supported on ubuntu-24 (which is now ubuntu-latest) + # this version of jruby isn't available in the new latest (24.04) so we have to pin (or update jruby) runs-on: ubuntu-22.04 strategy: matrix: ruby-version: [2.3, 2.4, 2.5, 2.6, 2.7, '3.0', 3.1, 3.2, '3.3', jruby-9.4.0.0, truffleruby-head] steps: + - uses: extractions/setup-just@v2 - uses: actions/checkout@v3 - name: Set up Ruby uses: ruby/setup-ruby@v1 @@ -53,7 +55,7 @@ jobs: ruby-version: ${{ matrix.ruby-version }} - uses: stripe/openapi/actions/stripe-mock@master - name: test - run: make ci-test + run: just test typecheck env: GITHUB_TOKEN: ${{ secrets.github_token }} @@ -64,7 +66,7 @@ jobs: startsWith(github.ref, 'refs/tags/v') && endsWith(github.actor, '-stripe') needs: [build, test] - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Download all workflow run artifacts uses: actions/download-artifact@v4 diff --git a/Makefile b/Makefile index cc7d150f..218187cf 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +# NOTE: this file is deprecated and slated for deletion; prefer using the equivalent `just` commands. + .PHONY: update-version codegen-format test ci-test update-version: @echo "$(VERSION)" > VERSION diff --git a/OPENAPI_VERSION b/OPENAPI_VERSION index fc039b0b..59bdaaed 100644 --- a/OPENAPI_VERSION +++ b/OPENAPI_VERSION @@ -1 +1 @@ -v1450 \ No newline at end of file +v1453 \ No newline at end of file diff --git a/README.md b/README.md index 121329af..a271ef82 100644 --- a/README.md +++ b/README.md @@ -364,19 +364,20 @@ New features and bug fixes are released on the latest major version of the Strip [Contribution guidelines for this project](CONTRIBUTING.md) -The test suite depends on [stripe-mock], so make sure to fetch and run it from a -background terminal ([stripe-mock's README][stripe-mock] also contains -instructions for installing via Homebrew and other methods): +The test suite depends on [stripe-mock], so make sure to fetch and run it from a background terminal ([stripe-mock's README][stripe-mock] also contains instructions for installing via Homebrew and other methods): ```sh go install github.com/stripe/stripe-mock@latest stripe-mock ``` +We use [just](https://github.com/casey/just) for common development tasks. You can install it or run the underlying commands directly (by copying them from the `justfile`). Common tasks include: + Run all tests: ```sh -bundle exec rake test +just test +# or: bundle exec rake test ``` Run a single test suite: @@ -394,13 +395,15 @@ bundle exec ruby -Ilib/ test/stripe/util_test.rb -n /should.convert.names.to.sym Run the linter: ```sh -bundle exec rake rubocop +just lint +# or: bundle exec rubocop ``` Update bundled CA certificates from the [Mozilla cURL release][curl]: ```sh -bundle exec rake update_certs +just update-certs +# or: bundle exec rake update_certs ``` Update the bundled [stripe-mock] by editing the version number found in diff --git a/Rakefile b/Rakefile index 44ae7a6c..b8646ef2 100644 --- a/Rakefile +++ b/Rakefile @@ -8,11 +8,6 @@ Rake::TestTask.new do |t| t.pattern = "./test/**/*_test.rb" end -if RUBY_VERSION >= "2.7.0" - require "rubocop/rake_task" - RuboCop::RakeTask.new -end - desc "Update bundled certs" task :update_certs do require "net/http" diff --git a/justfile b/justfile new file mode 100644 index 00000000..803a3f07 --- /dev/null +++ b/justfile @@ -0,0 +1,43 @@ +set quiet + +import? '../sdk-codegen/utils.just' + +_default: + just --list --unsorted + +install *args: + bundle install {{ if is_dependency() == "true" {"--quiet"} else {""} }} {{ args }} + +# ⭐ run all unit tests +test: install + bundle exec rake test + +# check linting / formatting status of files +format-check *args: install + bundle exec rubocop {{ args }} +alias lint-check := format-check + +# ⭐ check style & formatting for all files, fixing what we can +lint: (format-check "--autocorrect") + +# NOTE: "-o /dev/null" is vital - rubocop has super noisy output and codegen will crash when formatting ruby if everything gets printed +# so, we send all its output to the void +# copy of `lint` with less output +format: (format-check "-o /dev/null --autocorrect") + +update-certs: install + bundle exec rake update_certs + +# run sorbet to check type definitions +typecheck: install + {{ if semver_matches(`ruby -e "puts RUBY_VERSION"`, ">=2.7") == "true" { \ + "bundle exec srb tc" \ + } else { \ + "echo \"Ruby version < 2.7, skipping srb tc\"" \ + } }} + +# called by tooling +[private] +update-version version: + echo "{{ version }}" > VERSION + perl -pi -e 's|VERSION = "[.\-\w\d]+"|VERSION = "{{ version }}"|' lib/stripe/version.rb diff --git a/lib/stripe/resources/billing_portal/configuration.rb b/lib/stripe/resources/billing_portal/configuration.rb index 25f349a2..98c4f269 100644 --- a/lib/stripe/resources/billing_portal/configuration.rb +++ b/lib/stripe/resources/billing_portal/configuration.rb @@ -202,7 +202,7 @@ module Stripe attr_accessor :enabled # Whether to cancel subscriptions immediately or at the end of the billing period. attr_accessor :mode - # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. No prorations are generated when canceling a subscription at the end of its natural billing period. + # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period. attr_accessor :proration_behavior def initialize( @@ -410,7 +410,7 @@ module Stripe attr_accessor :enabled # Whether to cancel subscriptions immediately or at the end of the billing period. attr_accessor :mode - # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. No prorations are generated when canceling a subscription at the end of its natural billing period. + # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period. attr_accessor :proration_behavior def initialize( diff --git a/lib/stripe/resources/financial_connections/transaction.rb b/lib/stripe/resources/financial_connections/transaction.rb index 021e0e27..55be6c36 100644 --- a/lib/stripe/resources/financial_connections/transaction.rb +++ b/lib/stripe/resources/financial_connections/transaction.rb @@ -46,7 +46,7 @@ module Stripe @after = after end end - # The ID of the Stripe account whose transactions will be retrieved. + # The ID of the Financial Connections Account whose transactions will be retrieved. attr_accessor :account # A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. attr_accessor :ending_before diff --git a/lib/stripe/services/billing_portal/configuration_service.rb b/lib/stripe/services/billing_portal/configuration_service.rb index c0e9408a..5460ce61 100644 --- a/lib/stripe/services/billing_portal/configuration_service.rb +++ b/lib/stripe/services/billing_portal/configuration_service.rb @@ -100,7 +100,7 @@ module Stripe attr_accessor :enabled # Whether to cancel subscriptions immediately or at the end of the billing period. attr_accessor :mode - # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. No prorations are generated when canceling a subscription at the end of its natural billing period. + # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period. attr_accessor :proration_behavior def initialize( @@ -308,7 +308,7 @@ module Stripe attr_accessor :enabled # Whether to cancel subscriptions immediately or at the end of the billing period. attr_accessor :mode - # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. No prorations are generated when canceling a subscription at the end of its natural billing period. + # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period. attr_accessor :proration_behavior def initialize( diff --git a/lib/stripe/services/financial_connections/transaction_service.rb b/lib/stripe/services/financial_connections/transaction_service.rb index 299a9a06..1e2c0085 100644 --- a/lib/stripe/services/financial_connections/transaction_service.rb +++ b/lib/stripe/services/financial_connections/transaction_service.rb @@ -31,7 +31,7 @@ module Stripe @after = after end end - # The ID of the Stripe account whose transactions will be retrieved. + # The ID of the Financial Connections Account whose transactions will be retrieved. attr_accessor :account # A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. attr_accessor :ending_before diff --git a/rbi/stripe/resources/billing_portal/configuration.rbi b/rbi/stripe/resources/billing_portal/configuration.rbi index f42700b6..7b5c3e2e 100644 --- a/rbi/stripe/resources/billing_portal/configuration.rbi +++ b/rbi/stripe/resources/billing_portal/configuration.rbi @@ -252,7 +252,7 @@ module Stripe # Whether to cancel subscriptions immediately or at the end of the billing period. sig { returns(String) } attr_accessor :mode - # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. No prorations are generated when canceling a subscription at the end of its natural billing period. + # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period. sig { returns(String) } attr_accessor :proration_behavior sig { @@ -467,7 +467,7 @@ module Stripe # Whether to cancel subscriptions immediately or at the end of the billing period. sig { returns(String) } attr_accessor :mode - # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. No prorations are generated when canceling a subscription at the end of its natural billing period. + # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period. sig { returns(String) } attr_accessor :proration_behavior sig { diff --git a/rbi/stripe/resources/financial_connections/transaction.rbi b/rbi/stripe/resources/financial_connections/transaction.rbi index 19fdca64..a90eeaa9 100644 --- a/rbi/stripe/resources/financial_connections/transaction.rbi +++ b/rbi/stripe/resources/financial_connections/transaction.rbi @@ -74,7 +74,7 @@ module Stripe sig { params(after: String).void } def initialize(after: nil); end end - # The ID of the Stripe account whose transactions will be retrieved. + # The ID of the Financial Connections Account whose transactions will be retrieved. sig { returns(String) } attr_accessor :account # A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list. diff --git a/rbi/stripe/services/billing_portal/configuration_service.rbi b/rbi/stripe/services/billing_portal/configuration_service.rbi index 1834536f..cf973f89 100644 --- a/rbi/stripe/services/billing_portal/configuration_service.rbi +++ b/rbi/stripe/services/billing_portal/configuration_service.rbi @@ -99,7 +99,7 @@ module Stripe # Whether to cancel subscriptions immediately or at the end of the billing period. sig { returns(String) } attr_accessor :mode - # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. No prorations are generated when canceling a subscription at the end of its natural billing period. + # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period. sig { returns(String) } attr_accessor :proration_behavior sig { @@ -316,7 +316,7 @@ module Stripe # Whether to cancel subscriptions immediately or at the end of the billing period. sig { returns(String) } attr_accessor :mode - # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. No prorations are generated when canceling a subscription at the end of its natural billing period. + # Whether to create prorations when canceling subscriptions. Possible values are `none` and `create_prorations`, which is only compatible with `mode=immediately`. Passing `always_invoice` will result in an error. No prorations are generated when canceling a subscription at the end of its natural billing period. sig { returns(String) } attr_accessor :proration_behavior sig { diff --git a/rbi/stripe/services/financial_connections/transaction_service.rbi b/rbi/stripe/services/financial_connections/transaction_service.rbi index 2e6baf36..9b7db702 100644 --- a/rbi/stripe/services/financial_connections/transaction_service.rbi +++ b/rbi/stripe/services/financial_connections/transaction_service.rbi @@ -29,7 +29,7 @@ module Stripe sig { params(after: String).void } def initialize(after: nil); end end - # The ID of the Stripe account whose transactions will be retrieved. + # The ID of the Financial Connections Account whose transactions will be retrieved. sig { returns(String) } attr_accessor :account # A cursor for use in pagination. `ending_before` is an object ID that defines your place in the list. For instance, if you make a list request and receive 100 objects, starting with `obj_bar`, your subsequent call can include `ending_before=obj_bar` in order to fetch the previous page of the list.