Sha256: cd807244ed0bc90e76f3bec8c9aa427a7aa230f82455894c036a498347d8d270

Contents?: true

Size: 1.45 KB

Versions: 57

Compression:

Stored size: 1.45 KB

Contents

module Extension
  module Models
    class Specification
      include SmartProperties

      module Features
        class Argo
          include SmartProperties

          property! :surface, converts: :to_str
          property! :renderer_package_name, converts: :to_str
          property! :git_template, converts: :to_str
          property! :required_fields, accepts: Array, default: -> { [] }
          property! :required_shop_beta_flags, accepts: Array, default: -> { [] }
          property! :cli_package_name, accepts: String, converts: :to_str, default: ""
        end

        def self.build(feature_set_attributes)
          feature_set_attributes.each_with_object(OpenStruct.new) do |(identifier, feature_attributes), feature_set|
            next if feature_attributes.nil?
            feature_set[identifier] = ShopifyCLI::ResolveConstant
              .call(identifier, namespace: Features)
              .rescue { OpenStruct }
              .then { |c| c.new(**feature_attributes) }
              .unwrap { |error| raise(error) }
          end
        end
      end

      property! :identifier
      property :name, converts: :to_str
      property :graphql_identifier, converts: :to_str
      property! :features, converts: Features.method(:build), default: -> { [] }
      property! :options, converts: ->(options) { OpenStruct.new(options) }, default: -> { OpenStruct.new }

      def graphql_identifier
        super || identifier
      end
    end
  end
end

Version data entries

57 entries across 57 versions & 1 rubygems

Version Path
shopify-cli-2.36.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.35.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.34.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.33.1 lib/project_types/extension/models/specification.rb
shopify-cli-2.33.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.32.1 lib/project_types/extension/models/specification.rb
shopify-cli-2.32.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.31.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.30.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.29.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.28.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.27.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.26.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.25.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.24.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.23.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.22.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.21.0 lib/project_types/extension/models/specification.rb
shopify-cli-2.20.1 lib/project_types/extension/models/specification.rb
shopify-cli-2.20.0 lib/project_types/extension/models/specification.rb