Class: Formio::Form

Inherits:
Object
  • Object
show all
Defined in:
lib/formio/form.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(formio_hash) ⇒ Form

Returns a new instance of Form.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/formio/form.rb', line 16

def initialize(formio_hash)
  @formio_hash = formio_hash
  @type = formio_hash['type']
  @formio_id = formio_hash['_id']
  @components = formio_hash['components']
  @name = @title = formio_hash['title']
  @path = formio_hash['path']
  @created_at = DateTime.parse formio_hash['created']
  @updated_at = DateTime.parse formio_hash['modified']
  @submission_access = formio_hash['submissionAccess']
end

Instance Attribute Details

#componentsObject

Returns the value of attribute components.



3
4
5
# File 'lib/formio/form.rb', line 3

def components
  @components
end

#created_atObject

Returns the value of attribute created_at.



3
4
5
# File 'lib/formio/form.rb', line 3

def created_at
  @created_at
end

#formio_hashObject

Returns the value of attribute formio_hash.



3
4
5
# File 'lib/formio/form.rb', line 3

def formio_hash
  @formio_hash
end

#formio_idObject

Returns the value of attribute formio_id.



3
4
5
# File 'lib/formio/form.rb', line 3

def formio_id
  @formio_id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/formio/form.rb', line 3

def name
  @name
end

#pathObject

Returns the value of attribute path.



3
4
5
# File 'lib/formio/form.rb', line 3

def path
  @path
end

#submission_accessObject

Returns the value of attribute submission_access.



3
4
5
# File 'lib/formio/form.rb', line 3

def submission_access
  @submission_access
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/formio/form.rb', line 3

def title
  @title
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/formio/form.rb', line 3

def type
  @type
end

#updated_atObject

Returns the value of attribute updated_at.



3
4
5
# File 'lib/formio/form.rb', line 3

def updated_at
  @updated_at
end

Instance Method Details

#idObject



36
37
38
# File 'lib/formio/form.rb', line 36

def id
  formio_hash['_id']
end

#to_hObject



40
41
42
# File 'lib/formio/form.rb', line 40

def to_h
  formio_hash
end

#to_jsonObject



44
45
46
# File 'lib/formio/form.rb', line 44

def to_json
  to_h.to_json
end