stripe 5.24.0 → 5.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.travis.yml +1 -3
- data/CHANGELOG.md +15 -0
- data/README.md +24 -23
- data/VERSION +1 -1
- data/lib/stripe.rb +2 -2
- data/lib/stripe/connection_manager.rb +3 -0
- data/lib/stripe/object_types.rb +1 -0
- data/lib/stripe/resources.rb +1 -0
- data/lib/stripe/resources/issuing/dispute.rb +11 -0
- data/lib/stripe/resources/payout.rb +10 -0
- data/lib/stripe/resources/setup_attempt.rb +10 -0
- data/lib/stripe/stripe_configuration.rb +11 -0
- data/lib/stripe/version.rb +1 -1
- data/test/stripe/api_resource_test.rb +7 -7
- data/test/stripe/connection_manager_test.rb +4 -0
- data/test/stripe/customer_card_test.rb +6 -0
- data/test/stripe/customer_test.rb +1 -1
- data/test/stripe/issuing/dispute_test.rb +20 -1
- data/test/stripe/payout_test.rb +15 -0
- data/test/stripe/product_test.rb +1 -2
- data/test/stripe/setup_attempt_test.rb +16 -0
- data/test/stripe/stripe_configuration_test.rb +3 -0
- data/test/stripe_test.rb +13 -0
- data/test/test_helper.rb +3 -1
- metadata +8 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 6279813f9c71288d0e0ebaed2322dca113ef330825ff6d0ca9cbb714e8b32629
         | 
| 4 | 
            +
              data.tar.gz: 3669b9c18714d88ee54ee14d5446a07ccbd64e29d6ab6755ea1265037c52e4b7
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b23da505116525af9e0d3effb22b93ea6fcb59bea0ffec13ca56bb18a21a6ab6317e0885a213570328d192a55f03ff4fa307108e0765d7a15b6973de00c4e906
         | 
| 7 | 
            +
              data.tar.gz: f44454e686caa4b97663a6629d78c1ac07406c9ef789f7f7c3f33091f3432e5d90a27207f1e35cb4d0e1e7fc7453266a6d233e5e70dadeacf993686dd306bf19
         | 
    
        data/.travis.yml
    CHANGED
    
    | @@ -12,12 +12,10 @@ notifications: | |
| 12 12 | 
             
              email:
         | 
| 13 13 | 
             
                on_success: never
         | 
| 14 14 |  | 
| 15 | 
            -
            sudo: false
         | 
| 16 | 
            -
             | 
| 17 15 | 
             
            env:
         | 
| 18 16 | 
             
              global:
         | 
| 19 17 | 
             
                # If changing this number, please also change it in `test/test_helper.rb`.
         | 
| 20 | 
            -
                - STRIPE_MOCK_VERSION=0. | 
| 18 | 
            +
                - STRIPE_MOCK_VERSION=0.101.0
         | 
| 21 19 |  | 
| 22 20 | 
             
            cache:
         | 
| 23 21 | 
             
              directories:
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    | @@ -1,5 +1,20 @@ | |
| 1 1 | 
             
            # Changelog
         | 
| 2 2 |  | 
| 3 | 
            +
            ## 5.29.0 - 2021-01-05
         | 
