Class: CloudPayments::Namespaces::Subscriptions
- Inherits:
-
Base
- Object
- Base
- CloudPayments::Namespaces::Subscriptions
show all
- Defined in:
- lib/cloud_payments/namespaces/subscriptions.rb
Instance Attribute Summary
Attributes inherited from Base
#client, #parent_path
Instance Method Summary
collapse
Methods inherited from Base
#initialize, #request, resource_name
Instance Method Details
#cancel(id) ⇒ Object
25
26
27
|
# File 'lib/cloud_payments/namespaces/subscriptions.rb', line 25
def cancel(id)
request(:cancel, id: id)[:success]
end
|
#create(attributes) ⇒ Object
15
16
17
18
|
# File 'lib/cloud_payments/namespaces/subscriptions.rb', line 15
def create(attributes)
response = request(:create, attributes)
Subscription.new(response[:model])
end
|
#find(id) ⇒ Object
5
6
7
8
|
# File 'lib/cloud_payments/namespaces/subscriptions.rb', line 5
def find(id)
response = request(:get, id: id)
Subscription.new(response[:model])
end
|
#find_all(account_id) ⇒ Object
10
11
12
13
|
# File 'lib/cloud_payments/namespaces/subscriptions.rb', line 10
def find_all(account_id)
response = request(:find, account_id: account_id)
Array(response[:model]).map { |item| Subscription.new(item) }
end
|
#update(id, attributes) ⇒ Object
20
21
22
23
|
# File 'lib/cloud_payments/namespaces/subscriptions.rb', line 20
def update(id, attributes)
response = request(:update, attributes.merge(id: id))
Subscription.new(response[:model])
end
|