Class: Arbetsformedlingen::Document

Inherits:
Model
  • Object
show all
Defined in:
lib/arbetsformedlingen/models/document.rb

Instance Attribute Summary

Attributes inherited from Model

#schema

Instance Method Summary collapse

Methods inherited from Model

#errors, from_schema, #to_h, #valid?

Constructor Details

#initialize(hash) ⇒ Document

Returns a new instance of Document.



21
22
23
24
25
26
27
28
# File 'lib/arbetsformedlingen/models/document.rb', line 21

def initialize(hash)
  data = {
    id: SecureRandom.uuid,
    timestamp: Time.now.utc.iso8601,
  }.merge!(hash)

  super(DocumentSchema.call(data))
end