734 Commits

Author SHA1 Message Date
Brandur
2ea5c9c1a6 Fix spelling mistake in log 2015-10-10 22:08:53 -07:00
Brandur
20512b0ff7 Bump version to 1.30.1 v1.30.1 2015-10-10 12:54:44 -07:00
Brandur
452a89c02a Merge pull request #333 from stripe/brandur-remove-sort-hack
Remove sorting hack from parameter encoding
2015-10-10 12:50:07 -07:00
Brandur
77b1972a72 Use alternate testing approach to satisfy 1.8.7 2015-10-10 12:40:17 -07:00
Brandur
ca8b49e5fd Use array as input instead of hash (for 1.8.7 tests) 2015-10-10 12:12:57 -07:00
Brandur
395d16b8c1 Remove sorting hack from parameter encoding
I added this for a regression suite so that 1.8.7 could pass its tests,
but unfortunately this caused a regression in the way that parameters
are encoded for arrays of hashes. This patch reverts the change and adds
tests to detect a future regression.

(And 1.8.7 is expected to fail on this initial commit.)
2015-10-10 12:12:57 -07:00
Brandur
a41691d972 Merge pull request #332 from stripe/brandur-pass-all-filters-to-pages
Pass through all paging filters to descendent pages
2015-10-10 12:10:41 -07:00
Brandur
daf2789ad7 Pass through all paging filters to descendent pages
When additional filters were provided for pagination like an expansion
or a predicate, they would not propagate to any call after the first.
This patch addresses that issue by storing all filters and moving them
to any new page objects being created.

Fixes #331.
2015-10-09 13:58:23 -07:00
Brandur
cdb8599119 Bump version to 1.30.0 v1.30.0 2015-10-09 10:45:25 -07:00
Brandur
dc545752f1 Merge pull request #330 from stripe/brandur-stripe-object-deleted
Add `StripeObject#deleted?`
2015-10-09 10:25:48 -07:00
Brandur
900fa4b5dc Add StripeObject#deleted?
Adds a special helper to `StripeObject` that helps a developer to
determine whether or not an object is deleted.

As described originally in #257, this is a bit of a special case because
a non-deleted object does not respond with `deleted` as part of its
representation, so while a deleted object would have this accessor
available automatically, non-deleted objects would not. This made use of
the SDK awkward because the presence of the method was not guaranteed.

Fixes #257 (again, heh).
2015-10-09 10:16:59 -07:00
Brandur
b3912c1712 Merge branch 'brandur-deprecate-refresh-from'
Conflicts:
	lib/stripe/stripe_object.rb
2015-10-08 17:49:27 -07:00
Brandur
d09093fca1 Add some tests just to make sure everything is working as we expect 2015-10-08 17:43:20 -07:00
Brandur
1a96d7cf8e Use Gem:: deprecation method instead of a custom one 2015-10-08 17:24:59 -07:00
Brandur
d8dcf7c6af Merge pull request #329 from stripe/brandur-dial-down-update-attributes-safety
Have StripeObject#update_attributes reflect behavior of accessors
2015-10-08 17:08:09 -07:00
Brandur
925066efd4 Remove outdated option 2015-10-08 14:44:42 -07:00
Brandur
11dd870900 Have StripeObject#update_attributes reflect behavior of accessors
This dials down the safety of `StripeObject`'s `#update_attributes`
method so that it allows properties to be assigned that it doesn't yet
know about. We're doing this for a few reasons:

1. To reflect the current behavior of accessors (i.e. `obj.name = ...`)
   through `method_missing`.
2. To allow `#update_attributes` to assign properties on new projects
   that don't yet know their schema from an API call.

Fixes #324.
2015-10-08 14:04:11 -07:00
Brandur
3468698ce9 Make 1.8 happy 2015-10-08 10:03:18 -07:00
Brandur
8b255c7005 Deprecate StripeObject#refresh_from
As discussed in #325, this deprecates the public visibility of
`#refresh_from` (by renaming it). It also adds some deprecation
infrastructure to produce warnings when it's used.
2015-10-08 09:57:16 -07:00
Brandur
e75fd86ae5 Fix miswording of error message 2015-10-08 07:39:56 -07:00
Brandur
dd22228f43 Merge pull request #323 from stripe/brandur-cgi-escape
Replace deprecated `URI.escape` with a customized `CGI.escape`
2015-10-06 17:53:55 -07:00
Brandur
eb8787754c Replace deprecated URI.escape with a customized CGI.escape
Replaces my original attempt in #319 in a way that doesn't depend on
`URI.encode_www_form` which doesn't exist in 1.8.7. This should
hopefully get us the best of all worlds.

Caveats around use of `+` instead of `%20` as detailed in #319 still
apply.

Fixes #286.
2015-10-06 14:46:58 -07:00
Brandur
0485de9669 Merge pull request #322 from stripe/brandur-add-regression-suite
Add regression suite for testing parameter encoding
2015-10-06 14:44:20 -07:00
Brandur
5853fd47dd Add one more set of tests for #url_encode 2015-10-06 14:38:14 -07:00
Brandur
91262c9042 Sort encoded parameters for stability in 1.8.7 tests 2015-10-06 14:17:51 -07:00
Brandur
a48fd12c70 Add regression suite for testing parameter encoding
Pulls the test suite out of #319 so that we can get some coverage around
parameter encoding. This should prevent any recurrence of #318.

