Class: SolidusSubscriptions::ChurnBuster::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/solidus_subscriptions/churn_buster/client.rb

Constant Summary collapse

BASE_API_URL =
'https://api.churnbuster.io/v1'

Instance Attribute Summary collapse

Instance Method Summary collapse

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 = 
  @api_key = api_key
end

Instance Attribute Details

#account_idObject (readonly)

Returns the value of attribute account_id.



8
9
10
# File 'lib/solidus_subscriptions/churn_buster/client.rb', line 8

def 
  @account_id
end

#api_keyObject (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