@@ -23,14 +23,31 @@ If bundler is not being used to manage dependencies, install the gem by executin
23
23
- [x] Create Balances
24
24
- [x] Find Balance
25
25
- [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
30
45
31
46
## Usage
32
47
33
48
``` ruby
49
+ transaction = Blnk ::Transaction .find ' transaction_id'
50
+
34
51
require ' blnk'
35
52
36
53
# client config
@@ -39,24 +56,40 @@ Blnk.address = '192.168.2.7:5001'
39
56
Blnk .secret_token = ' your_strong_secret_key'
40
57
Blnk .search_api_key = Blnk .secret_token
41
58
42
- # ledgers integration
59
+ # Ledgers
43
60
44
61
ledger = Blnk ::Ledger .create(name: ' foobar' )
45
62
ledger = Blnk ::Ledger .find ' ledger_id'
46
63
ledgers = Blnk ::Ledger .all
47
64
48
65
ledgers = Blnk ::Ledger .search(q: ' *' )
49
66
50
- # for search fields check the documentation
51
- https: // docs.blnkledger.com/ ledger/ tutorial/ search/ overview
52
-
53
-
54
- # Balance integrations
67
+ # Balances
55
68
balance = Blnk ::Balance .find ' balance_id'
56
69
balance = Blnk ::Balance .create(ledger_id: ' ledger_id' , currency: ' USD' )
57
70
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: ' *'
58
87
```
59
88
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
+
60
93
61
94
## Development
62
95
0 commit comments