Sha256: 92b306fb05ccb31786629bd5078eea796da38ff0f2f57db170cb8f446e970b78

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

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

module Razorpay
  # Webhook API allows you create, fetch, update and delete
  class Webhook < Entity

    @@versions = "v2"

    def self.request
      Razorpay::Request.new('accounts')
    end

    def self.create(options, account_id = nil)
      if(account_id)
       return request.post "#{account_id}/webhooks", options, @@versions
      end

      r = request
      return r.request :post, "/v1/webhooks", options
    end

    def self.all(options = {}, account_id = nil)
      if(account_id)
       return request.get "#{account_id}/webhooks" , options , @@versions
      end

      r = request
      return r.request :get, "/v1/webhooks", options
    end

    def self.fetch(id, account_id)
      request.fetch "#{account_id}/webhooks/#{id}", @@versions
    end

    def self.edit(options, id, account_id = nil)
      if(account_id)  
       return request.patch "#{account_id}/webhooks/#{id}", options, @@versions
      end

      r = request
      return r.request :put, "/v1/webhooks/#{id}" , options
    end

    def self.delete(id, account_id)
      request.delete "#{account_id}/webhooks/#{id}", @@versions
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

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