Class: ShopifyCLI::Tasks::EnsureDevStore

Inherits:
ShopifyCLI::Task show all
Defined in:
lib/shopify_cli/tasks/ensure_dev_store.rb

Instance Method Summary collapse

Instance Method Details

#call(ctx) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/shopify_cli/tasks/ensure_dev_store.rb', line 6

def call(ctx)
  @ctx = ctx
  return ctx.abort(ctx.message(
    "core.tasks.ensure_dev_store.could_not_verify_store", project.env.shop
  )) if shop.nil?
  return if shop["transferDisabled"] == true
  return unless CLI::UI::Prompt.confirm(
    ctx.message("core.tasks.ensure_dev_store.convert_to_dev_store", project.env.shop)
  )
  ShopifyCLI::PartnersAPI.query(ctx, "convert_dev_to_test_store", input: {
    organizationID: shop["orgID"].to_i,
    shopId: shop["shopId"],
  })
  ctx.puts(ctx.message("core.tasks.ensure_dev_store.transfer_disabled", project.env.shop))
end