Class: ShopifyCLI::Commands::Populate::DraftOrder

Inherits:
AdminAPI::PopulateResourceCommand show all
Defined in:
lib/shopify_cli/commands/populate/draft_order.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
15
16
17
18
# File 'lib/shopify_cli/commands/populate/draft_order.rb', line 9

def defaults
  {
    lineItems: [{
      originalUnitPrice: price,
      quantity: 1,
      weight: { value: 10, unit: "GRAMS" },
      title: ShopifyCLI::Helpers::Haikunator.title,
    }],
  }
end

#message(data) ⇒ Object



20
21
22
23
24
# File 'lib/shopify_cli/commands/populate/draft_order.rb', line 20

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