stripe-ruby/lib/stripe/subscription.rb
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

26 lines
676 B
Ruby

module Stripe
class Subscription < APIResource
include Stripe::APIOperations::Update
include Stripe::APIOperations::Delete
def url
"#{Customer.url}/#{CGI.escape(customer)}/subscriptions/#{CGI.escape(id)}"
end
def self.retrieve(id, opts=nil)
raise NotImplementedError.new("Subscriptions cannot be retrieved without a customer ID. Retrieve a subscription using customer.subscriptions.retrieve('subscription_id')")
end
def delete_discount
response, opts = request(:delete, discount_url)
initialize_from({ :discount => nil }, opts, true)
end
private
def discount_url
url + '/discount'
end
end
end