Class: ForestAdminDatasourceMambuPayments::Collections::AccountHolder
- Inherits:
-
BaseCollection
- Object
- ForestAdminDatasourceToolkit::Collection
- BaseCollection
- ForestAdminDatasourceMambuPayments::Collections::AccountHolder
show all
- Defined in:
- lib/forest_admin_datasource_mambu_payments/collections/account_holder.rb
Constant Summary
collapse
- OneToManySchema =
ForestAdminDatasourceToolkit::Schema::Relations::OneToManySchema
BaseCollection::BOOL_OPS, BaseCollection::ColumnSchema, BaseCollection::DATE_OPS, BaseCollection::ForestException, BaseCollection::ID_OPS, BaseCollection::Leaf, BaseCollection::NUMBER_OPS, BaseCollection::Operators, BaseCollection::STRING_OPS
Instance Method Summary
collapse
#aggregate, client_resource, #fetch_by_ids, #list
Constructor Details
Returns a new instance of AccountHolder.
8
9
10
11
12
13
|
# File 'lib/forest_admin_datasource_mambu_payments/collections/account_holder.rb', line 8
def initialize(datasource)
super(datasource, 'MambuAccountHolder')
define_schema
define_relations
reconcile_filter_operators!
end
|
Instance Method Details
#create(_caller, data) ⇒ Object
15
16
17
|
# File 'lib/forest_admin_datasource_mambu_payments/collections/account_holder.rb', line 15
def create(_caller, data)
serialize(datasource.client.create_account_holder(build_payload(data)))
end
|
#delete(caller, filter) ⇒ Object
24
25
26
|
# File 'lib/forest_admin_datasource_mambu_payments/collections/account_holder.rb', line 24
def delete(caller, filter)
ids_for(caller, filter).each { |id| datasource.client.delete_account_holder(id) }
end
|
#serialize(record) ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/forest_admin_datasource_mambu_payments/collections/account_holder.rb', line 28
def serialize(record)
a = attrs_of(record)
{
'id' => a['id'],
'object' => a['object'],
'name' => a['name'],
'metadata' => a['metadata'],
'disabled_at' => a['disabled_at'],
'created_at' => a['created_at']
}
end
|
#update(caller, filter, patch) ⇒ Object
19
20
21
22
|
# File 'lib/forest_admin_datasource_mambu_payments/collections/account_holder.rb', line 19
def update(caller, filter, patch)
payload = build_payload(patch)
ids_for(caller, filter).each { |id| datasource.client.update_account_holder(id, payload) }
end
|