Class: Extension::Forms::Connect

Inherits:
ShopifyCLI::Form show all
Defined in:
lib/project_types/extension/forms/connect.rb

Defined Under Namespace

Classes: ExtensionProjectDetails

Instance Attribute Summary collapse

Attributes inherited from ShopifyCLI::Form

#ctx, #xargs

Instance Method Summary collapse

Methods inherited from ShopifyCLI::Form

ask, flag_arguments, #initialize, positional_arguments

Constructor Details

This class inherits a constructor from ShopifyCLI::Form

Instance Attribute Details

#appObject

Returns the value of attribute app.



6
7
8
# File 'lib/project_types/extension/forms/connect.rb', line 6

def app
  @app
end

#registrationObject

Returns the value of attribute registration.



6
7
8
# File 'lib/project_types/extension/forms/connect.rb', line 6

def registration
  @registration
end

Instance Method Details

#askObject



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/project_types/extension/forms/connect.rb', line 21

def ask
  ShopifyCLI::Result.wrap(ExtensionProjectDetails.new)
    .then(&Questions::AskRegistration.new(ctx: ctx, type: type))
    .unwrap { |e| raise e }
    .tap do |project_details|
      ctx.abort(ctx.message("connect.incomplete_configuration")) unless project_details.complete?

      self.registration = project_details.registration
      self.app = project_details.app
    end
end

#directory_nameObject



33
34
35
# File 'lib/project_types/extension/forms/connect.rb', line 33

def directory_name
  name.strip.gsub(/( )/, "_").downcase
end