Also includes a little bit of refactoring.
2015-10-06 14:04:02 -07:00
Brandur
b7d714b58e Bump version to 1.29.1 v1.29.1 2015-10-06 13:40:13 -07:00
Kyle Conroy
2f09c74c01 Merge pull request #321 from stripe/revert-299-brandur-uri-escape
Revert removal of `URI.escape`
2015-10-06 13:37:35 -07:00
Brandur
d38250d717 Revert "Remove use of deprecated URI.escape" 2015-10-06 13:30:39 -07:00
Brandur
a2b56178fe Bump version to 1.29.0 v1.29.0 2015-10-05 12:56:44 -07:00
Brandur
d92983c22a Merge pull request #317 from stripe/brandur-extend-create
Extend Stripe::APIOperations::Create instead of including
2015-10-05 12:43:26 -07:00
Brandur
aa7e559115 Extend Stripe::APIOperations::Create instead of including
Lets not be too shy about just using `extend` instead of `include` here
when it's more appropriate to do so. The advantage to this approach is
that the module can be either extended _or_ included with this change,
but couldn't be without it due to the `ClassMethods` meta-magic.

List has already started doing this as of #314, so we don't have to be
afraid of breaking convention here.
2015-10-05 12:24:53 -07:00
Brandur
e2692e9805 Merge pull request #314 from stripe/brandur-pagination
Pagination
2015-10-05 12:23:01 -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
Brandur
60b7617624 Bump version to 1.28.1 v1.28.1 2015-10-05 11:45:37 -07:00
Kyle Conroy
8287904c00 Merge pull request #316 from stripe/apt-file-uploads-retrieve-url
Use correct URL for file upload retrieval
2015-10-05 11:36:30 -07:00
Brandur
84f3bd8f17 Bump version to 1.28.0 v1.28.0 2015-10-05 11:00:34 -07:00
Jieren Chen
7d28eaab64 Merge pull request #310 from stripe/drj/t5176-legal-entity-override
Disallow directly overriding legal_entity
2015-10-02 12:12:09 -07:00
Brandur
90c6eeb398 Merge pull request #311 from stripe/brandur-mass-assign
Add attribute mass assignment and use it in #save
2015-10-02 09:29:55 -07:00
Andrew Thorp
841a34385a Use correct URL for file upload retrieval 2015-10-01 17:36:51 -07:00
Brandur
b57cd5aca4 Support Ruby 1.8.7 2015-10-01 16:59:56 -07:00
Brandur
71a44f70f5 Move internal method to protected 2015-10-01 16:28:21 -07:00
Jieren Chen
387edb5163 PR Fix: rename to protected_fields 2015-10-01 16:26:30 -07:00
Brandur
e23b57628f Add attribute mass assignment and use it in #save
As detailed in issue #119, we've somewhat unfortunately been allowing
object attributes to be passed in during a #save because we mix any
arguments directly into the serialized hash (it seems that this was
originally intended to be used more for meta parameters that go to the
request).

As also noted in #119, this use causes problems when certain types of
parameters (like subobjects) are used. We're now left in the somewhat
awkward position of either:

1. Removing this functionality on #save and breaking what may be
   behavior that people depend on.
2. Fully support this mass assignment.

This patch takes the second path by extracting a new #update_attributes
method and using it from #save. It's still far from a perfect approach
because keys that have the same name as certain options (e.g. `req_url`)
are not going to work, but it should capture the behavior that most
people want.

Fixes #119.
2015-10-01 16:21:34 -07:00
Jieren Chen
e451e3d3e2 Fix test 2015-10-01 13:51:55 -07:00
Jieren Chen
797478786d Disallow directly overriding legal_entity 2015-10-01 13:39:11 -07:00
Brandur
df2e36287d Merge pull request #309 from stripe/brandur-boolean-accessors
Add question mark helpers (e.g. #paid?) for boolean object values
2015-09-30 14:36:23 -07:00
Brandur
a88b062beb Merge pull request #300 from stripe/brandur-upsert
Create if #save is called on a new object
2015-09-30 13:54:20 -07:00
Brandur
c301c6c0f6 Add question mark helpers (e.g. #paid?) for boolean object values
This patch adds question marks helpers (e.g. #paid?) for any values in a
StripeObject that are a boolean. This is fairly idiomatic Ruby in that
it behaves similarly to other libraries like ActiveRecord.

Note that a caveat here is that nullable booleans will not get a helper
added for them if their current value is null. For this reason, we
should eventually prefer to derive these methods from some sort of
programmatic API manifest.

Replaces #257 and #274.
2015-09-30 13:48:59 -07:00
Brandur
a6a2664746 Merge pull request #303 from stripe/brandur-no-email-notifications
Don't give build notifications via e-mail
2015-09-30 13:28:31 -07:00