Module: Laposta::Client::Fields
- Included in:
- Laposta::Client
- Defined in:
- lib/laposta/client/fields.rb
Instance Method Summary collapse
-
#create_field!(params = {}) ⇒ Object
Allowed attributes: Name Type Description ———————————————————— list_id string The ID of the list to which the field belongs name string A name for this field defaultvalue string (optional) A potential default value datatype string The data type: text, numeric, date, select_single or select_multiple datatype_display string (optional) Only applicable for select_single: the desired display (select, radio) options array (optional) What selection options are available? (mandatory for the data types select_single of select_multiple).
-
#delete_field!(field_id, params = {}) ⇒ Object
Parameters Name Type Description ———————————————————— list_id string The ID of the list to which the field belongs ————————————————————.
-
#get_field(field_id, params = {}) ⇒ Object
Parameters Name Type Description ———————————————————— field_id string The ID of the list to which the field belongs ————————————————————.
-
#get_fields_for_list(params = {}) ⇒ Object
Allowed attributes: Name Type Description ———————————————————— list_id string The ID of the list to which the field belongs ————————————————————.
-
#update_field!(field_id, params = {}) ⇒ Object
Parameters Name Type Description ———————————————————— field_id string The field’s ID ————————————————————.
Instance Method Details
#create_field!(params = {}) ⇒ Object
Allowed attributes: Name Type Description
list_id string The ID of the list to which the field belongs name string A name for this field defaultvalue string (optional) A potential default value datatype string The data type: text, numeric, date, select_single or select_multiple datatype_display string (optional) Only applicable for select_single: the desired display (select, radio) options array (optional) What selection options are available? (mandatory for the data types select_single of select_multiple).
The can be given as an array. In the answer the are repeated, but there is also an extra field .
Also listed are the option IDs, which may eventually be used to change the later.
required boolean Is this a mandatory field? in_form boolean Does this field occur in the subscription form? in_list boolean Is this field visible in Laposta’s overview?
45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/laposta/client/fields.rb', line 45 def create_field!(params = {}) cleaned = params.permit(:list_id, :name, :defaultvalue, :datatype, :datatype_display, :options, :required, :in_form, :in_list) create("field", cleaned) end |
#delete_field!(field_id, params = {}) ⇒ Object
Parameters Name Type Description
list_id string The ID of the list to which the field belongs
Allowed attributes: Name Type Description
list_id string The ID of the list to which the field belongs
104 105 106 107 |
# File 'lib/laposta/client/fields.rb', line 104 def delete_field!(field_id, params = {}) cleaned = params.permit(:list_id) delete("field/#{field_id}", cleaned) end |
#get_field(field_id, params = {}) ⇒ Object
Parameters Name Type Description
field_id string The ID of the list to which the field belongs
Allowed attributes: Name Type Description
list_id string The ID of the list to which the field belongs
15 16 17 18 |
# File 'lib/laposta/client/fields.rb', line 15 def get_field(field_id, params = {}) cleaned = params.permit(:list_id) list("field/#{field_id}", cleaned) end |
#get_fields_for_list(params = {}) ⇒ Object
Allowed attributes: Name Type Description
list_id string The ID of the list to which the field belongs
25 26 27 28 |
# File 'lib/laposta/client/fields.rb', line 25 def get_fields_for_list(params = {}) cleaned = params.permit(:list_id) list("field", cleaned) end |
#update_field!(field_id, params = {}) ⇒ Object
Parameters Name Type Description
field_id string The field’s ID
Allowed attributes: Name Type Description
list_id string The ID of the list to which the field belongs name string (optional) A name for this field defaultvalue string (optional) A potential default value datatype string (optional) The data type: text, numeric, date, select_single or select_multiple datatype_display string (optional) Only applicable for select_single: the desired display (select, radio) options array (optional) What selection options are available? (mandatory for the data types select_single of select_multiple).
The can be given as an array. In the answer the are repeated, but there is also an extra field .
Also listed are the option IDs, which may eventually be used to change the later.
required boolean (optional) Is this a mandatory field? in_form boolean (optional) Does this field occur in the subscription form? in_list boolean (optional) Is this field visible in Laposta’s overview?
80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/laposta/client/fields.rb', line 80 def update_field!(field_id, params = {}) cleaned = params.permit(:list_id, :name, :defaultvalue, :datatype, :datatype_display, :options, :required, :in_form, :in_list) update("field/#{field_id}", cleaned) end |