Permalink
Browse files

Merge pull request #50 from stripe/expand

Add the ability to send options with retrieve requests.
  • Loading branch information...
2 parents 3e30d5a + 06c67e4 commit 1b9f776f654fbc560b15ed8b123e6477f38014cc @boucher boucher committed Feb 4, 2013
Showing with 17 additions and 3 deletions.
  1. +5 −0 History.txt
  2. +1 −1 VERSION
  3. +1 −1 lib/stripe/api_resource.rb
  4. +9 −0 lib/stripe/stripe_object.rb
  5. +1 −1 lib/stripe/version.rb
View
@@ -1,3 +1,8 @@
+=== 1.7.10 2013-02-01
+* Add support for passing options when retrieving Stripe objects
+ e.g., Stripe::Charge.retrieve({id:"foo", expand:["customer"]})
+ Stripe::Charge("foo") is still supported as well
+
=== 1.7.9 2013-01-15
* Add support for setting a Stripe API version override.
View
@@ -1 +1 @@
-1.7.9
+1.7.10
@@ -19,7 +19,7 @@ def url
end
def refresh
- response, api_key = Stripe.request(:get, url, @api_key)
+ response, api_key = Stripe.request(:get, url, @api_key, @retrieve_options)
refresh_from(response, api_key)
self
end
@@ -11,6 +11,15 @@ class StripeObject
end
def initialize(id=nil, api_key=nil)
+ # parameter overloading!
+ if id.kind_of?(Hash)
+ @retrieve_options = id.dup
+ @retrieve_options.delete(:id)
+ id = id[:id]
+ else
+ @retrieve_options = {}
+ end
+
@api_key = api_key
@values = {}
# This really belongs in APIResource, but not putting it there allows us
View
@@ -1,3 +1,3 @@
module Stripe
- VERSION = '1.7.9'
+ VERSION = '1.7.10'
end

0 comments on commit 1b9f776

Please sign in to comment.