Class: ForestAdminDatasourceZendesk::Collections::Organization
- Inherits:
-
BaseCollection
- Object
- ForestAdminDatasourceToolkit::Collection
- BaseCollection
- ForestAdminDatasourceZendesk::Collections::Organization
show all
- Includes:
- Searchable
- Defined in:
- lib/forest_admin_datasource_zendesk/collections/organization.rb
Constant Summary
collapse
- OneToManySchema =
ForestAdminDatasourceToolkit::Schema::Relations::OneToManySchema
- ZENDESK_SORTABLE =
{
'created_at' => 'created_at',
'updated_at' => 'updated_at',
'name' => 'name'
}.freeze
BaseCollection::ColumnSchema, BaseCollection::DATE_OPS, BaseCollection::Leaf, BaseCollection::NUMBER_OPS, BaseCollection::Operators, BaseCollection::STRING_OPS
Instance Attribute Summary
#custom_fields
Instance Method Summary
collapse
Methods included from Searchable
#list
#aggregate
Constructor Details
#initialize(datasource, custom_fields: []) ⇒ Organization
Returns a new instance of Organization.
14
15
16
|
# File 'lib/forest_admin_datasource_zendesk/collections/organization.rb', line 14
def initialize(datasource, custom_fields: [])
super(datasource, 'ZendeskOrganization', custom_fields: custom_fields)
end
|
Instance Method Details
#create(_caller, data) ⇒ Object
18
19
20
21
22
|
# File 'lib/forest_admin_datasource_zendesk/collections/organization.rb', line 18
def create(_caller, data)
payload = build_payload(data)
created = datasource.client.create_organization(payload)
serialize(created)
end
|
#delete(caller, filter) ⇒ Object
30
31
32
|
# File 'lib/forest_admin_datasource_zendesk/collections/organization.rb', line 30
def delete(caller, filter)
ids_for(caller, filter).each { |id| datasource.client.delete_organization(id) }
end
|
#update(caller, filter, patch) ⇒ Object
24
25
26
27
28
|
# File 'lib/forest_admin_datasource_zendesk/collections/organization.rb', line 24
def update(caller, filter, patch)
ids = ids_for(caller, filter)
payload = build_payload(patch)
ids.each { |id| datasource.client.update_organization(id, payload) }
end
|