Class: Node::Commands::Populate::Customer

Inherits:
ShopifyCli::AdminAPI::PopulateResourceCommand show all
Defined in:
lib/project_types/node/commands/populate/customer.rb

Constant Summary

Constants inherited from ShopifyCli::AdminAPI::PopulateResourceCommand

ShopifyCli::AdminAPI::PopulateResourceCommand::DEFAULT_COUNT

Instance Attribute Summary

Attributes inherited from ShopifyCli::AdminAPI::PopulateResourceCommand

#input

Attributes inherited from ShopifyCli::Command

#ctx, #options

Instance Method Summary collapse

Methods inherited from ShopifyCli::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::SubCommand

call

Methods inherited from ShopifyCli::Command

call, call_help, #initialize, options, prerequisite_task, run_prerequisites, subcommand, subcommand_registry

Methods included from ShopifyCli::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
# File 'lib/project_types/node/commands/populate/customer.rb', line 9

def defaults
  first_name, last_name = ShopifyCli::Helpers::Haikunator.name
  {
    firstName: first_name,
    lastName: last_name,
  }
end

#message(data) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/project_types/node/commands/populate/customer.rb', line 17

def message(data)
  ret = data['customerCreate']['customer']
  id = ShopifyCli::API.gid_to_id(ret['id'])
  @ctx.message(
    'node.populate.customer.added',
    ret['displayName'],
    ShopifyCli::Project.current.env.shop,
    admin_url,
    id
  )
end