Sha256: 67c210fdf9d7f55c2de7221850a27260104f989b621456b54d1a12f31bc8b317

Contents?: true

Size: 697 Bytes

Versions: 3

Compression:

Stored size: 697 Bytes

Contents

require 'razorpay/request'
require 'razorpay/entity'

module Razorpay
  # Subscription API allows you to create and
  # manage subscriptions with Razorpay
  class Subscription < Entity
    def self.request
      Razorpay::Request.new('subscriptions')
    end

    def self.create(options)
      request.create options
    end

    def self.fetch(id)
      request.fetch id
    end

    def self.all(options = {})
      request.all options
    end

    def self.cancel(id, options = {})
      request.post "#{id}/cancel", options
    end

    def cancel(options = {})
      self.class.cancel id, options
    end

    def cancel!(options = {})
      with_a_bang { cancel options }
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
razorpay-2.4.1 lib/razorpay/subscription.rb
razorpay-2.4.0 lib/razorpay/subscription.rb
razorpay-2.3.0 lib/razorpay/subscription.rb