Class: SolidusSubscriptions::ChurnBuster::Client
- Inherits:
-
Object
- Object
- SolidusSubscriptions::ChurnBuster::Client
- Defined in:
- lib/solidus_subscriptions/churn_buster/client.rb
Constant Summary collapse
- BASE_API_URL =
'https://api.churnbuster.io/v1'
Instance Attribute Summary collapse
-
#account_id ⇒ Object
readonly
Returns the value of attribute account_id.
-
#api_key ⇒ Object
readonly
Returns the value of attribute api_key.
Instance Method Summary collapse
-
#initialize(account_id:, api_key:) ⇒ Client
constructor
A new instance of Client.
- #report_failed_payment(order) ⇒ Object
- #report_payment_method_change(subscription) ⇒ Object
- #report_subscription_cancellation(subscription) ⇒ Object
- #report_successful_payment(order) ⇒ Object
Constructor Details
#initialize(account_id:, api_key:) ⇒ Client
Returns a new instance of Client.
10 11 12 13 |
# File 'lib/solidus_subscriptions/churn_buster/client.rb', line 10 def initialize(account_id:, api_key:) @account_id = account_id @api_key = api_key end |
Instance Attribute Details
#account_id ⇒ Object (readonly)
Returns the value of attribute account_id.
8 9 10 |
# File 'lib/solidus_subscriptions/churn_buster/client.rb', line 8 def account_id @account_id end |
#api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/solidus_subscriptions/churn_buster/client.rb', line 8 def api_key @api_key end |
Instance Method Details
#report_failed_payment(order) ⇒ Object
15 16 17 |
# File 'lib/solidus_subscriptions/churn_buster/client.rb', line 15 def report_failed_payment(order) post('/failed_payments', OrderSerializer.serialize(order)) end |
#report_payment_method_change(subscription) ⇒ Object
27 28 29 |
# File 'lib/solidus_subscriptions/churn_buster/client.rb', line 27 def report_payment_method_change(subscription) post('/payment_methods', SubscriptionPaymentMethodSerializer.serialize(subscription)) end |
#report_subscription_cancellation(subscription) ⇒ Object
23 24 25 |
# File 'lib/solidus_subscriptions/churn_buster/client.rb', line 23 def report_subscription_cancellation(subscription) post('/cancellations', SubscriptionSerializer.serialize(subscription)) end |
#report_successful_payment(order) ⇒ Object
19 20 21 |
# File 'lib/solidus_subscriptions/churn_buster/client.rb', line 19 def report_successful_payment(order) post('/successful_payments', OrderSerializer.serialize(order)) end |