Sha256: 26a206400cee639c63ed775931a6a6c2785f93ac8c950f72e29e0c35b9d28d68

Contents?: true

Size: 1.09 KB

Versions: 5

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 :config_ui, accepts: ConfigUi

        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

5 entries across 5 versions & 1 rubygems

Version Path
shopify-cli-1.13.1 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-1.13.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-1.12.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-1.11.0 lib/project_types/script/layers/domain/script_project.rb
shopify-cli-1.10.0 lib/project_types/script/layers/domain/script_project.rb