Permalink
Browse files

Add the ability to send options with retrieve requests.

  • Loading branch information...
1 parent 3e30d5a commit 5ffde047d386be597684b03464895649edc50223 @boucher boucher committed Feb 1, 2013
Showing with 44 additions and 30 deletions.
  1. +5 −0 History.txt
  2. +1 −1 VERSION
  3. +27 −27 lib/stripe.rb
  4. +1 −1 lib/stripe/api_resource.rb
  5. +9 −0 lib/stripe/stripe_object.rb
  6. +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
View
@@ -10,39 +10,39 @@
require 'multi_json'
# Version
-require 'stripe/version'
+require './lib/stripe/version'
# API operations
-require 'stripe/api_operations/create'
-require 'stripe/api_operations/update'
-require 'stripe/api_operations/delete'
-require 'stripe/api_operations/list'
+require './lib/stripe/api_operations/create'
+require './lib/stripe/api_operations/update'
+require './lib/stripe/api_operations/delete'
+require './lib/stripe/api_operations/list'
# Resources
-require 'stripe/util'
-require 'stripe/json'
-require 'stripe/stripe_object'
-require 'stripe/api_resource'
-require 'stripe/singleton_api_resource'
-require 'stripe/list_object'
-require 'stripe/account'
-require 'stripe/customer'
-require 'stripe/invoice'
-require 'stripe/invoice_item'
-require 'stripe/charge'
-require 'stripe/plan'
-require 'stripe/coupon'
-require 'stripe/token'
-require 'stripe/event'
-require 'stripe/transfer'
+require './lib/stripe/util'
+require './lib/stripe/json'
+require './lib/stripe/stripe_object'
+require './lib/stripe/api_resource'
+require './lib/stripe/singleton_api_resource'
+require './lib/stripe/list_object'
+require './lib/stripe/account'
+require './lib/stripe/customer'
+require './lib/stripe/invoice'
+require './lib/stripe/invoice_item'
+require './lib/stripe/charge'
+require './lib/stripe/plan'
+require './lib/stripe/coupon'
+require './lib/stripe/token'
+require './lib/stripe/event'
+require './lib/stripe/transfer'
# Errors
-require 'stripe/errors/stripe_error'
-require 'stripe/errors/api_error'
-require 'stripe/errors/api_connection_error'
-require 'stripe/errors/card_error'
-require 'stripe/errors/invalid_request_error'
-require 'stripe/errors/authentication_error'
+require './lib/stripe/errors/stripe_error'
+require './lib/stripe/errors/api_error'
+require './lib/stripe/errors/api_connection_error'
+require './lib/stripe/errors/card_error'
+require './lib/stripe/errors/invalid_request_error'
+require './lib/stripe/errors/authentication_error'
module Stripe
@@ssl_bundle_path = File.join(File.dirname(__FILE__), 'data/ca-certificates.crt')
@@ -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 5ffde04

Please sign in to comment.