708 Commits

Author SHA1 Message Date
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
Brandur
4be5c9d23d Merge pull request #402 from stripe/brandur-cybertrust
Add "CyberTrust Global Root"
2016-03-31 14:35:29 -07:00
Brandur
9ae8a49697 Merge pull request #404 from stripe/brandur-improve-error-message
Improve error message on setting empty strings
2016-03-28 08:09:21 -07:00
Brandur
98d06ae6df Improve error message on setting empty strings
This improves the error message that a user sees when attempting to set
a property to an empty string.

Fixes #403.
2016-03-24 10:58:59 -07:00
Brandur
4947b0dfd0 Add "CyberTrust Global Root"
This allows old OpenSSL versions (0.9.8 and 1.0.0) to successfully
verify Stripe's certificate chain.
2016-03-22 17:10:55 -07:00
Brandur
e18823e63b Bump version to 1.38.0 v1.38.0 2016-03-18 08:50:59 -07:00
Brandur
38f3263abe Merge pull request #401 from herimedia/add-options-to-save
Allow options (headers) to be passed into .save
2016-03-18 08:49:48 -07:00
Niels Ganser
db3059a3c0 Allow options (headers) to be passed into .save
in the same manner as is already possible for .create.
2016-03-18 13:30:36 +01:00
Brandur
b2db930f6a Bump version to 1.37.0 v1.37.0 2016-03-14 14:30:56 -07:00
Brandur
efe4deb847 Merge pull request #400 from stripe/gregsabo-add-account-reject
Create account.reject method.
2016-03-14 14:30:12 -07:00
Greg Sabo
2c0f6bc219 Create account.reject method. 2016-03-14 13:43:19 -07:00
Brandur
b17cf0b78b Merge pull request #399 from stripe/brandur-fix-warning
Initialize @max_network_retries
2016-03-14 10:24:54 -07:00
Brandur
5c47264cc2 Initialize @max_network_retries
Certain platforms will throw an error if this variable is accessed
without being initialized. Assign it a value instead of relying on the
OR operator to give it a default.
2016-03-14 10:16:14 -07:00
Brandur
dfa0bf75a8 Merge pull request #398 from stripe/brandur-byebug-platform-lock
Lock Byebug to just the MRI
2016-03-14 10:15:39 -07:00
Brandur
a905da2ff2 9.0.5.0 instead? 2016-03-14 09:56:35 -07:00
Brandur
dd2bae2057 Lock Byebug to just the MRI
Here we predicate the installation of Byebug on being on the MRI. This
allows us to `bundle install` on alternate platforms like JRuby.

Also performs some Gemfile management: add latest MRI and JRuby versions
and remove special case Gemfiles.
2016-03-14 08:59:13 -07:00
Brandur
5ea3c264e3 Initialize an internal CA store
This attempts to give some semblance of thread safety to parallel
library requests by pre-assigning a certificate store, the
initialization of which seems to be a weak point for thread safety. Note
that while this does seem to empirically improve the situation, it
doesn't guarantee actual thread safety.

A longer term solution to the problem is probably to assign a per-thread
HTTP client for much stronger guarantees, but this is a little further
out. More discussion on that topic in #313.

Fixes #382.
2016-03-14 07:57:51 -07:00
Brandur
c3c541363b Bump version to 1.36.2 v1.36.2 2016-03-14 07:25:28 -07:00
Brandur
5c999c3100 Merge pull request #396 from stripe/brandur-fix-list
Fix reference to URLs on ListObject
2016-03-14 07:24:14 -07:00
Brandur
0311b4a7cd Fix reference to URLs on ListObject
In #394 we renamed `url` to `resource_url` in order to prevent name
collisions in API resource that also have a `url` property.
Unfortunately, this didn't account for the fact that when making API
calls on a list object we rely on a returned `url` property to build a
request, and this had been renamed to `resource_url`. Test should have
caught this, but they were written to work differently than how live
API calls actually function.

This patch repairs the problem by adding a `resource_url` to list
objects, and modifies test to be more accurate to reality so that
they'll catch this class of problem in the future.

