Class: ProntoForms::Form
Overview
A form includes inputs, validations, logic, and other configuration that facilitates data capture for a specific purpose.
Instance Attribute Summary
Attributes inherited from Resource
Class Method Summary collapse
Instance Method Summary collapse
- #active_version_id ⇒ Object
- #current_version ⇒ Object
-
#description ⇒ String
Form description.
-
#form_space_id ⇒ String
Get the Form’s form space ID.
-
#id ⇒ String
The Form identifier.
- #iteration(id) ⇒ Object
- #iterations(query: {}) ⇒ Object
-
#name ⇒ String
Form name.
-
#state ⇒ String
Form state.
Methods inherited from Resource
#initialize, property, #resource_name
Constructor Details
This class inherits a constructor from ProntoForms::Resource
Class Method Details
.resource_name ⇒ Object
10 11 12 |
# File 'lib/prontoforms/form.rb', line 10 def self.resource_name 'forms' end |
Instance Method Details
#active_version_id ⇒ Object
29 30 31 |
# File 'lib/prontoforms/form.rb', line 29 def active_version_id full_data.dig('activeVersion', 'identifier') end |
#current_version ⇒ Object
33 34 35 36 37 38 39 |
# File 'lib/prontoforms/form.rb', line 33 def current_version res = client.connection.get do |req| req.url "#{url}/iterations/#{active_version_id}" end FormIteration.new(JSON.parse(res.body), client, self) end |
#description ⇒ String
Returns Form description.
19 |
# File 'lib/prontoforms/form.rb', line 19 property :description, key: 'description' |
#form_space_id ⇒ String
Get the Form’s form space ID
25 26 27 |
# File 'lib/prontoforms/form.rb', line 25 def form_space_id parent.id end |
#id ⇒ String
Returns The Form identifier.
15 |
# File 'lib/prontoforms/form.rb', line 15 property :id, key: 'identifier' |
#iteration(id) ⇒ Object
41 42 43 44 45 46 47 48 49 |
# File 'lib/prontoforms/form.rb', line 41 def iteration(id) raise ArgumentError, 'id must be provided' if id.nil? res = client.connection.get do |req| req.url "#{url}/iterations/#{id}" end FormIteration.new(JSON.parse(res.body), client, self) end |
#iterations(query: {}) ⇒ Object
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/prontoforms/form.rb', line 51 def iterations(query: {}) res = client.connection.get do |req| req.url "#{url}/iterations" end ResourceList.new(JSON.parse(res.body), { 'p' => 0, 's' => 100 }.merge(query), :iterations, FormIteration, client, self) end |
#name ⇒ String
Returns Form name.
17 |
# File 'lib/prontoforms/form.rb', line 17 property :name, key: 'name' |
#state ⇒ String
Returns Form state.
21 |
# File 'lib/prontoforms/form.rb', line 21 property :state, key: 'state' |