Sha256: ed5d70d298ebd01124d4f9450c4e3b3efb265b59a7ea3d80b5be63bfc85065e7

Contents?: true

Size: 939 Bytes

Versions: 77

Compression:

Stored size: 939 Bytes

Contents

# frozen_string_literal: true
require "shopify_cli"

module Extension
  module Tasks
    module Converters
      module VersionConverter
        REGISTRATION_ID_FIELD = "registrationId"
        CONTEXT_FIELD = "context"
        LAST_USER_INTERACTION_AT_FIELD = "lastUserInteractionAt"
        LOCATION_FIELD = "location"
        VALIDATION_ERRORS_FIELD = "validationErrors"

        def self.from_hash(context, hash)
          context.abort(context.message("tasks.errors.parse_error")) if hash.nil?

          Models::Version.new(
            registration_id: hash[REGISTRATION_ID_FIELD].to_i,
            context: hash[CONTEXT_FIELD],
            last_user_interaction_at: Time.parse(hash[LAST_USER_INTERACTION_AT_FIELD]),
            location: hash[LOCATION_FIELD],
            validation_errors: Converters::ValidationErrorConverter.from_array(context, hash[VALIDATION_ERRORS_FIELD])
          )
        end
      end
    end
  end
end

Version data entries

77 entries across 77 versions & 1 rubygems

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