Permalink
Browse files

Add a class and error checking for migrate

  • Loading branch information...
1 parent 955d943 commit b5798c3bff97aae685219cb64044c45987c88675 @maxdunn210 committed Apr 19, 2012
Showing with 12 additions and 1 deletion.
  1. +12 −1 lib/chargify_api_ares/resources/subscription.rb
View
13 lib/chargify_api_ares/resources/subscription.rb
@@ -61,7 +61,14 @@ def reset_balance
end
def migrate(attrs = {})
- post :migrations, :migration => attrs
+ migrate = Migrate.new
+ begin
+ http = post :migrations, :migration => attrs
+ migrate.from_xml(http.body)
+ rescue ActiveResource::ResourceInvalid, ActiveResource::ResourceNotFound => error
+ migrate.errors.from_xml(error.response.body)
+ end
+ return migrate
end
def statement(id)
@@ -113,6 +120,10 @@ class Charge < Base
self.prefix = "/subscriptions/:subscription_id/"
end
+ class Migrate < Base
+ self.prefix = "/subscriptions/:subscription_id/"
+ end
+
class Transaction < Base
self.prefix = "/subscriptions/:subscription_id/"

0 comments on commit b5798c3

Please sign in to comment.