Permalink
Browse files

Added cancellation message option for subscription canceling

  • Loading branch information...
1 parent 48d856c commit b3ece02aa1af26bb088974f12d3fc99f3f5d0385 Carson Reinke committed Mar 29, 2012
Showing with 7 additions and 2 deletions.
  1. +7 −2 lib/chargify_api_ares/resources/subscription.rb
@@ -13,8 +13,13 @@ def save
super
end
- def cancel
- destroy
+ def cancel(cancellation_message = nil)
+ if cancellation_message.nil?
+ destroy
+ else
+ #Destory does not support body, must work around it to send verb DELETE
+ self.connection.post(element_path, {:cancellation_message => cancellation_message}.to_xml(:root => :subscription), self.class.headers.merge({'X-Http-Method-Override' => 'DELETE'}))
@hedgehog

hedgehog Mar 30, 2012

Does this need to be be adjusted to allow for JSON format, or is it immaterial?

@carsonreinke

carsonreinke Mar 30, 2012

Owner

Well, if so, looks like this method is wrong also (unless I am missing something):

def charge(attrs = {})
  post :charges, {}, attrs.to_xml(:root => :charge)
end
+ end
end
def component(id)

0 comments on commit b3ece02

Please sign in to comment.