Class: ForestLiana::StripeSubscriptionGetter
- Inherits:
-
StripeBaseGetter
- Object
- IntegrationBaseGetter
- StripeBaseGetter
- ForestLiana::StripeSubscriptionGetter
- Defined in:
- app/services/forest_liana/stripe_subscription_getter.rb
Instance Attribute Summary collapse
-
#record ⇒ Object
Returns the value of attribute record.
Instance Method Summary collapse
-
#initialize(params, secret_key, reference) ⇒ StripeSubscriptionGetter
constructor
A new instance of StripeSubscriptionGetter.
- #perform ⇒ Object
Constructor Details
#initialize(params, secret_key, reference) ⇒ StripeSubscriptionGetter
Returns a new instance of StripeSubscriptionGetter.
5 6 7 8 |
# File 'app/services/forest_liana/stripe_subscription_getter.rb', line 5 def initialize(params, secret_key, reference) @params = params Stripe.api_key = ForestLiana.integrations[:stripe][:api_key] end |
Instance Attribute Details
#record ⇒ Object
Returns the value of attribute record.
3 4 5 |
# File 'app/services/forest_liana/stripe_subscription_getter.rb', line 3 def record @record end |
Instance Method Details
#perform ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/services/forest_liana/stripe_subscription_getter.rb', line 10 def perform query = {} @record = ::Stripe::Subscription.retrieve(@params[:subscription_id]) query[field] = @record.customer if collection @record.customer = collection.find_by(query) else @record.customer = nil end @record end |