Sha256: a1e054b1121176f30178ff82249f9296bbfdd7ea5098d40288e55930583726cb

Contents?: true

Size: 1.09 KB

Versions: 10

Compression:

Stored size: 1.09 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! :script_name, accepts: String
        property! :language, accepts: String

        property :script_json, accepts: ScriptJson

        def initialize(*)
          super

          ShopifyCLI::Core::Monorail.metadata = {
            "script_name" => script_name,
            "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

        private

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

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
shopify-cli-2.7.1 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.7.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.6.6 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.6.5 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.6.4 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.6.3 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.6.2 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.6.1 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.6.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-2.5.0 lib/project_types/script/layers/domain/script_project.rb