Skip to content

Commit adf4120

Browse files
committed
update readme
1 parent bd718ca commit adf4120

File tree

1 file changed

+43
-10
lines changed

1 file changed

+43
-10
lines changed

README.md

+43-10
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,31 @@ If bundler is not being used to manage dependencies, install the gem by executin
2323
- [x] Create Balances
2424
- [x] Find Balance
2525
- [x] Search Balances
26-
- [ ] Create Transaction
27-
- [ ] Find Transaction
28-
- [ ] Search Transactions
29-
- [ ] Use Dry Schema to validate inputs
26+
- [x] Create Transaction
27+
- [ ] Multiple sources / destinations Transaction
28+
- [ ] Refund Transaction
29+
- [ ] Commit inflight Transaction
30+
- [ ] Void inflight Transaction
31+
- [x] Find Transaction
32+
- [x] Search Transactions
33+
- [ ] Handler notifications
34+
- [ ] Create Balance Monitor
35+
- [ ] Find Balance Monitor
36+
- [ ] Update Balance Monitor
37+
- [ ] Backup endpoint
38+
- [ ] Backup to S3 endpoint
39+
- [ ] Add Search Contract schema for each resource using they own search attributes
40+
- [ ] Search Result should convert document resul into resource class
41+
- [x] Use Dry Monads to get success / failure output
42+
- [x] Use Dry Validation to validate inputs
43+
- [ ] Use Dry Schema instead OpenStruct to handle with resource attributes
44+
- [ ] Use Dry Configuration to better config DSL
3045

3146
## Usage
3247

3348
```ruby
49+
transaction = Blnk::Transaction.find 'transaction_id'
50+
3451
require 'blnk'
3552

3653
# client config
@@ -39,24 +56,40 @@ Blnk.address = '192.168.2.7:5001'
3956
Blnk.secret_token = 'your_strong_secret_key'
4057
Blnk.search_api_key = Blnk.secret_token
4158

42-
# ledgers integration
59+
# Ledgers
4360

4461
ledger = Blnk::Ledger.create(name: 'foobar')
4562
ledger = Blnk::Ledger.find 'ledger_id'
4663
ledgers = Blnk::Ledger.all
4764

4865
ledgers = Blnk::Ledger.search(q: '*')
4966

50-
# for search fields check the documentation
51-
https://docs.blnkledger.com/ledger/tutorial/search/overview
52-
53-
54-
# Balance integrations
67+
# Balances
5568
balance = Blnk::Balance.find 'balance_id'
5669
balance = Blnk::Balance.create(ledger_id: 'ledger_id', currency: 'USD')
5770

71+
balances = Blnk::Balance.search(q: '*')
72+
73+
# Transactions
74+
transaction = Blnk::Transaction.find 'transaction_id'
75+
transaction = Blnk::Transaction.create(
76+
amount: 75,
77+
reference: 'ref_005',
78+
currency: 'BRLX',
79+
precision: 100,
80+
source: '@world',
81+
destination: 'bln_469f93bc-40e9-4e0e-b6ab-d11c3638c15d',
82+
description: 'For fees',
83+
allow_overdraft: true
84+
)
85+
86+
transaction = Blnk::Transaction.search q: '*'
5887
```
5988

89+
## Result
90+
91+
All methods return a Dry::Monad::Result, so you can use ```.failure?``` to check if method was executed and returned a failure (can be validation or a server error). ```.success?``` to check if method was executed with successful and access the data from the failure or successful result using ```.value!```. You can check on the dry-monad gem to see other options on Result.
92+
6093

6194
## Development
6295

0 commit comments

Comments
 (0)