Sha256: 14594803505917adba84c47a5ef9614d4ef4193bd94cb3e9a94e83dccfa59974

Contents?: true

Size: 697 Bytes

Versions: 3

Compression:

Stored size: 697 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, "/subscriptions/#{subscription_id}/addons", options
    end

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

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
razorpay-3.0.1 lib/razorpay/addon.rb
razorruby-3.0.4 lib/razorpay/addon.rb
razorruby-3.0.1 lib/razorpay/addon.rb