Class: Razorpay::Subscription

Inherits:
Entity
  • Object
show all
Defined in:
lib/razorpay/subscription.rb

Overview

Subscription API allows you to create and manage subscriptions with Razorpay

Instance Attribute Summary

Attributes inherited from Entity

#attributes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#initialize, #method_missing, #respond_to_missing?, #to_json, #with_a_bang

Constructor Details

This class inherits a constructor from Razorpay::Entity

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Razorpay::Entity

Class Method Details

.all(options = {}) ⇒ Object



20
21
22
# File 'lib/razorpay/subscription.rb', line 20

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

.cancel(id, options = {}) ⇒ Object



24
25
26
# File 'lib/razorpay/subscription.rb', line 24

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

.cancel_scheduled_changes(id) ⇒ Object



44
45
46
# File 'lib/razorpay/subscription.rb', line 44

def self.cancel_scheduled_changes(id)
  request.post "#{id}/cancel_scheduled_changes"
end

.create(options) ⇒ Object



12
13
14
# File 'lib/razorpay/subscription.rb', line 12

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

.delete_offer(id, offerId) ⇒ Object



56
57
58
# File 'lib/razorpay/subscription.rb', line 56

def self.delete_offer(id, offerId)
  request.delete "#{id}/#{offerId}"
end

.fetch(id) ⇒ Object



16
17
18
# File 'lib/razorpay/subscription.rb', line 16

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

.pause(id, options = {}) ⇒ Object



48
49
50
# File 'lib/razorpay/subscription.rb', line 48

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

.requestObject



8
9
10
# File 'lib/razorpay/subscription.rb', line 8

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

.resume(id, options = {}) ⇒ Object



52
53
54
# File 'lib/razorpay/subscription.rb', line 52

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

Instance Method Details

#cancel(options = {}) ⇒ Object



28
29
30
# File 'lib/razorpay/subscription.rb', line 28

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

#cancel!(options = {}) ⇒ Object



32
33
34
# File 'lib/razorpay/subscription.rb', line 32

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

#edit(options = {}) ⇒ Object



36
37
38
# File 'lib/razorpay/subscription.rb', line 36

def edit(options = {})
  self.class.request.patch id, options
end

#pending_updateObject



40
41
42
# File 'lib/razorpay/subscription.rb', line 40

def pending_update
  self.class.request.get "#{id}/retrieve_scheduled_changes"
end