Sha256: 962215ffc86d120ced849e476dfea14132a9f6c647d06d5b267f9530defa7a2f

Contents?: true

Size: 700 Bytes

Versions: 4

Compression:

Stored size: 700 Bytes

Contents

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

module Razorpay
  # Addon API allows you to fetch and delete
  # subscription-addons with Razorpay
  class Addon < Entity
    def self.request
      Razorpay::Request.new('addons')
    end

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

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

    def self.create(subscription_id, options)
      r = request
      # POST /addons is not supported
      # Addon creation endpoint is:
      # POST subscriptions/{sub_id}/addons
      r.request :post, "/v1/subscriptions/#{subscription_id}/addons", options
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
razorpay-3.2.2 lib/razorpay/addon.rb
razorpay-3.2.1 lib/razorpay/addon.rb
razorpay-3.2.0 lib/razorpay/addon.rb
razorpay-3.1.0 lib/razorpay/addon.rb