monzo-cli 0.0.1 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +41 -13
- data/bin/monzo-cli +16 -12
- data/lib/api/mondo/balance.rb +1 -1
- data/lib/api/mondo/client.rb +4 -7
- data/lib/monzo/monzo_api.rb +1 -1
- data/lib/monzo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb93a7bc6981e68095aec985cfe9655a8bf83c87
|
4
|
+
data.tar.gz: d83d025b4a9af2ad779033dd5d18a0e53c48875a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 737236b4c3d0b2d275aef873ad787e32f16c346ad44d209a9ed755e8612693303cba629ba9ac6582c5e3568497e5e0b92f9f09fb77eccb129f3d788c76d50f27
|
7
|
+
data.tar.gz: ebe13add379ca43bc8e3a16d46a7df301f01d8178c86d27ea5e3973f0e476a57b97b3ba2ab9fc068b2c29815c91b4f1a5f79f03c6452a11318eef8f2ecd25850
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -14,11 +14,35 @@
|
|
14
14
|
```bash
|
15
15
|
$ monzo-cli balance
|
16
16
|
|
17
|
-
+---------+-------------+
|
18
|
-
| Balance | Spent today |
|
19
|
-
+---------+-------------+
|
20
|
-
| £490 | £10 |
|
21
|
-
+---------+-------------+
|
17
|
+
+---------+-------------+
|
18
|
+
| Balance | Spent today |
|
19
|
+
+---------+-------------+
|
20
|
+
| £490 | £10 |
|
21
|
+
+---------+-------------+
|
22
|
+
```
|
23
|
+
|
24
|
+
## Transactions list
|
25
|
+
|
26
|
+
```bash
|
27
|
+
$ monzo-cli transactions
|
28
|
+
|
29
|
+
+----------+---------------------------+------------------------------------------+----------+
|
30
|
+
| Amount | date | Description | Balance |
|
31
|
+
+----------+---------------------------+------------------------------------------+----------+
|
32
|
+
| £ -5.59 | 2016-11-26T02:30:17+00:00 | Amazon EU AMAZON.CO.UK LUX | £ 37.42 |
|
33
|
+
+----------+---------------------------+------------------------------------------+----------+
|
34
|
+
| £ -46.99 | 2016-11-25T11:01:21+00:00 | Amazon Prime Now UK 811-111-1111 LUX | £ 43.01 |
|
35
|
+
+----------+---------------------------+------------------------------------------+----------+
|
36
|
+
| £ 1.00 | 2016-11-25T11:00:55+00:00 | Amazon Prime Now UK 811-111-1111 LUX | £ 90.00 |
|
37
|
+
+----------+---------------------------+------------------------------------------+----------+
|
38
|
+
| £ -1.00 | 2016-11-25T11:00:54+00:00 | Amazon Prime Now UK 811-111-1111 LUX | £ 89.00 |
|
39
|
+
+----------+---------------------------+------------------------------------------+----------+
|
40
|
+
| £ -10.00 | 2016-11-25T09:39:47+00:00 | SKY RESTAURANT STAFF TOP UP GBR | £ 90.00 |
|
41
|
+
+----------+---------------------------+------------------------------------------+----------+
|
42
|
+
| £ 0.00 | 2016-11-25T08:59:17+00:00 | Uber BV help.uber.com NLD | £ 100.00 |
|
43
|
+
+----------+---------------------------+------------------------------------------+----------+
|
44
|
+
| £ 100.00 | 2016-11-24T20:00:02+00:00 | Initial top up | £ 100.00 |
|
45
|
+
+----------+---------------------------+------------------------------------------+----------+
|
22
46
|
```
|
23
47
|
|
24
48
|
## Accounts
|
@@ -26,11 +50,11 @@ $ monzo-cli balance
|
|
26
50
|
```bash
|
27
51
|
$ monzo-cli accounts
|
28
52
|
|
29
|
-
+---------------------+----------------------+
|
30
|
-
| Description | Date created |
|
31
|
-
+---------------------+----------------------+
|
32
|
-
| Peter Pans Account | 2015-11-13T12:17:42Z |
|
33
|
-
+---------------------+----------------------+
|
53
|
+
+---------------------+----------------------+
|
54
|
+
| Description | Date created |
|
55
|
+
+---------------------+----------------------+
|
56
|
+
| Peter Pans Account | 2015-11-13T12:17:42Z |
|
57
|
+
+---------------------+----------------------+
|
34
58
|
```
|
35
59
|
|
36
60
|
## Install
|
@@ -39,9 +63,10 @@ $ monzo-cli accounts
|
|
39
63
|
gem install monzo-cli
|
40
64
|
```
|
41
65
|
|
66
|
+
## Setup
|
42
67
|
Get your access tokens from this URL: https://developers.getmondo.co.uk/api/playground
|
43
|
-
|
44
|
-
|
68
|
+
|
69
|
+
|
45
70
|
Please create/edit it on `~/.monzo-cli.yml` with this format:
|
46
71
|
|
47
72
|
|
@@ -51,7 +76,10 @@ account_id: acc_0aksdaklsjSh28181
|
|
51
76
|
access_token: Qnjdas8hakxdjasQscGVgnVGIVXpvpZ5uCxkQ5XLnDHnOPoBtXreQ6adBo
|
52
77
|
|
53
78
|
```
|
54
|
-
|
79
|
+
|
80
|
+
## Caveats
|
81
|
+
- Right now the `access_token` expires everyday, still need to find a way to refresh it automatically
|
82
|
+
|
55
83
|
## Contributing
|
56
84
|
I welcome and encourage all pull requests. It usually will take me within 24-48 hours to respond to any issue or request. Here are some basic rules to follow to ensure timely addition of your request:
|
57
85
|
1. If its a feature, bugfix, or anything please only change code to what you specify.
|
data/bin/monzo-cli
CHANGED
@@ -50,7 +50,7 @@ command :balance do |c|
|
|
50
50
|
table = Terminal::Table.new do |t|
|
51
51
|
t << ['Balance', 'Spent today']
|
52
52
|
t << :separator
|
53
|
-
t << ["
|
53
|
+
t << ["£ #{balance}".green, "£ #{spent_today}".green]
|
54
54
|
end
|
55
55
|
|
56
56
|
puts table
|
@@ -62,7 +62,20 @@ desc 'List your transactions'
|
|
62
62
|
arg_name 'Maybe pagination'
|
63
63
|
command :transactions do |c|
|
64
64
|
c.action do |global_options, options, args|
|
65
|
-
|
65
|
+
|
66
|
+
transactions = MonzoApi.new(@config).transactions
|
67
|
+
|
68
|
+
table = Terminal::Table.new do |t|
|
69
|
+
t << %w(Amount date Description Balance)
|
70
|
+
|
71
|
+
transactions.each { |item|
|
72
|
+
t << :separator
|
73
|
+
t << ["£ #{item.amount}".green, item.created, item.description, "£ #{item.account_balance}".green]
|
74
|
+
}
|
75
|
+
end
|
76
|
+
|
77
|
+
puts table
|
78
|
+
|
66
79
|
end
|
67
80
|
end
|
68
81
|
|
@@ -98,17 +111,8 @@ end
|
|
98
111
|
|
99
112
|
|
100
113
|
def show_no_config_found_error
|
101
|
-
|
102
|
-
open_operation = "vim #{@path_to_config}".green
|
103
|
-
|
104
114
|
puts "\nError reading from #{@path_to_config.green}"
|
105
|
-
puts
|
106
|
-
puts "Please create/edit it with #{open_operation} with this format:\n\n"
|
107
|
-
|
108
|
-
puts " user_id: user_18231092askdas9212".yellow
|
109
|
-
puts " account_id: acc_0aksdaklsjSh28181".yellow
|
110
|
-
puts " access_token: Qnjdas8hakxdjasQscGVgnVGIVXpvpZ5uCxkQ5XLnDHnOPoBtXreQ6adBo".yellow
|
111
|
-
|
115
|
+
puts 'Instructions to set everything up in here: https://github.com/cesarferreira/monzo-cli#setup'
|
112
116
|
puts "\n\n"
|
113
117
|
end
|
114
118
|
|
data/lib/api/mondo/balance.rb
CHANGED
data/lib/api/mondo/client.rb
CHANGED
@@ -116,10 +116,10 @@ module Mondo
|
|
116
116
|
|
117
117
|
# @method transactions
|
118
118
|
# @return [Transactions] all transactions for this user
|
119
|
-
def transactions(
|
120
|
-
|
121
|
-
|
122
|
-
resp = api_get("
|
119
|
+
def transactions(account_id = nil)
|
120
|
+
account_id ||= self.account_id
|
121
|
+
raise ClientError.new("You must provide an account id to see your balance") unless account_id
|
122
|
+
resp = api_get("transactions", account_id: account_id)
|
123
123
|
return resp if resp.error.present?
|
124
124
|
resp.parsed["transactions"].map { |tx| Transaction.new(tx, self) }
|
125
125
|
end
|
@@ -164,9 +164,6 @@ module Mondo
|
|
164
164
|
raise ClientError.new("You must provide an account id to list webhooks") unless self.account_id
|
165
165
|
@web_hooks ||= begin
|
166
166
|
resp = api_get("webhooks", account_id: self.account_id)
|
167
|
-
|
168
|
-
puts resp.inspect
|
169
|
-
|
170
167
|
resp.parsed['webhooks'].map { |hook| WebHook.new(hook, self) }
|
171
168
|
end
|
172
169
|
end
|
data/lib/monzo/monzo_api.rb
CHANGED
data/lib/monzo/version.rb
CHANGED