Class: ForestAdminDatasourceMambuPayments::Collections::InternalAccount
- Inherits:
-
BaseCollection
- Object
- ForestAdminDatasourceToolkit::Collection
- BaseCollection
- ForestAdminDatasourceMambuPayments::Collections::InternalAccount
- Defined in:
- lib/forest_admin_datasource_mambu_payments/collections/internal_account.rb
Constant Summary collapse
- ManyToOneSchema =
ForestAdminDatasourceToolkit::Schema::Relations::ManyToOneSchema
Constants inherited from BaseCollection
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
- #create(_caller, data) ⇒ Object
- #delete(caller, filter) ⇒ Object
-
#initialize(datasource) ⇒ InternalAccount
constructor
A new instance of InternalAccount.
- #serialize(record) ⇒ Object
- #update(caller, filter, patch) ⇒ Object
Methods inherited from BaseCollection
#aggregate, client_resource, #fetch_by_ids, #list
Constructor Details
#initialize(datasource) ⇒ InternalAccount
Returns a new instance of InternalAccount.
9 10 11 12 13 14 |
# File 'lib/forest_admin_datasource_mambu_payments/collections/internal_account.rb', line 9 def initialize(datasource) super(datasource, 'MambuInternalAccount') define_schema define_relations reconcile_filter_operators! end |
Instance Method Details
#create(_caller, data) ⇒ Object
16 17 18 |
# File 'lib/forest_admin_datasource_mambu_payments/collections/internal_account.rb', line 16 def create(_caller, data) serialize(datasource.client.create_internal_account(build_payload(data))) end |
#delete(caller, filter) ⇒ Object
25 26 27 |
# File 'lib/forest_admin_datasource_mambu_payments/collections/internal_account.rb', line 25 def delete(caller, filter) ids_for(caller, filter).each { |id| datasource.client.delete_internal_account(id) } end |
#serialize(record) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/forest_admin_datasource_mambu_payments/collections/internal_account.rb', line 29 def serialize(record) a = attrs_of(record) { 'id' => a['id'], 'object' => a['object'], 'status' => a['status'], 'status_details' => a['status_details'], 'type' => a['type'], 'name' => a['name'], 'holder_name' => a['holder_name'], 'alternative_holder_names' => a['alternative_holder_names'], 'connected_account_ids' => a['connected_account_ids'], 'account_number' => a['account_number'], 'account_number_format' => a['account_number_format'], 'bank_code' => a['bank_code'], 'bank_name' => a['bank_name'], 'bank_address' => a['bank_address'], 'bank_code_format' => a['bank_code_format'], 'holder_address' => a['holder_address'], 'account_holder_id' => a['account_holder_id'], 'creditor_identifier' => a['creditor_identifier'], 'organization_identification' => a['organization_identification'], 'customer_bic' => a['customer_bic'], 'distinguished_name' => a['distinguished_name'], 'currencies' => a['currencies'], 'cbs_source' => a['cbs_source'], 'cbs_account_id' => a['cbs_account_id'], 'cbs_account_type' => a['cbs_account_type'], 'synchronized_with_bank' => a['synchronized_with_bank'], 'metadata' => a['metadata'], 'bank_data' => a['bank_data'], 'custom_fields' => a['custom_fields'], 'created_at' => a['created_at'] } end |
#update(caller, filter, patch) ⇒ Object
20 21 22 23 |
# File 'lib/forest_admin_datasource_mambu_payments/collections/internal_account.rb', line 20 def update(caller, filter, patch) payload = build_payload(patch) ids_for(caller, filter).each { |id| datasource.client.update_internal_account(id, payload) } end |