1633 Commits

Author SHA1 Message Date
Brandur
c7db5de52f
Merge pull request #766 from stripe/brandur-relax-file-constraints
Relax constraints on objects that we'll accept as a file
2019-04-16 11:49:09 -07:00
Brandur
81b7cb3ca8 Relax constraints on objects that we'll accept as a file
When uploading a file, we previously made a check on whether it
supported both `#read` and `#path` before wrapping it in a
`Faraday::UploadIO` and sending it off. The second check on `#path`
isn't strictly necessary, and as reported in #761 can prevent objects
created by `open-uri` from being compatible with file upload.

Here we remove the check `#path` so that we just require that objects
support `#read`, and in addition error when an object is passed that's
not file-compatible and not a string. This should prevent users from
seeing the very confusing "Invalid hash" error in these situations.

Fixes #761.
2019-04-16 08:33:42 -07:00
remi-stripe
42d475b638
Merge pull request #763 from stripe/remi-bring-nested-tests-up
Move tests for nested resources up to the parent class
2019-04-15 09:47:20 -07:00
Remi Jannel
5aa63d2cc6 Move tests for nested resources up to the parent class 2019-04-12 19:23:52 -07:00
Remi Jannel
0233deb5c6 Add support for CreditNote 2019-04-07 09:47:43 -07:00
remi-stripe
c3e65b2552 Fix our test suite for latest stripe-mock (#757) 2019-04-05 21:11:24 -07:00
Olivier Bellone
81035d401f
Include file_link_data parameter in file creation test (#756) 2019-04-05 14:43:52 -07:00
Olivier Bellone
796f4bd63c
Fix minimum Ruby version in README.md 2019-04-03 10:49:12 -07:00
Olivier Bellone
51d167aa29
Bump version to 4.12.0 v4.12.0 2019-04-02 10:28:11 -07:00
Olivier Bellone
0790bb4154
Static methods for delete (#752)
New `.delete` class method on deletable API resources
2019-04-02 10:25:05 -07:00
Olivier Bellone
160028ada1
New custom_method DSL for defining custom API request methods as static methods (#754)
New `custom_method` DSL for defining custom API request methods as static methods
2019-04-02 10:06:40 -07:00
Olivier Bellone
bb25d09052 Bump version to 4.11.0 v4.11.0 2019-03-26 09:06:55 -07:00
Olivier Bellone
d98e40697b
Merge pull request #753 from stripe/ob-proxy
Add a global proxy configuration parameter
2019-03-26 09:05:35 -07:00
Olivier Bellone
6e95bf45f9 Add a global proxy configuration parameter 2019-03-25 18:34:12 -07:00
Remi Jannel
287a2e6979 Bump version to 4.10.0 v4.10.0 2019-03-18 16:48:39 -07:00
remi-stripe
39d66c00ce
Merge pull request #745 from stripe/remi-add-payment-methods
Add support for the PaymentMethod resource
2019-03-18 16:42:53 -07:00
remi-stripe
7b9b7b6aab
Merge pull request #748 from stripe/remi-add-terminal-delete
Add support for Terminal Location and Reader deletion
2019-03-18 16:41:08 -07:00
remi-stripe
26ac12679c
Merge pull request #747 from stripe/remi-add-checkout-session-retrieve
Add support for retrieving a Checkout Session
2019-03-18 16:41:01 -07:00
Remi Jannel
f93c0075c0 Add support for the PaymentMethod resource 2019-03-18 16:30:51 -07:00
Remi Jannel
de204dda1c Add support for retrieving a Checkout Session 2019-03-18 16:29:04 -07:00
Remi Jannel
031075c954 Add support for Terminal Location and Reader deletion 2019-03-18 16:28:24 -07:00
Brandur
67edf85459 Bump version to 4.9.1 v4.9.1 2019-03-18 12:52:10 -07:00
Brandur
c1894e8f3e
Merge pull request #750 from stripe/brandur-warn-on-remove-error
Catch error and warn if unable to remove a method
2019-03-18 12:51:03 -07:00
Brandur
8702e714bc Catch error and warn if unable to remove a method
In some cases there can be a method that's detected with
`method_defined?`, but which cannot be removed with `remove_method`,
even though it's on the same class. The only case so far that we've
noticed this is when a class is reopened for monkey patching like in
issue #749.

We'll still try to discourage this sort of use, but here we swallow the
error and issue a warning so at least the program doesn't crash.

Fixes #749.
2019-03-18 11:52:35 -07:00
remi-stripe
df8c141bb8
Merge pull request #746 from stripe/remi-fix-tests
Fix tests to work on latest stripe-mock for future updates
2019-03-05 10:34:30 -08:00
Remi Jannel
1094e894cc Fix tests to work on latest stripe-mock for future updates 2019-03-05 10:16:49 -08:00
Brandur
c139dc890d Update changelog convention for yanked version 2019-02-20 11:25:30 -08:00
Remi Jannel
ab8704ed34 Bump version to 4.9.0 v4.9.0 2019-02-12 08:54:31 -08:00
remi-stripe
7af2826ad1
Merge pull request #739 from stripe/remi-add-subscription-schedules
Add support for Subscription Schedules
2019-02-12 08:51:47 -08:00
Remi Jannel
d784819901 Add support for Subscription Schedules 2019-02-11 22:38:08 -08:00
Brandur
c070c05237 Bump version to 4.8.1 v4.8.1 2019-02-11 11:28:47 -08:00
Brandur
65cc699832
Merge pull request #743 from stripe/brandur-remove-file-encoding
Remove attempt to nicen `UploadIO` in logs
2019-02-11 11:22:55 -08:00
Brandur
cf6d79a1ca Remove attempt to nicen UploadIO in logs
In #741 I tried to do something too clever by replacing instances of
`Faraday::UploadIO` found in parameters with a human-readable string to
improve `STRIPE_LOG` logging output.

I thought I'd tested it at the time, but apparently not (or not well
enough), and this change caused the regression detailed in #742.

My findings about how Faraday encodes multipart were apparently wrong
and it does use these parameters, so here we remove the step where we
try to nicen them for logging. The logs look a little worse, but it's
not that big of a deal.

I've tested this patch against the API and confirmed that it addresses
the problem.

Fixes #742.
2019-02-11 11:14:27 -08:00
Brandur
e0438d27a8 Bump version to 4.8.0 v4.8.0 2019-02-03 12:26:29 -08:00
Brandur
c1fa537e34
Merge pull request #741 from stripe/brandur-simpler-encoding
Use `FaradayStripeEncoder` to encode all parameter styles
2019-02-03 12:25:14 -08:00
Brandur
9dd5bdb0e6 Use FaradayStripeEncoder to encode all parameter styles
Makes a few tweaks to hopefully simplify clarity things:

* `FaradayStripeEncoder` now becomes the way to encode all of form,
  multipart form, and query parameters.
* Introduce a cache in it so that we don't have to encode everything
  twice (once for logging, and once for the request body).
* Try to sanitize logging a bit by replacing `Faraday::UploadIO`s found
  in incoming parameters with a string representation of the file (note
  that all other styles of file input like `File` or `Tempfile` have
  been converted to `Faraday::UploadIO` by the time they reach the
  encoder).
2019-02-03 12:24:53 -08:00
Brandur
3798cadfcc Fix a few comments 2019-02-01 12:47:36 -08:00
Brandur
58512a90d8 Bump version to 4.7.1 v4.7.1 2019-02-01 09:28:47 -08:00
Brandur
42d4f42b12
Merge pull request #740 from stripe/brandur-fix-query-encoding
Fix query encoding for integer-indexed maps
2019-02-01 09:28:00 -08:00
Brandur
07f939b46b Fix query encoding for integer-indexed maps
As reported in #608, integer-indexed maps currently work when passed as
part of the body, but they are reverted to non-indexed maps when passed
in the query.

It turns out that we actually had two problems:

1. We weren't calling our `Util.encode_parameters` on our query
   parameters anywhere, and it's this method will does the integer
   encoding.

2. Even when I fixed (1) by calling `Util.encode_parameters`, Faraday
   would still strip the integer indexes as they were transformed in
   its default `NestedParamsEncoder`.

Here we fix both issues by calling `Util.encode_parameters` and sending
Faraday a custom encoder which bypasses its normal shenanigans.

Unfortunately, this has turned out to be somewhat difficult to test
because the integer-indexed maps also seem to confuse Webmock, which
strips them down to standard maps (I even tried testing against a
string, and it still got it wrong). I did use stripe-mock though to
verify that we are now sending the right payload.

Fixes #608.
2019-02-01 09:14:54 -08:00
Remi Jannel
94bafb451f Bump version to 4.7.0 v4.7.0 2019-01-23 15:47:00 -08:00
remi-stripe
3366cacd6a
Merge pull request #735 from stripe/remi-fix-checkout-sessions
Move CheckoutSession to the Checkout namespace and rename to Session
2019-01-23 15:40:26 -08:00
Brandur
41b6968787
Merge pull request #738 from stripe/brandur-port-in-output
Add port in "started stripe-mock" output
2019-01-22 12:25:37 -08:00
Brandur
15af271408 Add port in "started stripe-mock" output
A tiny tweak to add the port chosen by stripe-mock to the "starting
stripe-mock" output. This gives the user a little more information
(which might be handy if something isn't working), and brings it inline
with Go's output format: https://github.com/stripe/stripe-go/pull/780
2019-01-22 12:15:31 -08:00
Brandur
a5472ed04a
Merge pull request #737 from stripe/brandur-select-port
Have stripe-mock select a port number
2019-01-22 09:00:56 -08:00
Olivier Bellone
130704a09a
Bump version to 4.6.0 v4.6.0 2019-01-21 13:21:22 +01:00
Olivier Bellone
bc62c80320
Merge pull request #736 from stripe/ob-serialize-individual
Properly serialize `individual` on Account objects
2019-01-21 13:19:13 +01:00
Brandur
ad20248ee3 Have stripe-mock select a port number
When starting a stripe-mock for a custom OpenAPI spec, pass `-http-port
0` on startup, which tells stripe-mock to select a port, then extract
that port from its output.

This is not a total win because we now have to rely on string matching,
but it is better in that (1) it gets a port more efficiently, (2) it
eliminates a race condition where another process could take the port we
found before stripe-mock gets to start, and (3) it starts a little
faster as we take advantage of the fact that we know stripe-mock has
started when we've found a port in its output (in my tests it took ~0.2
to 0.3 seconds compared to a 1 second sleep).
2019-01-18 16:38:52 -08:00
Olivier Bellone
6b89b3b6c1
Properly serialize individual on Account objects 2019-01-18 15:31:47 +01:00
Remi Jannel
359a0c9cdf Move CheckoutSession to the Checkout namespace and rename to Session 2019-01-16 18:50:14 -08:00