Module: PublicForms

Included in:
PublicContent
Defined in:
lib/pub/content/forms.rb

Instance Method Summary collapse

Instance Method Details

#get_form(slug, options = nil) ⇒ Object

Get Form.

Get a single form.

Parameters

slug

(String) – It’s the string identifier generated by Mints.

Example

@data = @mints_pub.get_form("form_slug")


23
24
25
# File 'lib/pub/content/forms.rb', line 23

def get_form(slug, options = nil)
  @client.raw('get', "/content/forms/#{slug}", options)
end

#get_forms(options = nil) ⇒ Object

Get Forms.

Get a collection of forms.

Example

@data = @mints_pub.get_forms


10
11
12
# File 'lib/pub/content/forms.rb', line 10

def get_forms(options = nil)
  @client.raw('get', '/content/forms', options)
end

#submit_form(data) ⇒ Object

Submit Form.

Submit a form with data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  'form_slug': 'form_slug',
  'email': '[email protected]',
  'given_name': 'given_name',
  'f1': 'Field 1 answer',
  'f2': 'Field 2 answer',
  'f3': 'Field 3 answer'
}
@data = @mints_pub.submit_form(data)


44
45
46
# File 'lib/pub/content/forms.rb', line 44

def submit_form(data)
  @client.raw('post', '/content/forms/submit', nil, data_transform(data))
end