Fixes #395.
2016-03-14 06:52:26 -07:00
Brandur
f612aa9057 Merge pull request #394 from shekibobo/feature/resource-url
Fix ApiResource resource URL clashing with user-defined URL properties. Fixes #393.
2016-03-11 11:23:00 -08:00
Joshua Kovach
e226ef2ea1 Change everything from url to resource_url 2016-03-11 02:53:50 -05:00
Brandur
7849e844cd Merge pull request #390 from stripe/brandur-refactor-serialize-params
Refactor `serialize_params` under `StripeObject`
2016-03-07 11:41:48 -08:00
Brandur
b452835344 Fix spelling problem 2016-03-07 11:32:50 -08:00
Brandur
592bc89688 Refactor special case serialization for clarity 2016-03-07 11:27:45 -08:00
Brandur
dd11f4b297 Remove the ugly dirty == false 2016-03-07 11:11:57 -08:00
Brandur
27ebcbb697 Revert to opts = {} and rename to method_options 2016-03-07 09:59:33 -08:00
Brandur
eba117d5e8 Kill outdated "two" 2016-03-07 09:56:08 -08:00
Brandur
06cbe6239a Improve the accuracy on the comment above Hash serialization 2016-03-04 19:26:08 -08:00
Brandur
c173f802a6 Add comment about APIResource exclusion for clarity 2016-03-04 19:24:15 -08:00
Brandur
adcb806aac Add test to check .serialize_params deprecation 2016-03-04 19:22:17 -08:00
Brandur
f215827e2f Remove uses and deprecate .serialize_params 2016-03-04 19:18:26 -08:00
Brandur
fcfef21c77 Add spec for #dirty! 2016-03-04 19:10:59 -08:00
Brandur
f723080220 Refactor serialize_params under StripeObject
This pull does two major things:

1. Refactors `serialize_params` to be more concise and readable while
   still complying to our existing test suite. Unfortunately over time
   this method has become a ball of mud that's very difficult to reason
   about, as recently evidenced by #384.
2. Moves `serialize_params` from class method to instance method (while
   still keeping for old class method for backwards compatibility). This
   is to give it a more sane interface.
2016-03-04 19:04:29 -08:00
Brandur
fa314f6166 Bump version to 1.36.1 v1.36.1 2016-03-04 15:01:05 -08:00
Brandur
127c6694e8 Merge pull request #389 from stripe/brandur-fix-save-with-hash
Fix serialization of hashes passed to `#save`
2016-03-04 14:59:44 -08:00
Brandur
d92d084211 Add a few more low-level StripeObject tests 2016-03-04 14:52:30 -08:00
François de Metz
bc6cc96310 Fix serialization of hash when calling save.
Hashes are converted to StripeObject when used as params of save.
They need to be converted to hash on serialize.

Signed-off-by: François de Metz <francois@stormz.me>
Signed-off-by: Cyril Duez <cyril@stormz.me>
2016-03-04 14:40:57 -08:00
Brandur
abbf4c6426 Fix some gross trailing whitespace 2016-03-04 14:03:32 -08:00
Brandur
f711494f54 Merge pull request #387 from stripe/brandur-pass-params-fee-refund
Pass params and opts through on `ApplicationFee#refund`
2016-03-03 23:59:33 -08:00
Brandur
3fab2cd59f Pass params and opts through on ApplicationFee#refund
`params` and `opts` are not currently passed through when using the
`#refund` helper on `ApplicationFee`. This was an omission on the
original refactor to use the new endpoint, and wasn't an intentional
design.

Fixes #386.
2016-03-02 13:45:57 -08:00
Brandur
24632af95a Merge pull request #385 from stripe/brandur-md-readme
Change README to Markdown
2016-02-22 16:20:28 -08:00
Brandur
f7717208ae Change README to Markdown
This is kind of a bike shed, but at this point it's a little more clear
that Markdown has won the format wars and that people are a little more
used to seeing/editing it.

This moves the `README` to Markdown and also includes some minor
cleanup:

* Fixes a broken reference link (`curl`).
* Normalizes lines to 80 characters.
* Normalizes code snippets to be prefixed by four spaces.
* Normalizes sentence to be separately by only a single space.
2016-02-22 16:07:07 -08:00