Module: Subscription

Defined in:
lib/paystackapi/core/subscription.rb

Class Method Summary collapse

Class Method Details

.create_subscription(body) ⇒ Object



2
3
4
5
6
7
# File 'lib/paystackapi/core/subscription.rb', line 2

def self.create_subscription(body)
	api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}",
		:body => body.to_json,
		:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
	return api
end

.disable_subscriptionObject



18
19
20
21
22
23
# File 'lib/paystackapi/core/subscription.rb', line 18

def self.disable_subscription
	api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}/" + "disable",
		:body => body.to_json,
		:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
	return api
end

.enable_subscriptionObject



24
25
26
27
28
29
# File 'lib/paystackapi/core/subscription.rb', line 24

def self.enable_subscription
	api = HTTParty.post("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}/" + "enable",
		:body => body.to_json,
		:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
	return api
end

.list_single_subscription(body) ⇒ Object



13
14
15
16
17
# File 'lib/paystackapi/core/subscription.rb', line 13

def self.list_single_subscription(body)
	api = HTTParty.get("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}" + "#{body}",
		:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
	return api
end

.list_subscriptionObject



8
9
10
11
12
# File 'lib/paystackapi/core/subscription.rb', line 8

def self.list_subscription
	api = HTTParty.get("#{API::BASE_URL}" + "#{API::SUBSCRIPTION_PATH}",
		:headers => { "Authorization"=> ENV["PAYSTACK_SECRET_KEY"], "content-type" => "application/json"})
	return api
end