Class: ProntoForms::FormSpace

Inherits:
Resource
  • Object
show all
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

#client, #data, #parent

Instance Method Summary collapse

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

#documentsResourceList

Get all documents in the form space

Returns:

  • (ResourceList)

    A ResourceList containing Document objects



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

Returns:



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

#idString

Returns The FormSpace identifier.

Returns:

  • (String)

    The FormSpace identifier



13
# File 'lib/prontoforms/form_space.rb', line 13

property :id, key: 'identifier'

#nameString

Returns The FormSpace name.

Returns:

  • (String)

    The FormSpace name



15
# File 'lib/prontoforms/form_space.rb', line 15

property :name, key: 'name'

#problem_contact_emailString

Returns The address that error emails are sent to.

Returns:

  • (String)

    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_deviceBoolean

Returns Whether updates are automatically pushed to devices.

Returns:

  • (Boolean)

    Whether updates are automatically pushed to devices



19
# File 'lib/prontoforms/form_space.rb', line 19

property :push_updates_to_device, key: 'pushUpdatesToDevice'