class ProntoForms::FormSpace

Represents a form space resource in ProntoForms. Form spaces are the primary organizational unit for forms, data sources, destinations, and other resources.

Public Instance Methods

document(document_id) click to toggle source
# 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() click to toggle source

Get all documents in the form space @return [ResourceList] A ResourceList containing Document objects

# 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) click to toggle source
# 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: {}) click to toggle source

Get all forms in the form space @return [ResourceList] A ResourceList containing Form objects

# 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