Class: Weeblycloud::Form
- Inherits:
-
CloudResource
- Object
- CloudResource
- Weeblycloud::Form
- Defined in:
- lib/weeblycloud/form.rb
Overview
Represents a Form resource. cloud-developer.weebly.com/form.html
Instance Attribute Summary
Attributes inherited from CloudResource
Instance Method Summary collapse
-
#get_form_entry(form_entry_id) ⇒ Object
Return the FormEntry with the given id.
-
#id ⇒ Object
Returns the form_id.
-
#initialize(user_id, site_id, form_id, data = nil) ⇒ Form
constructor
A new instance of Form.
-
#list_form_entries(filters = {}) ⇒ Object
Returns a list of FormEntry resources for a given form subject to filters.
Methods inherited from CloudResource
#[], #get, #get_property, #to_s
Constructor Details
#initialize(user_id, site_id, form_id, data = nil) ⇒ Form
Returns a new instance of Form.
11 12 13 14 15 16 17 18 19 |
# File 'lib/weeblycloud/form.rb', line 11 def initialize(user_id, site_id, form_id, data = nil) @user_id = user_id.to_i @site_id = site_id.to_i @form_id = form_id.to_i @endpoint = "user/#{@user_id}/site/#{@site_id}/form/#{@form_id}" super(data) end |
Instance Method Details
#get_form_entry(form_entry_id) ⇒ Object
Return the FormEntry with the given id.
33 34 35 |
# File 'lib/weeblycloud/form.rb', line 33 def get_form_entry(form_entry_id) return FormEntry.new(@user_id, @site_id, @form_id, @form_entry_id) end |
#id ⇒ Object
Returns the form_id
22 23 24 |
# File 'lib/weeblycloud/form.rb', line 22 def id @form_id end |
#list_form_entries(filters = {}) ⇒ Object
Returns a list of FormEntry resources for a given form subject to filters.
27 28 29 30 |
# File 'lib/weeblycloud/form.rb', line 27 def list_form_entries(filters={}) result = @client.get(@endpoint + "/entry", :params=>filters) return result.map { |i| FormEntry.new(@user_id, @site_id, i["form_entry_id"], i) } end |