class Formio::Record

Attributes

_id[R]
created_at[R]
form_id[R]
form_name[R]
formio_hash[R]
id[R]
updated_at[R]

Public Class Methods

new(formio_hash) click to toggle source
# File lib/formio/record.rb, line 3
def initialize(formio_hash)
  if formio_hash.empty? || formio_hash.nil?
    raise "cannot construct FormioRecord"
  end
  @_id = @id = formio_hash['_id']
  @form_id = formio_hash['form'] if formio_hash['form']
  @formio_hash = formio_hash
  @form_name = formio_hash['form_name']
  if formio_hash['created']
    @created_at = Time.parse formio_hash['created']
  end
  if formio_hash['modified']
    @updated_at = Time.parse formio_hash['modified']
  end
end

Public Instance Methods

[](key) click to toggle source
# File lib/formio/record.rb, line 31
def [](key)
  formio_hash[key]
end
[]=(key, value) click to toggle source
# File lib/formio/record.rb, line 35
def []=(key, value)
  formio_hash[key] = value
end
present?() click to toggle source
# File lib/formio/record.rb, line 19
def present?
  true
end
to_h() click to toggle source
# File lib/formio/record.rb, line 27
def to_h
  formio_hash
end
to_json() click to toggle source
# File lib/formio/record.rb, line 23
def to_json
  formio_hash.to_json
end