Module: DiscoApp::Concerns::AppInstalledJob
- Extended by:
- ActiveSupport::Concern
- Included in:
- AppInstalledJob
- Defined in:
- app/jobs/disco_app/concerns/app_installed_job.rb
Instance Method Summary collapse
-
#default_plan ⇒ Object
Provide an overridable hook for applications to examine the @shop object and return the default plan, if any, the shop should be subscribed to.
-
#perform(_shop, plan_code = nil, source = nil) ⇒ Object
Perform application installation.
Instance Method Details
#default_plan ⇒ Object
Provide an overridable hook for applications to examine the @shop object and return the default plan, if any, the shop should be subscribed to. If nil is returned, no automatic subscription will take place and the store owner will be forced to choose a plan after installation.
If implementing this method, it should be memoized.
34 35 36 |
# File 'app/jobs/disco_app/concerns/app_installed_job.rb', line 34 def default_plan nil end |
#perform(_shop, plan_code = nil, source = nil) ⇒ Object
Perform application installation.
-
Synchronise webhooks.
-
Synchronise carrier service, if required.
-
Perform initial update of shop information.
-
Subscribe to default plan, if any exists.
18 19 20 21 22 23 24 25 26 |
# File 'app/jobs/disco_app/concerns/app_installed_job.rb', line 18 def perform(_shop, plan_code = nil, source = nil) DiscoApp::SynchroniseWebhooksJob.perform_now(@shop) DiscoApp::SynchroniseCarrierServiceJob.perform_now(@shop) DiscoApp::ShopUpdateJob.perform_now(@shop) @shop.reload DiscoApp::SubscriptionService.subscribe(@shop, default_plan, plan_code, source) if default_plan.present? end |