343 Commits

Author SHA1 Message Date
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 2016-06-17 14:48:07 -07:00
Rasmus Rygaard
f37a1f2f9f Convert return_order response to OrderReturn. 2016-06-17 11:03:56 -07: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
065ad92c0e Bump version to 1.43.0 2016-05-20 10:32:29 -07:00
Rasmus Rygaard
dab45737c9 Add order returns. 2016-05-18 17:56:15 -07: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 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 2016-04-13 14:00:35 -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
Brandur
37cde9ed03 Bump version to 1.40.0 2016-04-06 15:53:54 -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 2016-03-31 14:43:52 -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
e18823e63b Bump version to 1.38.0 2016-03-18 08:50:59 -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 2016-03-14 14:30:56 -07:00
Greg Sabo
2c0f6bc219 Create account.reject method. 2016-03-14 13:43:19 -07:00
Brandur
c3c541363b Bump version to 1.36.2 2016-03-14 07:25:28 -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
Joshua Kovach
e226ef2ea1 Change everything from url to resource_url 2016-03-11 02:53:50 -05: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
f215827e2f Remove uses and deprecate .serialize_params 2016-03-04 19:18:26 -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 2016-03-04 15:01:05 -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
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
270dfe6052 Fix grammar problem 2016-02-19 10:28:03 -08:00
Brandur
9b1315d08c Bump version to 1.36.0 2016-02-08 08:24:04 -08:00
Brandur
85f191217b A few more nominal whitespace tweaks 2016-02-08 08:23:33 -08:00
Ioannis Kolovos
f8532d225e Support for Stripe::CountrySpec 2016-02-06 16:55:29 +02:00
Brandur
3a258806a2 Bump version to 1.35.1 2016-02-03 14:06:08 -08:00
Brandur
65b92dec4b Provide compatibility patch the Charge#refund helper
An unfortunate side effect of #364 is that it broke compatibility for
users on very old API versions because their `refunds` field will come
back as an array.

This adds a compatibility layer that will allow even users on old API
versions to seamlessly upgrade their gem versions.
2016-02-03 13:45:01 -08:00
Brandur
23c61cc867 Bump version to 1.35.0 2016-02-01 05:14:43 -08:00
Brandur
91f42f4bc2 Bump version to 1.34.0 2016-01-25 11:24:07 -08:00
Rasmus Rygaard
8d8fb67aae Support deleting SKUs and products. 2016-01-25 10:32:49 -08:00
Brandur
03086b8086 Bump version to 1.33.1 2016-01-21 15:16:34 -08:00
Yogesh Khater
4fe8474279 Forward parameters passed to charge.refund
fixes #365
2016-01-21 12:00:42 +05:30
Brandur
932ddb825a Bump version to 1.33.0 2016-01-19 15:48:20 -08:00