Class: PayPro::Subscription

Inherits:
Resource show all
Includes:
Operations::Updatable
Defined in:
lib/pay_pro/entities/subscription.rb

Constant Summary collapse

RESOURCE_PATH =
'subscriptions'

Instance Attribute Summary

Attributes inherited from Entity

#api_client

Instance Method Summary collapse

Methods included from Operations::Updatable

#update

Methods included from Operations::Requestable

#api_request

Methods inherited from Entity

create_from_data, #initialize, #inspect

Constructor Details

This class inherits a constructor from PayPro::Entity

Instance Method Details

#cancel(**options) ⇒ Object



9
10
11
# File 'lib/pay_pro/entities/subscription.rb', line 9

def cancel(**options)
  api_request(method: 'delete', uri: resource_url, options: options)
end

#create_subscription_period(body = {}, **options) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/pay_pro/entities/subscription.rb', line 29

def create_subscription_period(body = {}, **options)
  api_request(
    method: 'post',
    uri: "#{resource_url}/subscription_periods",
    body: body.to_json,
    options: options
  )
end

#pause(**options) ⇒ Object



13
14
15
# File 'lib/pay_pro/entities/subscription.rb', line 13

def pause(**options)
  api_request(method: 'post', uri: "#{resource_url}/pause", options: options)
end

#resume(**options) ⇒ Object



17
18
19
# File 'lib/pay_pro/entities/subscription.rb', line 17

def resume(**options)
  api_request(method: 'post', uri: "#{resource_url}/resume", options: options)
end

#subscription_periods(**options) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/pay_pro/entities/subscription.rb', line 21

def subscription_periods(**options)
  api_request(
    method: 'get',
    uri: "#{resource_url}/subscription_periods",
    options: options
  )
end