Class: ProntoForms::FormSpace
- Defined in:
- lib/prontoforms/form_space.rb
Overview
Represents a form space resource in ProntoForms. Form spaces are the primary organizational unit for forms, data sources, destinations, and other resources.
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
- #document(document_id) ⇒ Object
-
#documents ⇒ ResourceList
Get all documents in the form space.
- #form(form_id) ⇒ Object
-
#forms(query: {}) ⇒ ResourceList
Get all forms in the form space.
-
#id ⇒ String
The FormSpace identifier.
-
#name ⇒ String
The FormSpace name.
-
#problem_contact_email ⇒ String
The address that error emails are sent to.
-
#push_updates_to_device ⇒ Boolean
Whether updates are automatically pushed to devices.
Methods inherited from Resource
#initialize, property, resource_name, #resource_name
Constructor Details
This class inherits a constructor from ProntoForms::Resource
Instance Method Details
#document(document_id) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/prontoforms/form_space.rb', line 34 def document(document_id) res = client.connection.get do |req| req.url "formspaces/#{id}/documents/#{document_id}" end Document.new(JSON.parse(res.body), client, self) end |
#documents ⇒ ResourceList
Get all documents in the form space
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/prontoforms/form_space.rb', line 23 def documents res = client.connection.get do |req| req.url "formspaces/#{id}/documents" end ResourceList.new(JSON.parse(res.body), { 'p' => 0, 's' => 100 }, :documents, Document, self) end |
#form(form_id) ⇒ Object
42 43 44 45 46 47 48 49 |
# File 'lib/prontoforms/form_space.rb', line 42 def form(form_id) res = client.connection.get do |req| req.url "formspaces/#{id}/forms/#{form_id}" end data = JSON.parse(res.body) Form.new(data, client, self) end |
#forms(query: {}) ⇒ ResourceList
Get all forms in the form space
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/prontoforms/form_space.rb', line 53 def forms(query: {}) res = client.connection.get do |req| req.url "formspaces/#{id}/forms" query.each { |k, v| req.params[k] = v } end ResourceList.new(JSON.parse(res.body), { 'p' => 0, 's' => 100 }.merge(query), :forms, Form, client, self) end |
#id ⇒ String
Returns The FormSpace identifier.
13 |
# File 'lib/prontoforms/form_space.rb', line 13 property :id, key: 'identifier' |
#name ⇒ String
Returns The FormSpace name.
15 |
# File 'lib/prontoforms/form_space.rb', line 15 property :name, key: 'name' |
#problem_contact_email ⇒ String
Returns The address that error emails are sent to.
17 |
# File 'lib/prontoforms/form_space.rb', line 17 property :problem_contact_email, key: 'problemContactEmail' |
#push_updates_to_device ⇒ Boolean
Returns Whether updates are automatically pushed to devices.
19 |
# File 'lib/prontoforms/form_space.rb', line 19 property :push_updates_to_device, key: 'pushUpdatesToDevice' |