550 Commits

Author SHA1 Message Date
Brandur
6acd21ac48 Support "app info" for plugins in Ruby
Adds support for "app info" (a mechanism that allows a plugin's author
to identify that plugin) in Ruby. This is already supported in PHP and
we're adding it elsewhere.
2017-04-14 14:37:01 -07:00
Jay Hayes
44bad70987 Include predicate for lazily added boolean accessors
Previously, the value of whatever accessor was missing was left out of
the call to build it. This had the effect of skipping over the
lazily-built predicate method when the missing accessor is for a
boolean.

Of course, I realize this all is a bit contrived as most of the time
folks aren't assigning these values manually to stripe objects. However,
in my testing it caught me by surprised that the behavior is asymmetric
depending on how and when values are assigned.

As such I believe this is a less surprising implementation.
2017-04-14 09:31:58 -05:00
Remi Jannel
65e8f505d5 Added support for the new Payout and RecipientTransfer objects
The Transfer object used to represent all movements of funds in Stripe. It
split in three resources:
- Transfer: this describes the movement of funds between Stripe accounts
and is specific to Stripe Connect.
- Payout: this describes the movement of funds from a Stripe account to a
bank account, debit card or any future payout method.
- RecipientTransfer: this describes the movement of funds from a Stripe
account to a Recipient's card or Bank Account. This is here for legacy
reasons and can only be accessed from an expanded BalanceTransaction.

This change is behind an API version so old API versions would still use
the Transfer object for everything while new API version would see the
split.

This applies beyond the new object as some properties/methods are removed
from Transfer and other properties are renamed on other objects.
2017-03-31 14:03:56 -04:00
Brandur
96e03a8443 Update some OpenAPI repository conventions
See [1] for details, but a few conventions changed around the structure
of the OpenAPI repository and the data within the fixtures file. Here we
put in some minor changes to compensate for them.

[1] https://github.com/stripe/openapi/pull/3
2017-03-23 16:28:36 -07:00
Olivier Bellone
433c660cfe Fix sources 2017-03-17 16:11:05 +01:00
Olivier Bellone
58a965523a Fix cards 2017-03-17 16:11:05 +01:00
Olivier Bellone
b8e6a385cf Adds support for detaching sources from customers 2017-03-17 16:11:05 +01:00
Brandur
bb53b3e63f Merge pull request #516 from stripe/ob-fix-512
Exclude client when dumping objects
2017-03-16 13:02:34 -07:00
Olivier Bellone
d3e40bb1de Exclude client when dumping objects 2017-03-16 20:54:13 +01:00
Jay Hayes
20553e7422 Replace invalid message Faraday::Response#code with valid #status
The Faraday::Response object does not respond to #code. The correct
message is #status. It seems this case was previously unhandled by the
test suite as there was no case for the server responding "success" with
an invalid JSON body.
2017-03-16 06:24:45 -05:00
Brandur
effce7f181 Rename schema_data to spec_data for consistency 2017-03-14 17:07:50 -07:00
Brandur
4d7019bee6 Move OpenAPI spec from spec/ to openapi/
Naming a directory `spec` in a Ruby project is terribly ambiguous. This
clarifies the purpose of this directory and makes it easier to find if
you know that you're looking for OpenAPI.
2017-03-14 17:07:50 -07:00
Brandur
6393ea6416 Expect cards instead of tokens 2017-02-23 18:12:51 -08:00
Brandur
77c8535fa3 Properly encode file uploads
As described in #506, file uploads were broken on the way over to
Faraday and unfortunately I didn't catch it because the file upload
creation test wasn't using a matcher that was strict enough to really
catch anything.

Here we add the multipart middleware to our Faraday connection, add a
compatibility layer to `FileUpload` so that we can support `File` like
the rest-client based version always did (Faraday generally expects an
`UploadIO` object), and then tighten up our tests so that we'd be able
to catch future regressions.

Fixes #506.
2017-02-21 17:35:21 -08:00
Brandur
6b2e3c1eb5 Update create params for methods that were previously too forgiving 2017-02-14 12:17:37 -08:00
Brandur
d101b3a7a1 Remove OverrideSinatra and its features because they're unused
I'd originally added this class for the first stub pass that used
OpenAPI because I thought we'd need the ability to finetune some of our
stubbed responses. It turns out that we've been able to get away without
it so far so I'm removing it for now. This commit can be reverted if it
turns out that we need it back later.
2017-02-14 12:17:37 -08:00
Brandur
b0b219844c Fix wording: hyper-schema is now OpenAPI spec 2017-02-14 12:17:37 -08:00
Brandur
02ea970f67 Remove all resource-related test data
Now that we're powering all test suites with the fixture data that's
generated along with the OpenAPI spec, we don't need this secondary
sample data anymore. Remove all of it except for helpers to simulate
different types of error responses.
2017-02-14 12:17:37 -08:00
Brandur
3f549fb5ad Port all tests over to OpenAPI
Follows the path established in 2d75c8f by porting the rest of
stripe-ruby's tests over to OpenAPI. There are a few other changes here
where I've removed some tests that are duplicated or don't make much
sense, or reorganized how we test certain things, but this commit is
largely the same migration operation applied in bulk a few dozen test
suites.
2017-02-14 12:17:37 -08:00
Brandur
5f4eff7e35 Port charge test suite to use OpenAPI spec
Ports the charge test suite over to use the stub server which is powered
by the OpenAPI spec and its fixtures.

