Sha256: 6fcd4f4db9a95f956b9792db6758a92311816ce18a16b94e2d69ee00d5523444

Contents?: true

Size: 1.31 KB

Versions: 11

Compression:

Stored size: 1.31 KB

Contents

# frozen_string_literal: true

module Script
  module Layers
    module Domain
      class ScriptProject
        include SmartProperties

        UUID_ENV_KEY = "UUID"

        property! :id, accepts: String
        property :env, accepts: ShopifyCLI::Resources::EnvFile

        property! :extension_point_type, accepts: String
        property! :title, accepts: String
        property  :description, accepts: String
        property! :language, accepts: String

        property :script_config, accepts: ScriptConfig
        property :app_bridge, accepts: AppBridge
        property :input_query, accepts: String

        def initialize(*)
          super

          ShopifyCLI::Core::Monorail.metadata = {
            "script_name" => title,
            "extension_point_type" => extension_point_type,
            "language" => language,
          }
        end

        def api_key
          env&.api_key
        end

        def api_secret
          env&.secret
        end

        def uuid
          uuid_defined? && !raw_uuid.empty? ? raw_uuid : nil
        end

        def uuid_defined?
          !raw_uuid.nil?
        end

        def env_valid?
          api_key && api_secret && uuid_defined?
        end

        private

        def raw_uuid
          env&.extra&.[](UUID_ENV_KEY)
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
shopify-cli-2.25.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.24.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.23.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.22.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.21.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.20.1 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.20.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.19.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.18.1 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.18.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.17.0 lib/project_types/script/layers/domain/script_project.rb