Class: Polar::Subscription

Inherits:
Resource
  • Object
show all
Defined in:
lib/polar/resources/subscription.rb

Class Method Summary collapse

Methods inherited from Resource

handle_list, handle_none, handle_one

Class Method Details

.delete(id) ⇒ Object



25
26
27
28
# File 'lib/polar/resources/subscription.rb', line 25

def self.delete(id)
  response = Client.delete_request("/v1/subscriptions/#{id}")
  handle_one(response)
end

.delete_for_customer(id) ⇒ Object



46
47
48
49
# File 'lib/polar/resources/subscription.rb', line 46

def self.delete_for_customer(id)
  response = Client.delete_request("/v1/customer-portal/subscriptions/#{id}")
  handle_one(response)
end

.export(params = {}) ⇒ Object



10
11
12
13
# File 'lib/polar/resources/subscription.rb', line 10

def self.export(params = {})
  response = Client.get_request("/v1/subscriptions/export", **params)
  handle_list(response)
end

.get(id) ⇒ Object



15
16
17
18
# File 'lib/polar/resources/subscription.rb', line 15

def self.get(id)
  response = Client.get_request("/v1/subscriptions/#{id}")
  handle_one(response)
end

.get_for_customer(id) ⇒ Object



36
37
38
39
# File 'lib/polar/resources/subscription.rb', line 36

def self.get_for_customer(id)
  response = Client.get_request("/v1/customer-portal/subscriptions/#{id}")
  handle_one(response)
end

.list(params = {}) ⇒ Object



5
6
7
8
# File 'lib/polar/resources/subscription.rb', line 5

def self.list(params = {})
  response = Client.get_request("/v1/subscriptions", **params)
  handle_list(response)
end

.list_for_customer(params = {}) ⇒ Object

Customer Portal methods



31
32
33
34
# File 'lib/polar/resources/subscription.rb', line 31

def self.list_for_customer(params = {})
  response = Client.get_request("/v1/customer-portal/subscriptions", **params)
  handle_list(response)
end

.update(id, params) ⇒ Object



20
21
22
23
# File 'lib/polar/resources/subscription.rb', line 20

def self.update(id, params)
  response = Client.patch_request("/v1/subscriptions/#{id}", **params)
  handle_one(response)
end

.update_for_customer(id, params) ⇒ Object



41
42
43
44
# File 'lib/polar/resources/subscription.rb', line 41

def self.update_for_customer(id, params)
  response = Client.patch_request("/v1/customer-portal/subscriptions/#{id}", **params)
  handle_one(response)
end