Sha256: 198b9741fea5ca55fe97507dd7cb213d467700d90416ac5fc15a66a0403a966b

Contents?: true

Size: 939 Bytes

Versions: 20

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

20 entries across 20 versions & 1 rubygems

Version Path
shopify-cli-1.6.0 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.5.0 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.4.1 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.4.0 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.3.1 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.3.0 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.2.0 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.1.2 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.1.1 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.1.0 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.0.5 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.0.4 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.0.3 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.0.2 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.0.1 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-1.0.0 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-0.9.3 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-0.9.2 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-0.9.1 lib/project_types/extension/tasks/converters/version_converter.rb
shopify-cli-0.9.0 lib/project_types/extension/tasks/converters/version_converter.rb