monzo-cli 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: eb93a7bc6981e68095aec985cfe9655a8bf83c87
4
- data.tar.gz: d83d025b4a9af2ad779033dd5d18a0e53c48875a
3
+ metadata.gz: c172de124dc0410bcb7c1aa816cd1e0fd49b8ea9
4
+ data.tar.gz: 4816fe9f21b4c2be0833f8cb794c02238a057ca8
5
5
  SHA512:
6
- metadata.gz: 737236b4c3d0b2d275aef873ad787e32f16c346ad44d209a9ed755e8612693303cba629ba9ac6582c5e3568497e5e0b92f9f09fb77eccb129f3d788c76d50f27
7
- data.tar.gz: ebe13add379ca43bc8e3a16d46a7df301f01d8178c86d27ea5e3973f0e476a57b97b3ba2ab9fc068b2c29815c91b4f1a5f79f03c6452a11318eef8f2ecd25850
6
+ metadata.gz: c1d38995461b606a5c5fa392282245528483693f4623d8022f9c8eb8926f83af5fd52a1bbc63c4447767102f4d165c6989912f8c7837554b58b9224c8984766a
7
+ data.tar.gz: 9c31e0c8bec89d99bff4bb6edd0ae778b339b3f60a831c382136138149340e08c95786e9fdfc141a83c513daa611fa71526620b97a71c1b82afc802ddc393fa6
@@ -34,7 +34,6 @@ command :accounts do |c|
34
34
  end
35
35
 
36
36
  puts table
37
-
38
37
  end
39
38
  end
40
39
 
@@ -42,7 +41,7 @@ desc 'States your account balance'
42
41
  command :balance do |c|
43
42
  c.action do |global_options, options, args|
44
43
 
45
- result = MonzoApi.new(@config).balance
44
+ result = @monzo_api.balance
46
45
 
47
46
  balance = result.balance
48
47
  spent_today = result.spent_today
@@ -63,7 +62,7 @@ arg_name 'Maybe pagination'
63
62
  command :transactions do |c|
64
63
  c.action do |global_options, options, args|
65
64
 
66
- transactions = MonzoApi.new(@config).transactions
65
+ transactions = @monzo_api.transactions
67
66
 
68
67
  table = Terminal::Table.new do |t|
69
68
  t << %w(Amount date Description Balance)
@@ -75,7 +74,6 @@ command :transactions do |c|
75
74
  end
76
75
 
77
76
  puts table
78
-
79
77
  end
80
78
  end
81
79
 
@@ -90,6 +88,7 @@ pre do |global, command, options, args|
90
88
  # on that command only
91
89
 
92
90
  if @config.valid?
91
+ @monzo_api = MonzoApi.new(@config)
93
92
  true
94
93
  else
95
94
  show_no_config_found_error
@@ -216,9 +216,13 @@ module Mondo
216
216
  when 200..299, 300..399
217
217
  # on non-redirecting 3xx statuses, just return the response
218
218
  response
219
- when 400..599
220
- error = ApiError.new(response)
221
- raise(error, "Status code #{response.status}")
219
+ when 400..599
220
+
221
+ if response.status == 401
222
+ raise 'Your token has expired, follow these instructions: https://github.com/cesarferreira/monzo-cli#setup'
223
+ end
224
+ error = ApiError.new(response)
225
+ raise(error, "Status code #{response.status}")
222
226
  else
223
227
  error = ApiError.new(response)
224
228
  raise(error, "Unhandled status code value of #{response.status}")
@@ -1,3 +1,3 @@
1
1
  module Monzo
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: monzo-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - cesar ferreira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-26 00:00:00.000000000 Z
11
+ date: 2016-11-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake