750 Commits

Author SHA1 Message Date
Brandur
d250120102 Workaround for mime-types related failures on 1.9 2016-07-11 15:06:56 -07:00
Brandur
d6c73c2b65 Merge pull request #438 from stripe/brandur-remove-restclient-workaround
Remove hack to work around rest-client bug
2016-07-07 11:16:51 -07:00
Brandur
ac49ef0b59 Remove hack to work around rest-client bug
This removes a hack in the code that's designed to work around a
rest-client bug which was added back in 2011. Unfortunately neither
comments nor commit messages bother to tell us what the nature of the
bug actually was, but based on what it's rescuing, it might be
rest-client/rest-client#58, which has been fixed for over five years
now.

Following up on the work done in #436, let's continue to try and simply
the error handling paths by taking this out.
2016-07-07 09:25:48 -07:00
Brandur
660f7725b7 Bump version to 1.46.0 v1.46.0 2016-07-07 09:20:14 -07:00
Brandur
b97e1010c0 Merge pull request #436 from stripe/brandur-retry-conflict
Rework HTTP retry path + retry 409s
2016-07-07 09:19:36 -07:00
Brandur
bf1cc03227 Bump version to 1.45.0 v1.45.0 2016-07-07 09:05:25 -07:00
Brandur
e2499edfa3 Merge pull request #433 from stripe/brandur-serialize-whitelist
Go back to not saving subresources, but exclude `Customer#source=`
2016-07-07 09:04:06 -07:00
Brandur
3984246514 Rework HTTP retry path + retry 409s
Two changes:

1. The HTTP retry path has been refactored to make retries on errors
that are not RestClient exceptions possible by bringing the logic up a
level. This also has the effect of somewhat simplifying the exception
handling logic which can be somewhat difficult to reason about right
now.

2. Retry on `RestClient::Conflict` (a 409 from the API) as discussed in
issue #431.

Fixes #431.
2016-07-05 12:37:39 -07:00
Brandur
6a41234406 Additional commentary on #source= method and implementation 2016-07-01 15:54:38 -07:00
Brandur
6560cfaf4b Don't talk about "default source" here 2016-07-01 15:54:38 -07: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
Brandur
d0a3493144 Revert "Remove check that prevents API resource subobjects from being serialized"
This reverts commit 7bbc6ef2e59006cc6d9410a92a09d8c5c68d2893.
2016-07-01 15:54:38 -07:00
Brandur
be8466b47b Merge pull request #434 from stripe/brandur-fix-ci
Fix Gem builds in CI
2016-07-01 15:54:18 -07:00
Brandur
1e166d9be7 Fix Gem builds in CI
CI is failing for a number of Ruby versions because shoulda is pulling
in should-matchers, which then pulls in activesupport. activesupport's
new 5.0.0 version is being picked up, and that requires at least Ruby
2.2.2.

Luckily the solution is easy, we're not using shoulda-matchers, only
shoulda-context, so just tighten up our dependencies a little and the
problem goes away.
2016-07-01 15:44:32 -07:00
Brandur
774e885334 Clean up comments around exponential backoff 2016-06-30 10:44:08 -07:00
Kyle Conroy
8377a9f941 Bump version to 1.44.0 v1.44.0 2016-06-29 14:35:07 -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
cb8917b7a3 Merge pull request #432 from Edouard-chin/req_url_doc_fix
Removed a forgotten line of doc [ci skip]:
2016-06-29 07:23:07 -07:00
Edouard CHIN
d288be358a Removed a forgotten line of doc [ci skip]:
- This removes the doc about `req_url` while saving a StripeObject, this options was removed in `e226ef`
2016-06-29 02:11:56 -04:00
Brandur
f2aa8c1e58 Bump version to 1.43.1 v1.43.1 2016-06-17 14:48:07 -07:00
Brandur
ea06b1ba67 Merge pull request #428 from stripe/rasmus-fix_order_return_object
Convert return_order response to OrderReturn.
2016-06-17 14:47:14 -07:00
Rasmus Rygaard
f37a1f2f9f Convert return_order response to OrderReturn. 2016-06-17 11:03:56 -07:00
Brandur
3b06b2c880 Merge pull request #424 from JuanitoFatas/fix/gemspec-homepage
Fix homepage for Ruby docs in gemspec
2016-06-13 09:07:40 -07:00
JuanitoFatas
f4f8d38643 Fix homepage for Ruby docs in gemspec 2016-06-13 18:07:11 +08:00
Brandur
6fb907b322 Merge pull request #423 from stripe/brandur-document-convert
Document `Util.convert_to_stripe_object`
2016-06-09 09:39:24 -07:00
Brandur
6695340d50 Minor fixes to Rubydoc of #update_attributes 2016-06-09 09:19:28 -07:00
Brandur
531e0ff317 Document Util.convert_to_stripe_object
Adds some basic documentation to `Util.convert_to_stripe_object`.
2016-06-09 09:02:23 -07:00
Brandur
6920d9db68 Update authors/email in Gemspec
Unfortunately neither of these people work for Stripe anymore. Let's put
a valid contact email address in here instead.
2016-05-25 10:55:29 -07:00
Brandur
065ad92c0e Bump version to 1.43.0 v1.43.0 2016-05-20 10:32:29 -07:00
Brandur
31c6fbe8bb Merge pull request #419 from stripe/rasmus-add_order_returns
Add order returns
2016-05-20 10:28:02 -07:00
Rasmus Rygaard
6202d66873 Add tests for return deletion, updating. 2016-05-20 09:54:09 -07:00
Rasmus Rygaard
dab45737c9 Add order returns. 2016-05-18 17:56:15 -07:00
Brandur
43c86909d7 Merge pull request #418 from stripe/remi-add-alipay-account
Support AlipayAccount retrieval and deletion
2016-05-18 11:02:03 +02:00
Remi Jannel
2a6673a8e5 Support AlipayAccount retrieval and deletion 2016-05-17 17:52:00 -04:00
Kyle Conroy
49382f7ac2 Bump version to 1.42.0 v1.42.0 2016-05-04 14:15:44 -07:00
Jacqueline
60248fbd00 Use v1/subs endpoints for operations on subs and allow direct sub access (#411)
* allow subs to be retrieved & created with new v1/subs API endpoint

* edit tests to check for url

* fix customer subscription URLs to go through v1/customers
2016-05-04 14:14:24 -07:00
Brandur
ca7adcf8c8 Bump version to 1.41.0 v1.41.0 2016-04-13 14:00:35 -07:00
Brandur
679b2b9b19 Merge pull request #412 from Edouard-chin/global-stripe-account-head
Allow `stripe_account` to be set globally:
2016-04-13 13:58:32 -07:00
Edouard CHIN
75f366acb9 Allow stripe_account to be set globally:
- When performing requests on the behalf of a managed account, `stripe_account` option must be passed everytime, this can become redundant
- Allowing to set the `stripe_account` globally makes thing easier for wrapping every request in a single method, the same way as it is for defining the `api_key` globally
2016-04-13 20:40:55 +00:00
Brandur
c98f555aeb Merge pull request #410 from stripe/brandur-fix-warnings
Fix warnings emitted during tests
2016-04-11 15:47:32 -07:00
Brandur
2663e9ff85 Merge pull request #409 from stripe/br-charge-outcomes
add test for handling of charge.outcome subfield
2016-04-11 15:23:43 -07:00
Brandur
8f55baa6ea Fix warnings emitted during tests
I'm not sure exactly what changed here (did we change the `$VERBOSE`
setting?), but I'm not seeing a whole lot of warnings when running the
test suites locally and in CI. For example:

