Module: Extension::Tasks::Converters::RegistrationConverter

Defined in:
lib/project_types/extension/tasks/converters/registration_converter.rb

Constant Summary collapse

ID_FIELD =
"id"
UUID_FIELD =
"uuid"
TYPE_FIELD =
"type"
TITLE_FIELD =
"title"
DRAFT_VERSION_FIELD =
"draftVersion"

Class Method Summary collapse

Class Method Details

.from_hash(context, hash) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/project_types/extension/tasks/converters/registration_converter.rb', line 14

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

  Models::Registration.new(
    id: hash[ID_FIELD].to_i,
    uuid: hash[UUID_FIELD],
    type: hash[TYPE_FIELD],
    title: hash[TITLE_FIELD],
    draft_version: VersionConverter.from_hash(context, hash[DRAFT_VERSION_FIELD])
  )
end