Class: ShopifyCLI::Commands::Populate::Product

Inherits:
AdminAPI::PopulateResourceCommand show all
Defined in:
lib/shopify_cli/commands/populate/product.rb

Constant Summary

Constants inherited from AdminAPI::PopulateResourceCommand

AdminAPI::PopulateResourceCommand::DEFAULT_COUNT

Instance Attribute Summary

Attributes inherited from AdminAPI::PopulateResourceCommand

#input

Attributes inherited from ShopifyCLI::Command

#ctx, #options

Instance Method Summary collapse

Methods inherited from AdminAPI::PopulateResourceCommand

#admin_url, #call, call, #completion_message, #display_parent_extended_help, #display_parent_help, help, #input_options, #populate, #price, #resource_options, #run_mutation, #schema

Methods inherited from ShopifyCLI::Command::SubCommand

call

Methods inherited from ShopifyCLI::Command

call, call_help, check_node_version, check_ruby_version, check_version, #initialize, options, prerequisite_task, recommend_default_node_range, recommend_default_ruby_range, recommend_node, recommend_ruby, run_prerequisites, subcommand, subcommand_registry

Methods included from Feature::Set

#hidden?, #hidden_feature

Constructor Details

This class inherits a constructor from ShopifyCLI::Command

Instance Method Details

#defaultsObject



9
10
11
12
13
14
# File 'lib/shopify_cli/commands/populate/product.rb', line 9

def defaults
  {
    title: ShopifyCLI::Helpers::Haikunator.title,
    variants: [{ price: price }],
  }
end

#message(data) ⇒ Object



16
17
18
19
20
# File 'lib/shopify_cli/commands/populate/product.rb', line 16

def message(data)
  ret = data["productCreate"]["product"]
  id = ShopifyCLI::API.gid_to_id(ret["id"])
  @ctx.message("core.populate.product.added", ret["title"], @shop, admin_url, id)
end