Sha256: dd5deec3bfc045980509f1740ecb7dd1c9f214ec121a8f7fa05053d6ad11ee97

Contents?: true

Size: 696 Bytes

Versions: 1

Compression:

Stored size: 696 Bytes

Contents

module Stripe
  class Subscription < APIResource
    include Stripe::APIOperations::Update
    include Stripe::APIOperations::Delete

    def resource_url
      "#{Customer.resource_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
      _, opts = request(:delete, discount_url)
      initialize_from({ :discount => nil }, opts, true)
    end

    private

    def discount_url
      resource_url + '/discount'
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stripe-1.41.0 lib/stripe/subscription.rb