Class: Emarsys::Field
- Inherits:
-
DataObject
- Object
- DataObject
- Emarsys::Field
- Defined in:
- lib/emarsys/data_objects/field.rb
Overview
Methods for the Field API
Class Method Summary collapse
-
.choice(id, account: nil) ⇒ Hash
Query the choice option for a specific field.
-
.collection(account: nil, **params) ⇒ Hash
List data fields.
-
.create(name:, application_type:, string_id: nil, account: nil) ⇒ Hash
Create a new custom field.
Methods inherited from DataObject
delete, get, parameterize_params, post, put, #request
Class Method Details
.choice(id, account: nil) ⇒ Hash
Query the choice option for a specific field
33 34 35 |
# File 'lib/emarsys/data_objects/field.rb', line 33 def choice(id, account: nil) get account, "field/#{id}/choice", {} end |
.collection(account: nil, **params) ⇒ Hash
List data fields
18 19 20 21 22 23 24 25 |
# File 'lib/emarsys/data_objects/field.rb', line 18 def collection(account: nil, **params) params = params.stringify_keys if params['translate'] get account, "field/translate/#{params['translate'].to_s}", {} else get account, 'field', {} end end |
.create(name:, application_type:, string_id: nil, account: nil) ⇒ Hash
Create a new custom field
53 54 55 56 57 |
# File 'lib/emarsys/data_objects/field.rb', line 53 def create(name:, application_type:, string_id: nil, account: nil) params = { name: name, application_type: application_type } params[:string_id] = string_id if string_id post account, 'field', params end |