Sha256: d1e4e4a6fd86aabf9cab7dc611b770adf8e6a1f39172466a26323931dc70e5ce

Contents?: true

Size: 757 Bytes

Versions: 1

Compression:

Stored size: 757 Bytes

Contents

module Conekta
  class Subscription < APIResource
    include Conekta::APIOperations::Update
    include Conekta::APIOperations::ModifyMember

    def cancel
      self.modify_member("customer", "subscription", nil, "cancel", "post")
    end

    def pause
      self.modify_member("customer", "subscription", nil, "pause", "post")
    end

    def resume
      self.modify_member("customer", "subscription", nil, "resume", "post")
    end

    def url
      unless customer = self.customer
        raise ParameterValidationError.new("Could not determine which URL to request: #{self.class} instance has invalid customer: #{customer.inspect}", 'customer')
      end
      "#{Conekta::Customer.url}/#{CGI.escape(customer.id)}/subscription"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
conekta-0.3.1 lib/conekta/subscription.rb