17 Commits

Author SHA1 Message Date
Brandur
00180c5f35 Power test suite with stripe-mock
Moves away from Committee and towards stripe-mock, an external
self-contained executable API stub server based on OpenAPI [1]. The
motivation here is that instead of making stripe-ruby a special
snowflake, we can use a single well-tested and feature-rich mock
implementation to drive every API's test suite.

[1] https://github.com/stripe/stripe-mock
2017-07-31 13:25:48 -07: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
3cf2ba3527 Use basic JSON.generate instead of make_response abstraction 2017-02-14 12:07:18 -08:00
Brandur
d1d5b9d39d More tests converted 2017-02-14 12:07:18 -08:00
Brandur
2a4a50da8e Introduce #save_with_parent flag
Introduce a `#save_with_parent` flag that allows the default behavior of
never saving API resources nested under a parent to be overridden, a
feature that we so far only know to need for updating a source under a
customer.
2016-07-01 15:54:38 -07:00
Kyle Conroy
732a494ac4 Add update class method to API resources (#426)
* Rename the `Update` operation to `Save`
* Add the `update` class method to all saveable resources
* Add tests for update method
* Add tests for plans, invoice items, and application fees
2016-06-29 14:13:42 -07:00
Brandur
42ea34b969 Pagination
Usage on a top-level collection:

```
Stripe::Customer.list.auto_paging_each do |customer|
  puts customer
end
```

Usage on a subcollection:

``` ruby
customer.invoices.auto_paging_each do |invoice|
  puts invoice
end
```

We've also renamed `#all` to `#list` to prevent confusion ("all" implies
that all resources are being returned, and in Stripe's paginated API
this was not the case). An alias has been provided for backward API
compatibility.

Fixes #167.

Replaces #211 and #248.
2015-10-05 12:15:09 -07:00
Kyle Conroy
b3610798c2 Rename test data methods 2015-07-02 11:51:38 -07:00
Amber Feng
089090cbe3 Merge pull request #121 from newaperio/lleger-create-subscription
Add ability to create subscriptions without fetching customer record. Closes #120.
2014-02-18 14:39:17 -08:00
Logan Leger
3ba9148042 Add ability to create subscriptions without fetching customer record
This commit adds `Customer#create_subscription`, which allows a
subscription to be created on a customer without first fetching the
customer record.

Previously:
```
customer = Stripe::Customer.retrieve('cus_abc123def') # GET request
customer.subscriptions.create(plan: 'cool-plan-1')    # POST request
```

**No alteration has been made to the above method; the preceding
implementation still functions as it did previously.**

With `#create_subscription`:
```
customer = Stripe::Customer.new('cus_abc123def')      # No request
customer.create_subscription(plan: 'cool-plan-1')     # POST request
```

This method removes the initial `GET` request and instead issues a
`POST` directly to create the subscription.
2014-02-18 15:12:44 -06:00
Vladimir Andrijevik
650179b2aa Fix order of assert_equal calls that were backwards 2014-02-12 20:18:52 +01:00
Jim Danz
d2058b3d1a Fixup old tests for new param style in test_subscription 2014-01-29 16:34:48 -08:00
Andrew Thorp
ff7595c006 Merge pull request #97 from surfacedamage/customer-create-upcoming-invoice
Allow creation of new Invoice off Customer
2014-01-24 20:46:08 -08:00
surfacedamage
73919cd1d5 Allow creation of new invoice off customer 2013-10-31 22:09:30 -04:00
Vipul A M
3e019adb6a Cleanup unused test variables 2013-10-25 23:23:22 +05:30
Michelle Bu
f9b13dfc2a active_card is no longer a thing 2013-10-07 10:05:59 -07:00
David Czarnecki
e593b0e0df Breakup tests into separate test files 2013-03-22 17:20:04 -04:00