We also introduce a number of conventions here especially around test
case naming and assertions that we'll diffuse to all other test suites
as we port them over. The entire set of tests is internally inconsistent
because of how each new module and resource was added incrementally over
time and while no strong conventions existed.
2017-02-14 12:17:37 -08:00
Brandur
f0579950a7 Add testing infrastructure to use spec and fixtures
Adds some testing infrastructure that reads in the OpenAPI spec and its
fixtures. These changes will allow us to starting porting over each of
stripe-ruby's test suites.
2017-02-14 12:17:37 -08:00
Brandur
4debb6ba5d Use one default connect per thread 2017-02-14 12:17:37 -08:00
Brandur
d4bcfd9f78 Refactor errors interfaces 2017-02-14 12:17:37 -08:00
Brandur
6dfea0d623 A few extra header tests 2017-02-14 12:17:37 -08:00
Brandur
2ade248e32 All tests working! 2017-02-14 12:17:37 -08:00
Brandur
31020c4596 Move profiling information to SystemProfiler + merge tests 2017-02-14 12:17:37 -08:00
Brandur
de08a9b986 Lots of broken tests, but working implementation! 2017-02-14 12:17:37 -08:00
Brandur
41f58e3cde Functional and tested StripeClient 2017-02-14 12:17:37 -08:00
Brandur
1c780e2b3f Working test suite! 2017-02-14 12:17:37 -08:00
Brandur
1886d9a625 Move to an alternative system based on StripeClient 2017-02-14 12:17:37 -08:00
Brandur
1412479bf6 Check that responses are set on API resources 2017-02-14 12:17:37 -08:00
Brandur
b365189ae9 Add tests for new .convert_to_stripe_object argument 2017-02-14 12:17:37 -08:00
Brandur
44fbe04bb7 Add test suite for StripeResponse 2017-02-14 12:17:37 -08:00
Brandur
3cf2ba3527 Use basic JSON.generate instead of make_response abstraction 2017-02-14 12:07:18 -08:00
Brandur
360d4e97ba Fix problems introduced by rebase + make consistent 2017-02-14 12:07:18 -08:00
Brandur
de700d3cc8 Convert the last set of tests 2017-02-14 12:07:18 -08:00
Brandur
d1d5b9d39d More tests converted 2017-02-14 12:07:18 -08:00
Brandur
0019cfdc7e More updated tests 2017-02-14 12:07:18 -08:00
Brandur
1ef1f79a16 Lots of fixed tests 2017-02-14 12:07:18 -08:00
Brandur
7ed2abffdd Remove support for Ruby 1.9
This has been discussed, but we'll finally be doing it for the next
major version so that we can introduce a few features that depend on
gems that don't support 1.9.
2017-02-14 12:07:18 -08:00
Olivier Bellone
9735255318 Better tests for sources 2017-01-19 18:32:58 +01:00
Brandur
4da4bd3ff3 Colocate uname helpers + tests
Colocates the helper methods for looking up a uname by renaming them to
have the same prefix as the base method (i.e. `get_uname`).

Also adds an additional rescue in case we try to run an executable on a
system but it wasn't founded (this should never happen).

Also adds some tests to make sure that each method gets at least a very
basic amount of exercise in the test suite.
2017-01-13 10:59:08 -08:00
Brandur
50a023a33b Add basic test for errors
Just adds a super simplistic test for the errors module. The win here is
to (hopefully) lower the friction a little bit the next time a feature
is introduced into errors because there's now suite where a new test can
be written.
2017-01-13 10:38:20 -08:00
Brandur
11a6eec5f5 Don't allow protected fields in Save.update API operation
As described in #481, adding a protected field like `legal_entity` as
part of an update API operation can cause some issues like a custom
encoding scheme not being considered and special handling around empty
values being ignored.

As a an easy fix for this, let's disallow access to protected fields in
the same way that we disallow them from being set directly on an
instance of a given model.

Helps address (but is not a complete fix for) #481.
2016-11-28 11:42:57 -08:00
Olivier Bellone
4122f9bbb3 Adds 3DS retrieve endpoint 2016-11-21 19:36:58 +01:00
Amos47
46d992cf0d allow to_s to also pretty_generate embedded StripeObjects 2016-11-17 14:28:51 -05:00
Barry Kim
4faa7d169f Create accessor methods in update_attributes 2016-10-21 17:06:58 -07:00
Brandur
7b9169712f Rename error class to be singular "permissions"
The addition of this class was unreleased so this is not a breaking
change.
2016-10-14 10:29:09 -07:00
Jack Flintermann
1806d9524c handle 403 status codes 2016-10-14 08:57:19 -04:00
Kyle Conroy
c131bcbcac Correctly encode the subscription items array (#467)
* Correctly encode the subscription items array

* Use super

* Handle non-arrays as well

* Also encode items on create
2016-09-27 13:46:57 -07:00