Class: Files::FormFieldSet
- Inherits:
-
Object
- Object
- Files::FormFieldSet
- Defined in:
- lib/files.com/models/form_field_set.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
- .all(params = {}, options = {}) ⇒ Object
-
.create(params = {}, options = {}) ⇒ Object
Parameters: user_id - int64 - User ID.
- .delete(id, params = {}, options = {}) ⇒ Object
- .destroy(id, params = {}, options = {}) ⇒ Object
-
.find(id, params = {}, options = {}) ⇒ Object
Parameters: id (required) - int64 - Form Field Set ID.
- .get(id, params = {}, options = {}) ⇒ Object
-
.list(params = {}, options = {}) ⇒ Object
Parameters: user_id - int64 - User ID.
-
.update(id, params = {}, options = {}) ⇒ Object
Parameters: title - string - Title to be displayed skip_email - boolean - Skip validating form email skip_name - boolean - Skip validating form name skip_company - boolean - Skip validating company form_fields - array(object).
Instance Method Summary collapse
- #delete(params = {}) ⇒ Object
- #destroy(params = {}) ⇒ Object
-
#form_fields ⇒ Object
array(object) - Associated form fields.
- #form_fields=(value) ⇒ Object
-
#form_layout ⇒ Object
array(int64) - Layout of the form.
- #form_layout=(value) ⇒ Object
-
#id ⇒ Object
int64 - Form field set id.
- #id=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ FormFieldSet
constructor
A new instance of FormFieldSet.
- #save ⇒ Object
-
#skip_company ⇒ Object
boolean - Any associated InboxRegistrations or BundleRegistrations can be saved without providing company.
- #skip_company=(value) ⇒ Object
-
#skip_email ⇒ Object
boolean - Any associated InboxRegistrations or BundleRegistrations can be saved without providing email.
- #skip_email=(value) ⇒ Object
-
#skip_name ⇒ Object
boolean - Any associated InboxRegistrations or BundleRegistrations can be saved without providing name.
- #skip_name=(value) ⇒ Object
-
#title ⇒ Object
string - Title to be displayed.
- #title=(value) ⇒ Object
-
#update(params = {}) ⇒ Object
Parameters: title - string - Title to be displayed skip_email - boolean - Skip validating form email skip_name - boolean - Skip validating form name skip_company - boolean - Skip validating company form_fields - array(object).
-
#user_id ⇒ Object
int64 - User ID.
- #user_id=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ FormFieldSet
Returns a new instance of FormFieldSet.
7 8 9 10 |
# File 'lib/files.com/models/form_field_set.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/form_field_set.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/form_field_set.rb', line 5 def @options end |
Class Method Details
.all(params = {}, options = {}) ⇒ Object
142 143 144 |
# File 'lib/files.com/models/form_field_set.rb', line 142 def self.all(params = {}, = {}) list(params, ) end |
.create(params = {}, options = {}) ⇒ Object
Parameters:
user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
title - string - Title to be displayed
skip_email - boolean - Skip validating form email
skip_name - boolean - Skip validating form name
skip_company - boolean - Skip validating company
form_fields - array(object)
169 170 171 172 173 174 175 176 |
# File 'lib/files.com/models/form_field_set.rb', line 169 def self.create(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: title must be an String") if params[:title] and !params[:title].is_a?(String) raise InvalidParameterError.new("Bad parameter: form_fields must be an Array") if params[:form_fields] and !params[:form_fields].is_a?(Array) response, = Api.send_request("/form_field_sets", :post, params, ) FormFieldSet.new(response.data, ) end |
.delete(id, params = {}, options = {}) ⇒ Object
196 197 198 199 200 201 202 203 204 |
# File 'lib/files.com/models/form_field_set.rb', line 196 def self.delete(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/form_field_sets/#{params[:id]}", :delete, params, ) nil end |
.destroy(id, params = {}, options = {}) ⇒ Object
206 207 208 209 |
# File 'lib/files.com/models/form_field_set.rb', line 206 def self.destroy(id, params = {}, = {}) delete(id, params, ) nil end |
.find(id, params = {}, options = {}) ⇒ Object
Parameters:
id (required) - int64 - Form Field Set ID.
148 149 150 151 152 153 154 155 156 |
# File 'lib/files.com/models/form_field_set.rb', line 148 def self.find(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/form_field_sets/#{params[:id]}", :get, params, ) FormFieldSet.new(response.data, ) end |
.get(id, params = {}, options = {}) ⇒ Object
158 159 160 |
# File 'lib/files.com/models/form_field_set.rb', line 158 def self.get(id, params = {}, = {}) find(id, params, ) end |
.list(params = {}, options = {}) ⇒ Object
Parameters:
user_id - int64 - User ID. Provide a value of `0` to operate the current session's user.
cursor - string - Used for pagination. When a list request has more records available, cursors are provided in the response headers `X-Files-Cursor-Next` and `X-Files-Cursor-Prev`. Send one of those cursor value here to resume an existing list from the next available record. Note: many of our SDKs have iterator methods that will automatically handle cursor-based pagination.
per_page - int64 - Number of records to show per page. (Max: 10,000, 1,000 or less is recommended).
132 133 134 135 136 137 138 139 140 |
# File 'lib/files.com/models/form_field_set.rb', line 132 def self.list(params = {}, = {}) raise InvalidParameterError.new("Bad parameter: user_id must be an Integer") if params[:user_id] and !params[:user_id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: cursor must be an String") if params[:cursor] and !params[:cursor].is_a?(String) raise InvalidParameterError.new("Bad parameter: per_page must be an Integer") if params[:per_page] and !params[:per_page].is_a?(Integer) List.new(FormFieldSet, params) do Api.send_request("/form_field_sets", :get, params, ) end end |
.update(id, params = {}, options = {}) ⇒ Object
Parameters:
title - string - Title to be displayed
skip_email - boolean - Skip validating form email
skip_name - boolean - Skip validating form name
skip_company - boolean - Skip validating company
form_fields - array(object)
184 185 186 187 188 189 190 191 192 193 194 |
# File 'lib/files.com/models/form_field_set.rb', line 184 def self.update(id, params = {}, = {}) params ||= {} params[:id] = id raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: title must be an String") if params[:title] and !params[:title].is_a?(String) raise InvalidParameterError.new("Bad parameter: form_fields must be an Array") if params[:form_fields] and !params[:form_fields].is_a?(Array) raise MissingParameterError.new("Parameter missing: id") unless params[:id] response, = Api.send_request("/form_field_sets/#{params[:id]}", :patch, params, ) FormFieldSet.new(response.data, ) end |
Instance Method Details
#delete(params = {}) ⇒ Object
102 103 104 105 106 107 108 109 110 |
# File 'lib/files.com/models/form_field_set.rb', line 102 def delete(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/form_field_sets/#{@attributes[:id]}", :delete, params, @options) end |
#destroy(params = {}) ⇒ Object
112 113 114 115 |
# File 'lib/files.com/models/form_field_set.rb', line 112 def destroy(params = {}) delete(params) nil end |
#form_fields ⇒ Object
array(object) - Associated form fields
40 41 42 |
# File 'lib/files.com/models/form_field_set.rb', line 40 def form_fields @attributes[:form_fields] end |
#form_fields=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/form_field_set.rb', line 44 def form_fields=(value) @attributes[:form_fields] = value end |
#form_layout ⇒ Object
array(int64) - Layout of the form
31 32 33 |
# File 'lib/files.com/models/form_field_set.rb', line 31 def form_layout @attributes[:form_layout] end |
#form_layout=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/form_field_set.rb', line 35 def form_layout=(value) @attributes[:form_layout] = value end |
#id ⇒ Object
int64 - Form field set id
13 14 15 |
# File 'lib/files.com/models/form_field_set.rb', line 13 def id @attributes[:id] end |
#id=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/form_field_set.rb', line 17 def id=(value) @attributes[:id] = value end |
#save ⇒ Object
117 118 119 120 121 122 123 124 125 126 |
# File 'lib/files.com/models/form_field_set.rb', line 117 def save if @attributes[:id] new_obj = update(@attributes) else new_obj = FormFieldSet.create(@attributes, @options) end @attributes = new_obj.attributes true end |
#skip_company ⇒ Object
boolean - Any associated InboxRegistrations or BundleRegistrations can be saved without providing company
67 68 69 |
# File 'lib/files.com/models/form_field_set.rb', line 67 def skip_company @attributes[:skip_company] end |
#skip_company=(value) ⇒ Object
71 72 73 |
# File 'lib/files.com/models/form_field_set.rb', line 71 def skip_company=(value) @attributes[:skip_company] = value end |
#skip_email ⇒ Object
boolean - Any associated InboxRegistrations or BundleRegistrations can be saved without providing email
58 59 60 |
# File 'lib/files.com/models/form_field_set.rb', line 58 def skip_email @attributes[:skip_email] end |
#skip_email=(value) ⇒ Object
62 63 64 |
# File 'lib/files.com/models/form_field_set.rb', line 62 def skip_email=(value) @attributes[:skip_email] = value end |
#skip_name ⇒ Object
boolean - Any associated InboxRegistrations or BundleRegistrations can be saved without providing name
49 50 51 |
# File 'lib/files.com/models/form_field_set.rb', line 49 def skip_name @attributes[:skip_name] end |
#skip_name=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/form_field_set.rb', line 53 def skip_name=(value) @attributes[:skip_name] = value end |
#title ⇒ Object
string - Title to be displayed
22 23 24 |
# File 'lib/files.com/models/form_field_set.rb', line 22 def title @attributes[:title] end |
#title=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/form_field_set.rb', line 26 def title=(value) @attributes[:title] = value end |
#update(params = {}) ⇒ Object
Parameters:
title - string - Title to be displayed
skip_email - boolean - Skip validating form email
skip_name - boolean - Skip validating form name
skip_company - boolean - Skip validating company
form_fields - array(object)
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/files.com/models/form_field_set.rb', line 90 def update(params = {}) params ||= {} params[:id] = @attributes[:id] raise MissingParameterError.new("Current object doesn't have a id") unless @attributes[:id] raise InvalidParameterError.new("Bad parameter: id must be an Integer") if params[:id] and !params[:id].is_a?(Integer) raise InvalidParameterError.new("Bad parameter: title must be an String") if params[:title] and !params[:title].is_a?(String) raise InvalidParameterError.new("Bad parameter: form_fields must be an Array") if params[:form_fields] and !params[:form_fields].is_a?(Array) raise MissingParameterError.new("Parameter missing: id") unless params[:id] Api.send_request("/form_field_sets/#{@attributes[:id]}", :patch, params, @options) end |
#user_id ⇒ Object
int64 - User ID. Provide a value of ‘0` to operate the current session’s user.
76 77 78 |
# File 'lib/files.com/models/form_field_set.rb', line 76 def user_id @attributes[:user_id] end |
#user_id=(value) ⇒ Object
80 81 82 |
# File 'lib/files.com/models/form_field_set.rb', line 80 def user_id=(value) @attributes[:user_id] = value end |