Class: Aptible::BillForward::Account
- Inherits:
-
Resource
- Object
- Sawyer::Resource
- Resource
- Aptible::BillForward::Account
show all
- Defined in:
- lib/aptible/billforward/resource/account.rb
Instance Method Summary
collapse
Methods inherited from Resource
all, basename, by_subscription_id, #client, client, collection_path, create, find, #href, #invoice, #subscription, #update
Instance Method Details
#bootstrap_active_subscription(params) ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/aptible/billforward/resource/account.rb', line 28
def bootstrap_active_subscription(params)
subscription = create_subscription params.slice(:productRatePlanID)
payment_method = Aptible::BillForward::PaymentMethod.find(
params[:payment_method_id]
)
subscription.link_payment_method payment_method
subscription.update(state: 'AwaitingPayment')
end
|
#create_payment_method(params) ⇒ Object
8
9
10
11
12
|
# File 'lib/aptible/billforward/resource/account.rb', line 8
def create_payment_method(params)
Aptible::BillForward::PaymentMethod.create(
params.merge(accountID: id)
)
end
|
#create_subscription(params) ⇒ Object
14
15
16
17
18
|
# File 'lib/aptible/billforward/resource/account.rb', line 14
def create_subscription(params)
Aptible::BillForward::Subscription.create(
params.merge(accountID: id)
)
end
|
#payment_methods(params = {}) ⇒ Object
20
21
22
|
# File 'lib/aptible/billforward/resource/account.rb', line 20
def payment_methods(params = {})
Aptible::BillForward::PaymentMethod.by_account_id(id, params)
end
|
#serialize ⇒ Object
4
5
6
|
# File 'lib/aptible/billforward/resource/account.rb', line 4
def serialize
to_attrs
end
|
#subscriptions(params = {}) ⇒ Object
24
25
26
|
# File 'lib/aptible/billforward/resource/account.rb', line 24
def subscriptions(params = {})
Aptible::BillForward::Subscription.by_account_id(id, params)
end
|