| 4 | 
            +
            * [#952](https://github.com/stripe/stripe-ruby/pull/952) Allow client_id configuration on instance config
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            ## 5.28.0 - 2020-10-14
         | 
| 7 | 
            +
            * [#950](https://github.com/stripe/stripe-ruby/pull/950) Add configuration option for `write_timeout` for connections on Ruby 2.6+
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            ## 5.27.0 - 2020-10-14
         | 
| 10 | 
            +
            * [#951](https://github.com/stripe/stripe-ruby/pull/951) Add support for the Payout Reverse API
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            ## 5.26.0 - 2020-09-29
         | 
| 13 | 
            +
            * [#949](https://github.com/stripe/stripe-ruby/pull/949) Add support for the `SetupAttempt` resource and List API
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            ## 5.25.0 - 2020-09-02
         | 
| 16 | 
            +
            * [#944](https://github.com/stripe/stripe-ruby/pull/944) Add support for the Issuing Dispute Submit API
         | 
| 17 | 
            +
             | 
| 3 18 | 
             
            ## 5.24.0 - 2020-08-26
         | 
| 4 19 | 
             
            * [#939](https://github.com/stripe/stripe-ruby/pull/939) Extract configurations into separate object
         | 
| 5 20 | 
             
            * [#940](https://github.com/stripe/stripe-ruby/pull/940) Fix typo in documentation of `stripe_object.rb`
         | 
    
        data/README.md
    CHANGED
    
    | @@ -60,14 +60,14 @@ available in your [Stripe Dashboard][api-keys]. Set `Stripe.api_key` to its | |
| 60 60 | 
             
            value:
         | 
| 61 61 |  | 
| 62 62 | 
             
            ```ruby
         | 
| 63 | 
            -
            require  | 
| 64 | 
            -
            Stripe.api_key =  | 
| 63 | 
            +
            require 'stripe'
         | 
| 64 | 
            +
            Stripe.api_key = 'sk_test_...'
         | 
| 65 65 |  | 
| 66 66 | 
             
            # list customers
         | 
| 67 67 | 
             
            Stripe::Customer.list()
         | 
| 68 68 |  | 
| 69 69 | 
             
            # retrieve single customer
         | 
| 70 | 
            -
            Stripe::Customer.retrieve( | 
| 70 | 
            +
            Stripe::Customer.retrieve('cus_123456789')
         | 
| 71 71 | 
             
            ```
         | 
| 72 72 |  | 
| 73 73 | 
             
            ### Per-request Configuration
         | 
| @@ -82,38 +82,38 @@ require "stripe" | |
| 82 82 | 
             
            Stripe::Customer.list(
         | 
| 83 83 | 
             
              {},
         | 
| 84 84 | 
             
              {
         | 
| 85 | 
            -
                api_key:  | 
| 86 | 
            -
                stripe_account:  | 
| 87 | 
            -
                stripe_version:  | 
| 85 | 
            +
                api_key: 'sk_test_...',
         | 
| 86 | 
            +
                stripe_account: 'acct_...',
         | 
| 87 | 
            +
                stripe_version: '2018-02-28',
         | 
| 88 88 | 
             
              }
         | 
| 89 89 | 
             
            )
         | 
| 90 90 |  | 
| 91 91 | 
             
            Stripe::Customer.retrieve(
         | 
| 92 | 
            -
               | 
| 92 | 
            +
              'cus_123456789',
         | 
| 93 93 | 
             
              {
         | 
| 94 | 
            -
                api_key:  | 
| 95 | 
            -
                stripe_account:  | 
| 96 | 
            -
                stripe_version:  | 
| 94 | 
            +
                api_key: 'sk_test_...',
         | 
| 95 | 
            +
                stripe_account: 'acct_...',
         | 
| 96 | 
            +
                stripe_version: '2018-02-28',
         | 
| 97 97 | 
             
              }
         | 
| 98 98 | 
             
            )
         | 
| 99 99 |  | 
| 100 100 | 
             
            Stripe::Customer.retrieve(
         | 
| 101 101 | 
             
              {
         | 
| 102 | 
            -
                id:  | 
| 102 | 
            +
                id: 'cus_123456789',
         | 
| 103 103 | 
             
                expand: %w(balance_transaction)
         | 
| 104 104 | 
             
              },
         | 
| 105 105 | 
             
              {
         | 
| 106 | 
            -
                stripe_version:  | 
| 107 | 
            -
                api_key:  | 
| 106 | 
            +
                stripe_version: '2018-02-28',
         | 
| 107 | 
            +
                api_key: 'sk_test_...',
         | 
| 108 108 | 
             
              }
         | 
| 109 109 | 
             
            )
         | 
| 110 110 |  | 
| 111 111 | 
             
            Stripe::Customer.capture(
         | 
| 112 | 
            -
               | 
| 112 | 
            +
              'cus_123456789',
         | 
| 113 113 | 
             
              {},
         | 
| 114 114 | 
             
              {
         | 
| 115 | 
            -
                stripe_version:  | 
| 116 | 
            -
                api_key:  | 
| 115 | 
            +
                stripe_version: '2018-02-28',
         | 
| 116 | 
            +
                api_key: 'sk_test_...',
         | 
| 117 117 | 
             
              }
         | 
| 118 118 | 
             
            )
         | 
| 119 119 | 
             
            ```
         | 
| @@ -136,7 +136,7 @@ method: | |
| 136 136 | 
             
            ```ruby
         | 
| 137 137 | 
             
            client = Stripe::StripeClient.new
         | 
| 138 138 | 
             
            customer, resp = client.request do
         | 
| 139 | 
            -
              Stripe::Customer.retrieve( | 
| 139 | 
            +
              Stripe::Customer.retrieve('cus_123456789',)
         | 
| 140 140 | 
             
            end
         | 
| 141 141 | 
             
            puts resp.request_id
         | 
| 142 142 | 
             
            ```
         | 
| @@ -146,7 +146,7 @@ puts resp.request_id | |
| 146 146 | 
             
            A proxy can be configured with `Stripe.proxy`:
         | 
| 147 147 |  | 
| 148 148 | 
             
            ```ruby
         | 
| 149 | 
            -
            Stripe.proxy =  | 
| 149 | 
            +
            Stripe.proxy = 'https://user:pass@example.com:1234'
         | 
| 150 150 | 
             
            ```
         | 
| 151 151 |  | 
| 152 152 | 
             
            ### Configuring an API Version
         | 
| @@ -155,7 +155,7 @@ By default, the library will use the API version pinned to the account making | |
| 155 155 | 
             
            a request. This can be overridden with this global option:
         | 
| 156 156 |  | 
| 157 157 | 
             
            ```ruby
         | 
| 158 | 
            -
            Stripe.api_version =  | 
| 158 | 
            +
            Stripe.api_version = '2018-02-28'
         | 
| 159 159 | 
             
            ```
         | 
| 160 160 |  | 
| 161 161 | 
             
            See [versioning in the API reference][versioning] for more information.
         | 
| @@ -166,7 +166,7 @@ By default, the library will use its own internal bundle of known CA | |
| 166 166 | 
             
            certificates, but it's possible to configure your own:
         | 
| 167 167 |  | 
| 168 168 | 
             
            ```ruby
         | 
| 169 | 
            -
            Stripe.ca_bundle_path =  | 
| 169 | 
            +
            Stripe.ca_bundle_path = 'path/to/ca/bundle'
         | 
| 170 170 | 
             
            ```
         | 
| 171 171 |  | 
| 172 172 | 
             
            ### Configuring Automatic Retries
         | 
| @@ -186,11 +186,12 @@ retries are safe. | |
| 186 186 |  | 
| 187 187 | 
             
            ### Configuring Timeouts
         | 
| 188 188 |  | 
| 189 | 
            -
            Open and  | 
| 189 | 
            +
            Open, read and write timeouts are configurable:
         | 
| 190 190 |  | 
| 191 191 | 
             
            ```ruby
         | 
| 192 192 | 
             
            Stripe.open_timeout = 30 # in seconds
         | 
| 193 193 | 
             
            Stripe.read_timeout = 80
         | 
| 194 | 
            +
            Stripe.write_timeout = 30 # only supported on Ruby 2.6+
         | 
| 194 195 | 
             
            ```
         | 
| 195 196 |  | 
| 196 197 | 
             
            Please take care to set conservative read timeouts. Some API requests can take
         | 
| @@ -258,7 +259,7 @@ For example: | |
| 258 259 | 
             
            Stripe::Instrumentation.subscribe(:request_end) do |request_event|
         | 
| 259 260 | 
             
              tags = {
         | 
| 260 261 | 
             
                method: request_event.method,
         | 
| 261 | 
            -
                resource: request_event.path.split( | 
| 262 | 
            +
                resource: request_event.path.split('/')[2],
         | 
| 262 263 | 
             
                code: request_event.http_status,
         | 
| 263 264 | 
             
                retries: request_event.num_retries
         | 
| 264 265 | 
             
              }
         | 
| @@ -272,7 +273,7 @@ If you're writing a plugin that uses the library, we'd appreciate it if you | |
| 272 273 | 
             
            identified using `#set_app_info`:
         | 
| 273 274 |  | 
| 274 275 | 
             
            ```ruby
         | 
| 275 | 
            -
            Stripe.set_app_info( | 
| 276 | 
            +
            Stripe.set_app_info('MyAwesomePlugin', version: '1.2.34', url: 'https://myawesomeplugin.info')
         | 
| 276 277 | 
             
            ```
         | 
| 277 278 |  | 
| 278 279 | 
             
            This information is passed along when the library makes calls to the Stripe
         | 
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            5. | 
| 1 | 
            +
            5.29.0
         | 
    
        data/lib/stripe.rb
    CHANGED
    
    | @@ -71,6 +71,7 @@ module Stripe | |
| 71 71 | 
             
                def_delegators :@configuration, :connect_base, :connect_base=
         | 
| 72 72 | 
             
                def_delegators :@configuration, :open_timeout, :open_timeout=
         | 
| 73 73 | 
             
                def_delegators :@configuration, :read_timeout, :read_timeout=
         | 
| 74 | 
            +
                def_delegators :@configuration, :write_timeout, :write_timeout=
         | 
| 74 75 | 
             
                def_delegators :@configuration, :proxy, :proxy=
         | 
| 75 76 | 
             
                def_delegators :@configuration, :verify_ssl_certs, :verify_ssl_certs=
         | 
| 76 77 | 
             
                def_delegators :@configuration, :ca_bundle_path, :ca_bundle_path=
         | 
| @@ -78,13 +79,12 @@ module Stripe | |
| 78 79 | 
             
                def_delegators :@configuration, :logger, :logger=
         | 
| 79 80 | 
             
                def_delegators :@configuration, :max_network_retries, :max_network_retries=
         | 
| 80 81 | 
             
                def_delegators :@configuration, :enable_telemetry=, :enable_telemetry?
         | 
| 82 | 
            +
                def_delegators :@configuration, :client_id=, :client_id
         | 
| 81 83 |  | 
| 82 84 | 
             
                # Internal configurations
         | 
| 83 85 | 
             
                def_delegators :@configuration, :max_network_retry_delay
         | 
| 84 86 | 
             
                def_delegators :@configuration, :initial_network_retry_delay
         | 
| 85 87 | 
             
                def_delegators :@configuration, :ca_store
         | 
| 86 | 
            -
             | 
| 87 | 
            -
                attr_accessor :client_id
         | 
| 88 88 | 
             
              end
         | 
| 89 89 |  | 
| 90 90 | 
             
              # Gets the application for a plugin that's identified some. See
         | 
| @@ -119,6 +119,9 @@ module Stripe | |
| 119 119 |  | 
| 120 120 | 
             
                  connection.open_timeout = Stripe.open_timeout
         | 
| 121 121 | 
             
                  connection.read_timeout = Stripe.read_timeout
         | 
| 122 | 
            +
                  if connection.respond_to?(:write_timeout=)
         | 
| 123 | 
            +
                    connection.write_timeout = Stripe.write_timeout
         | 
| 124 | 
            +
                  end
         | 
| 122 125 |  | 
| 123 126 | 
             
                  connection.use_ssl = uri.scheme == "https"
         | 
| 124 127 |  | 
    
        data/lib/stripe/object_types.rb
    CHANGED
    
    | @@ -73,6 +73,7 @@ module Stripe | |
| 73 73 | 
             
                    Reversal::OBJECT_NAME => Reversal,
         | 
| 74 74 | 
             
                    Review::OBJECT_NAME => Review,
         | 
| 75 75 | 
             
                    SKU::OBJECT_NAME => SKU,
         | 
| 76 | 
            +
                    SetupAttempt::OBJECT_NAME => SetupAttempt,
         | 
| 76 77 | 
             
                    SetupIntent::OBJECT_NAME => SetupIntent,
         | 
| 77 78 | 
             
                    Sigma::ScheduledQueryRun::OBJECT_NAME => Sigma::ScheduledQueryRun,
         | 
| 78 79 | 
             
                    Source::OBJECT_NAME => Source,
         | 
    
        data/lib/stripe/resources.rb
    CHANGED
    
    | @@ -61,6 +61,7 @@ require "stripe/resources/reporting/report_run" | |
| 61 61 | 
             
            require "stripe/resources/reporting/report_type"
         | 
| 62 62 | 
             
            require "stripe/resources/reversal"
         | 
| 63 63 | 
             
            require "stripe/resources/review"
         | 
| 64 | 
            +
            require "stripe/resources/setup_attempt"
         | 
| 64 65 | 
             
            require "stripe/resources/setup_intent"
         | 
| 65 66 | 
             
            require "stripe/resources/sigma/scheduled_query_run"
         | 
| 66 67 | 
             
            require "stripe/resources/sku"
         | 
| @@ -9,6 +9,17 @@ module Stripe | |
| 9 9 | 
             
                  include Stripe::APIOperations::Save
         | 
| 10 10 |  | 
| 11 11 | 
             
                  OBJECT_NAME = "issuing.dispute"
         | 
| 12 | 
            +
             | 
| 13 | 
            +
                  custom_method :submit, http_verb: :post
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  def submit(params = {}, opts = {})
         | 
| 16 | 
            +
                    request_stripe_object(
         | 
| 17 | 
            +
                      method: :post,
         | 
| 18 | 
            +
                      path: resource_url + "/submit",
         | 
| 19 | 
            +
                      params: params,
         | 
| 20 | 
            +
                      opts: opts
         | 
| 21 | 
            +
                    )
         | 
| 22 | 
            +
                  end
         | 
| 12 23 | 
             
                end
         | 
| 13 24 | 
             
              end
         | 
| 14 25 | 
             
            end
         | 
| @@ -10,6 +10,7 @@ module Stripe | |
| 10 10 | 
             
                OBJECT_NAME = "payout"
         | 
| 11 11 |  | 
| 12 12 | 
             
                custom_method :cancel, http_verb: :post
         | 
| 13 | 
            +
                custom_method :reverse, http_verb: :post
         | 
| 13 14 |  | 
| 14 15 | 
             
                def cancel(params = {}, opts = {})
         | 
| 15 16 | 
             
                  request_stripe_object(
         | 
| @@ -19,5 +20,14 @@ module Stripe | |
| 19 20 | 
             
                    opts: opts
         | 
| 20 21 | 
             
                  )
         | 
| 21 22 | 
             
                end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
                def reverse(params = {}, opts = {})
         | 
| 25 | 
            +
                  request_stripe_object(
         | 
| 26 | 
            +
                    method: :post,
         | 
| 27 | 
            +
                    path: resource_url + "/reverse",
         | 
| 28 | 
            +
                    params: params,
         | 
| 29 | 
            +
                    opts: opts
         | 
| 30 | 
            +
                  )
         | 
| 31 | 
            +
                end
         | 
| 22 32 | 
             
              end
         | 
| 23 33 | 
             
            end
         | 
| @@ -42,6 +42,7 @@ module Stripe | |
| 42 42 | 
             
                attr_reader :max_network_retry_delay
         | 
| 43 43 | 
             
                attr_reader :open_timeout
         | 
| 44 44 | 
             
                attr_reader :read_timeout
         | 
| 45 | 
            +
                attr_reader :write_timeout
         | 
| 45 46 | 
             
                attr_reader :proxy
         | 
| 46 47 | 
             
                attr_reader :verify_ssl_certs
         | 
| 47 48 |  | 
| @@ -72,6 +73,7 @@ module Stripe | |
| 72 73 |  | 
| 73 74 | 
             
                  @open_timeout = 30
         | 
| 74 75 | 
             
                  @read_timeout = 80
         | 
| 76 | 
            +
                  @write_timeout = 30
         | 
| 75 77 |  | 
| 76 78 | 
             
                  @api_base = "https://api.stripe.com"
         | 
| 77 79 | 
             
                  @connect_base = "https://connect.stripe.com"
         | 
| @@ -109,6 +111,15 @@ module Stripe | |
| 109 111 | 
             
                  StripeClient.clear_all_connection_managers
         | 
| 110 112 | 
             
                end
         | 
| 111 113 |  | 
| 114 | 
            +
                def write_timeout=(write_timeout)
         | 
| 115 | 
            +
                  unless Net::HTTP.instance_methods.include?(:write_timeout=)
         | 
| 116 | 
            +
                    raise NotImplementedError
         | 
| 117 | 
            +
                  end
         | 
| 118 | 
            +
             | 
| 119 | 
            +
                  @write_timeout = write_timeout
         | 
| 120 | 
            +
                  StripeClient.clear_all_connection_managers
         | 
| 121 | 
            +
                end
         | 
| 122 | 
            +
             | 
| 112 123 | 
             
                def proxy=(proxy)
         | 
| 113 124 | 
             
                  @proxy = proxy
         | 
| 114 125 | 
             
                  StripeClient.clear_all_connection_managers
         | 
    
        data/lib/stripe/version.rb
    CHANGED
    
    
| @@ -111,15 +111,15 @@ module Stripe | |
| 111 111 | 
             
                end
         | 
| 112 112 |  | 
| 113 113 | 
             
                should "send expand when fetching through ListObject" do
         | 
| 114 | 
            -
                  stub_request(:get, "#{Stripe.api_base}/v1/ | 
| 115 | 
            -
                    .to_return(body: JSON.generate( | 
| 114 | 
            +
                  stub_request(:get, "#{Stripe.api_base}/v1/charges/ch_123")
         | 
| 115 | 
            +
                    .to_return(body: JSON.generate(charge_fixture))
         | 
| 116 116 |  | 
| 117 | 
            -
                  stub_request(:get, "#{Stripe.api_base}/v1/ | 
| 118 | 
            -
                    .with(query: { "expand" => [" | 
| 119 | 
            -
                    .to_return(body: JSON.generate( | 
| 117 | 
            +
                  stub_request(:get, "#{Stripe.api_base}/v1/charges/ch_123/refunds/re_123")
         | 
| 118 | 
            +
                    .with(query: { "expand" => ["balance_transaction"] })
         | 
| 119 | 
            +
                    .to_return(body: JSON.generate(charge_fixture))
         | 
| 120 120 |  | 
| 121 | 
            -
                   | 
| 122 | 
            -
                   | 
| 121 | 
            +
                  charge = Stripe::Charge.retrieve("ch_123")
         | 
| 122 | 
            +
                  charge.refunds.retrieve(id: "re_123", expand: [:balance_transaction])
         | 
| 123 123 | 
             
                end
         | 
| 124 124 |  | 
| 125 125 | 
             
                context "when specifying per-object credentials" do
         | 
| @@ -39,6 +39,7 @@ module Stripe | |
| 39 39 |  | 
| 40 40 | 
             
                    old_open_timeout = Stripe.open_timeout
         | 
| 41 41 | 
             
                    old_read_timeout = Stripe.read_timeout
         | 
| 42 | 
            +
                    old_write_timeout = Stripe.write_timeout
         | 
| 42 43 |  | 
| 43 44 | 
             
                    begin
         | 
| 44 45 | 
             
                      # Make sure any global initialization here is undone in the `ensure`
         | 
| @@ -47,6 +48,7 @@ module Stripe | |
| 47 48 |  | 
| 48 49 | 
             
                      Stripe.open_timeout = 123
         | 
| 49 50 | 
             
                      Stripe.read_timeout = 456
         | 
| 51 | 
            +
                      Stripe.write_timeout = 789 if WRITE_TIMEOUT_SUPPORTED
         | 
| 50 52 |  | 
| 51 53 | 
             
                      conn = @manager.connection_for("https://stripe.com")
         | 
| 52 54 |  | 
| @@ -63,6 +65,7 @@ module Stripe | |
| 63 65 | 
             
                      # Timeouts
         | 
| 64 66 | 
             
                      assert_equal 123, conn.open_timeout
         | 
| 65 67 | 
             
                      assert_equal 456, conn.read_timeout
         | 
| 68 | 
            +
                      assert_equal 789, conn.write_timeout if WRITE_TIMEOUT_SUPPORTED
         | 
| 66 69 |  | 
| 67 70 | 
             
                      assert_equal true, conn.use_ssl?
         | 
| 68 71 | 
             
                      assert_equal OpenSSL::SSL::VERIFY_PEER, conn.verify_mode
         | 
| @@ -72,6 +75,7 @@ module Stripe | |
| 72 75 |  | 
| 73 76 | 
             
                      Stripe.open_timeout = old_open_timeout
         | 
| 74 77 | 
             
                      Stripe.read_timeout = old_read_timeout
         | 
| 78 | 
            +
                      Stripe.write_timeout = old_write_timeout if WRITE_TIMEOUT_SUPPORTED
         | 
| 75 79 | 
             
                    end
         | 
| 76 80 | 
             
                  end
         | 
| 77 81 |  | 
| @@ -5,6 +5,12 @@ require ::File.expand_path("../test_helper", __dir__) | |
| 5 5 | 
             
            module Stripe
         | 
| 6 6 | 
             
              class CustomerCardTest < Test::Unit::TestCase
         | 
| 7 7 | 
             
                setup do
         | 
| 8 | 
            +
                  # Unfortunately, the OpenAPI spec has an issue where the sources list has the wrong
         | 
| 9 | 
            +
                  # url so we need to mock this call instead.
         | 
| 10 | 
            +
                  customer_json = { id: "cus_123", object: "customer", sources: { object: "list", data: [], has_more: true, url: "/v1/customers/cus_123/sources" } }
         | 
| 11 | 
            +
                  stub_request(:get, "#{Stripe.api_base}/v1/customers/cus_123")
         | 
| 12 | 
            +
                    .to_return(body: JSON.generate(customer_json))
         | 
| 13 | 
            +
             | 
| 8 14 | 
             
                  @customer = Stripe::Customer.retrieve("cus_123")
         | 
| 9 15 | 
             
                end
         | 
| 10 16 |  | 
| @@ -57,7 +57,7 @@ module Stripe | |
| 57 57 | 
             
                  should "delete a discount" do
         | 
| 58 58 | 
             
                    customer = Stripe::Customer.retrieve("cus_123")
         | 
| 59 59 | 
             
                    customer = customer.delete_discount
         | 
| 60 | 
            -
                    assert_requested :delete, "#{Stripe.api_base}/v1/customers | 
| 60 | 
            +
                    assert_requested :delete, "#{Stripe.api_base}/v1/customers/cus_123/discount"
         | 
| 61 61 | 
             
                    assert customer.is_a?(Stripe::Customer)
         | 
| 62 62 | 
             
                  end
         | 
| 63 63 | 
             
                end
         | 
| @@ -6,7 +6,7 @@ module Stripe | |
| 6 6 | 
             
              module Issuing
         | 
| 7 7 | 
             
                class DisputeTest < Test::Unit::TestCase
         | 
| 8 8 | 
             
                  should "be creatable" do
         | 
| 9 | 
            -
                    dispute = Stripe::Issuing::Dispute.create
         | 
| 9 | 
            +
                    dispute = Stripe::Issuing::Dispute.create(transaction: "ipi_123")
         | 
| 10 10 |  | 
| 11 11 | 
             
                    assert_requested :post, "#{Stripe.api_base}/v1/issuing/disputes"
         | 
| 12 12 | 
             
                    assert dispute.is_a?(Stripe::Issuing::Dispute)
         | 
| @@ -30,6 +30,25 @@ module Stripe | |
| 30 30 | 
             
                    assert_requested :post, "#{Stripe.api_base}/v1/issuing/disputes/ich_123"
         | 
| 31 31 | 
             
                    assert dispute.is_a?(Stripe::Issuing::Dispute)
         | 
| 32 32 | 
             
                  end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                  context "#submit" do
         | 
| 35 | 
            +
                    should "submit the dispute" do
         | 
| 36 | 
            +
                      dispute = Stripe::Issuing::Dispute.retrieve("idp_123")
         | 
| 37 | 
            +
                      dispute = dispute.submit
         | 
| 38 | 
            +
                      assert_requested :post,
         | 
| 39 | 
            +
                                       "#{Stripe.api_base}/v1/issuing/disputes/idp_123/submit"
         | 
| 40 | 
            +
                      assert dispute.is_a?(Stripe::Issuing::Dispute)
         | 
| 41 | 
            +
                    end
         | 
| 42 | 
            +
                  end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                  context ".submit" do
         | 
| 45 | 
            +
                    should "submit the dispute" do
         | 
| 46 | 
            +
                      dispute = Stripe::Issuing::Dispute.submit("idp_123")
         | 
| 47 | 
            +
                      assert_requested :post,
         | 
| 48 | 
            +
                                       "#{Stripe.api_base}/v1/issuing/disputes/idp_123/submit"
         | 
| 49 | 
            +
                      assert dispute.is_a?(Stripe::Issuing::Dispute)
         | 
| 50 | 
            +
                    end
         | 
| 51 | 
            +
                  end
         | 
| 33 52 | 
             
                end
         | 
| 34 53 | 
             
              end
         | 
| 35 54 | 
             
            end
         | 
    
        data/test/stripe/payout_test.rb
    CHANGED
    
    | @@ -53,5 +53,20 @@ module Stripe | |
| 53 53 | 
             
                    assert payout.is_a?(Stripe::Payout)
         | 
| 54 54 | 
             
                  end
         | 
| 55 55 | 
             
                end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                context "#reverse" do
         | 
| 58 | 
            +
                  should "reverse a payout" do
         | 
| 59 | 
            +
                    payout = Stripe::Payout.retrieve("tr_123")
         | 
| 60 | 
            +
                    payout = payout.reverse
         | 
| 61 | 
            +
                    assert payout.is_a?(Stripe::Payout)
         | 
| 62 | 
            +
                  end
         | 
| 63 | 
            +
                end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
                context ".reverse" do
         | 
| 66 | 
            +
                  should "reverse a payout" do
         | 
| 67 | 
            +
                    payout = Stripe::Payout.reverse("pm_123")
         | 
| 68 | 
            +
                    assert payout.is_a?(Stripe::Payout)
         | 
| 69 | 
            +
                  end
         | 
| 70 | 
            +
                end
         | 
| 56 71 | 
             
              end
         | 
| 57 72 | 
             
            end
         | 
    
        data/test/stripe/product_test.rb
    CHANGED
    
    
| @@ -0,0 +1,16 @@ | |
| 1 | 
            +
            # frozen_string_literal: true
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            require ::File.expand_path("../test_helper", __dir__)
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            module Stripe
         | 
| 6 | 
            +
              class SetupAttemptTest < Test::Unit::TestCase
         | 
| 7 | 
            +
                should "be listable" do
         | 
| 8 | 
            +
                  setup_attempts = Stripe::SetupAttempt.list({
         | 
| 9 | 
            +
                    setup_intent: "seti_123",
         | 
| 10 | 
            +
                  })
         | 
| 11 | 
            +
                  assert_requested :get, "#{Stripe.api_base}/v1/setup_attempts?setup_intent=seti_123"
         | 
| 12 | 
            +
                  assert setup_attempts.data.is_a?(Array)
         | 
| 13 | 
            +
                  assert setup_attempts.data[0].is_a?(Stripe::SetupAttempt)
         | 
| 14 | 
            +
                end
         | 
| 15 | 
            +
              end
         | 
| 16 | 
            +
            end
         | 
| @@ -16,6 +16,7 @@ module Stripe | |
| 16 16 | 
             
                    assert_equal 0, config.max_network_retries
         | 
| 17 17 | 
             
                    assert_equal 30, config.open_timeout
         | 
| 18 18 | 
             
                    assert_equal 80, config.read_timeout
         | 
| 19 | 
            +
                    assert_equal 30, config.write_timeout
         | 
| 19 20 | 
             
                    assert_equal "https://api.stripe.com", config.api_base
         | 
| 20 21 | 
             
                    assert_equal "https://connect.stripe.com", config.connect_base
         | 
| 21 22 | 
             
                    assert_equal "https://files.stripe.com", config.uploads_base
         | 
| @@ -25,10 +26,12 @@ module Stripe | |
| 25 26 | 
             
                    config = Stripe::StripeConfiguration.setup do |c|
         | 
| 26 27 | 
             
                      c.open_timeout = 100
         | 
| 27 28 | 
             
                      c.read_timeout = 100
         | 
| 29 | 
            +
                      c.write_timeout = 100 if WRITE_TIMEOUT_SUPPORTED
         | 
| 28 30 | 
             
                    end
         | 
| 29 31 |  | 
| 30 32 | 
             
                    assert_equal 100, config.open_timeout
         | 
| 31 33 | 
             
                    assert_equal 100, config.read_timeout
         | 
| 34 | 
            +
                    assert_equal 100, config.write_timeout if WRITE_TIMEOUT_SUPPORTED
         | 
| 32 35 | 
             
                  end
         | 
| 33 36 | 
             
                end
         | 
| 34 37 |  | 
    
        data/test/stripe_test.rb
    CHANGED
    
    | @@ -54,6 +54,19 @@ class StripeTest < Test::Unit::TestCase | |
| 54 54 | 
             
                  assert_equal 10, Stripe.read_timeout
         | 
| 55 55 | 
             
                end
         | 
| 56 56 |  | 
| 57 | 
            +
                if WRITE_TIMEOUT_SUPPORTED
         | 
| 58 | 
            +
                  should "allow write timeout to be configured" do
         | 
| 59 | 
            +
                    Stripe.write_timeout = 10
         | 
| 60 | 
            +
                    assert_equal 10, Stripe.write_timeout
         | 
| 61 | 
            +
                  end
         | 
| 62 | 
            +
                else
         | 
| 63 | 
            +
                  should "raise when write timeout to be configured is not supported" do
         | 
| 64 | 
            +
                    assert_raises NotImplementedError do
         | 
| 65 | 
            +
                      Stripe.write_timeout = 10
         | 
| 66 | 
            +
                    end
         | 
| 67 | 
            +
                  end
         | 
| 68 | 
            +
                end
         | 
| 69 | 
            +
             | 
| 57 70 | 
             
                should "allow api_key to be configured" do
         | 
| 58 71 | 
             
                  Stripe.api_key = "sk_local_test"
         | 
| 59 72 | 
             
                  assert_equal "sk_local_test", Stripe.api_key
         | 
    
        data/test/test_helper.rb
    CHANGED
    
    | @@ -16,7 +16,7 @@ require ::File.expand_path("test_data", __dir__) | |
| 16 16 | 
             
            require ::File.expand_path("stripe_mock", __dir__)
         | 
| 17 17 |  | 
| 18 18 | 
             
            # If changing this number, please also change it in `.travis.yml`.
         | 
| 19 | 
            -
            MOCK_MINIMUM_VERSION = "0. | 
| 19 | 
            +
            MOCK_MINIMUM_VERSION = "0.101.0"
         | 
| 20 20 | 
             
            MOCK_PORT = Stripe::StripeMock.start
         | 
| 21 21 |  | 
| 22 22 | 
             
            # Disable all real network connections except those that are outgoing to
         | 
| @@ -56,6 +56,8 @@ module Test | |
| 56 56 | 
             
                  include Stripe::TestData
         | 
| 57 57 | 
             
                  include Mocha
         | 
| 58 58 |  | 
| 59 | 
            +
                  WRITE_TIMEOUT_SUPPORTED = Net::HTTP.instance_methods.include?(:write_timeout=)
         | 
| 60 | 
            +
             | 
| 59 61 | 
             
                  setup do
         | 
| 60 62 | 
             
                    Stripe.api_key = "sk_test_123"
         | 
| 61 63 | 
             
                    Stripe.api_base = "http://localhost:#{MOCK_PORT}"
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: stripe
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 5. | 
| 4 | 
            +
              version: 5.29.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Stripe
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-01-05 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies: []
         | 
| 13 13 | 
             
            description: Stripe is the easiest way to accept payments online.  See https://stripe.com
         | 
| 14 14 | 
             
              for details.
         | 
| @@ -116,6 +116,7 @@ files: | |
| 116 116 | 
             
            - lib/stripe/resources/reporting/report_type.rb
         | 
| 117 117 | 
             
            - lib/stripe/resources/reversal.rb
         | 
| 118 118 | 
             
            - lib/stripe/resources/review.rb
         | 
| 119 | 
            +
            - lib/stripe/resources/setup_attempt.rb
         | 
| 119 120 | 
             
            - lib/stripe/resources/setup_intent.rb
         | 
| 120 121 | 
             
            - lib/stripe/resources/sigma/scheduled_query_run.rb
         | 
| 121 122 | 
             
            - lib/stripe/resources/sku.rb
         | 
| @@ -207,6 +208,7 @@ files: | |
| 207 208 | 
             
            - test/stripe/reporting/report_type_test.rb
         | 
| 208 209 | 
             
            - test/stripe/reversal_test.rb
         | 
| 209 210 | 
             
            - test/stripe/review_test.rb
         | 
| 211 | 
            +
            - test/stripe/setup_attempt_test.rb
         | 
| 210 212 | 
             
            - test/stripe/setup_intent_test.rb
         | 
| 211 213 | 
             
            - test/stripe/sigma/scheduled_query_run_test.rb
         | 
| 212 214 | 
             
            - test/stripe/sku_test.rb
         | 
| @@ -244,7 +246,7 @@ metadata: | |
| 244 246 | 
             
              github_repo: ssh://github.com/stripe/stripe-ruby
         | 
| 245 247 | 
             
              homepage_uri: https://stripe.com/docs/api/ruby
         | 
| 246 248 | 
             
              source_code_uri: https://github.com/stripe/stripe-ruby
         | 
| 247 | 
            -
            post_install_message: | 
| 249 | 
            +
            post_install_message:
         | 
| 248 250 | 
             
            rdoc_options: []
         | 
| 249 251 | 
             
            require_paths:
         | 
| 250 252 | 
             
            - lib
         | 
| @@ -260,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 260 262 | 
             
                  version: '0'
         | 
| 261 263 | 
             
            requirements: []
         | 
| 262 264 | 
             
            rubygems_version: 3.1.2
         | 
| 263 | 
            -
            signing_key: | 
| 265 | 
            +
            signing_key:
         | 
| 264 266 | 
             
            specification_version: 4
         | 
| 265 267 | 
             
            summary: Ruby bindings for the Stripe API
         | 
| 266 268 | 
             
            test_files:
         | 
| @@ -326,6 +328,7 @@ test_files: | |
| 326 328 | 
             
            - test/stripe/reporting/report_type_test.rb
         | 
| 327 329 | 
             
            - test/stripe/reversal_test.rb
         | 
| 328 330 | 
             
            - test/stripe/review_test.rb
         | 
| 331 | 
            +
            - test/stripe/setup_attempt_test.rb
         | 
| 329 332 | 
             
            - test/stripe/setup_intent_test.rb
         | 
| 330 333 | 
             
            - test/stripe/sigma/scheduled_query_run_test.rb
         | 
| 331 334 | 
             
            - test/stripe/sku_test.rb
         |