```
Started
........................................./home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
............../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
......../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
.../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
........./home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
...
..../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
....../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
..../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
......./home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
........./home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
........../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
................./home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
.../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
..../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
....../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
..........
........./home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
....../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
......../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
......../home/travis/build/stripe/stripe-ruby/lib/stripe/api_operations/list.rb:6: warning: instance variable @opts not initialized
............./home/travis/build/stripe/stripe-ruby/lib/stripe/stripe_object.rb:35: warning: instance variable @values not initialized
./home/travis/build/stripe/stripe-ruby/lib/stripe/stripe_object.rb:35: warning: instance variable @values not initialized
...................../home/travis/build/stripe/stripe-ruby/lib/stripe/transfer.rb:8: warning: instance variable @api_key not initialized
..............
..
Finished in 0.785621037 seconds.
```

Most of these are due to unused or uninitialized variables. This patch
fixes all warnings by fixing offending code.
2016-04-11 15:20:42 -07:00
Ben Rahn
6dfc4e8c25 add test for handling of charge.outcome subfield 2016-04-11 14:47:30 -07:00
Karla
cb734cfeac Merge pull request #408 from stripe/karla-openssl-errors
Catch SSL connection errors, and re-raise them as APIConnectionErrors
2016-04-11 10:39:13 -07:00
Karla Burnett
0046cd1e4f Catch SSL connection errors, and re-raise them as APIConnectionErrors
This is consistent with API library behavior in other languages, and with our
API documentation (which doesn't mention needing to handle this type of error).
2016-04-08 18:15:22 -07:00
Brandur
37cde9ed03 Bump version to 1.40.0 v1.40.0 2016-04-06 15:53:54 -07:00
Brandur
2c79925212 Merge pull request #407 from stripe/brandur-remove-api-resource-check
Remove check that prevents API resource subobjects from being serialized
2016-04-06 13:47:38 -07:00
Brandur
bebf77e099 Merge pull request #397 from stripe/brandur-ca-store
Initialize an internal CA store
2016-04-05 10:53:44 -07:00
Brandur
7bbc6ef2e5 Remove check that prevents API resource subobjects from being serialized
Prior to my last major serialization refactor, there was a check in the
code that would remove any subobjects from serialization that were of
their own proper resource type (for example, if a charge contained a
customer, that customer would be removed).

What I didn't realize at the time is that the old serialization code had
a bug/quirk that would allow *certain types* of subobjects that were API
resources to make it through unscathed.

In short, the behavior requirement here is *directly* contradictory.
There was a test in place that would make sure that `customer` was
removed from this hash:

``` ruby
{
  :id => 'ch_id',
  :object => 'charge',
  :customer => {
    :object => 'customer',
    :id => 'customer_id'
  }
}
```

But, as reported in #406, we expect, and indeed need, for `source` (a
card) to make it through to the API in this hash:

``` ruby
{
  :id => 'cus_id',
  :object => 'customer',
  :source => {
    :object => 'card',
    :id => 'card_id'
  }
}
```

My proposal here is to just remove the check on serializing API
resources. The normal code that only sends up keys/hashes that have
changed is still in place, so in the first example, `customer` still
isn't sent unless the user has directly manipulated a field on that
subobject. I propose that in those cases we allow the API itself to
reject the request rather than try to cut it off at the client level.

Unfortunately, there is some possibility that removing those API
resources is important for some reason, but of course there's no
documentation on it beyond the after-the-fact post-justification that I
wrote during my last refactor. I can't think of any reason that it would
be too destructive, but there is some level of risk.
2016-04-01 10:54:53 -07:00
Brandur
3930d9a587 Bump version to 1.39.0 v1.39.0 2016-03-31 14:43:52 -07:00