burglar 0.1.0 → 0.1.1

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
  SHA256:
3
- metadata.gz: 6cbc26fc77ea4427b7ae6cbfa3d53fb441e0897beafba7797b63a7cd853b4a45
4
- data.tar.gz: 45e247c5fa8886e65d70ebc35e61227f9c64b5012247922b7373ed20aa76a8fd
3
+ metadata.gz: 888fdf0ab4e0f0037eabacae540eedce6a207c536293349d49e1bc62b8d105f9
4
+ data.tar.gz: edb2f35b6c5ed890affdc40569b8452453d542fcaf186a33b3f51c2e0bfcdef6
5
5
  SHA512:
6
- metadata.gz: 7d33eb6451240ee1300b6ecdb2a39792f859aec122084d31470b1ba2fbae0ed3ab50f84ae5d986b4584358c0b8d1d2090811da5de8dcfb749872796a64b42daa
7
- data.tar.gz: 20af4b002fc0e12ae83d54a70a22db7b9580816920fdf6ea0eb02d9392e5c2c3104a289a6ede64423cea94cc12fc1d119d905d9dc0f9f8dc2c7f6bc38306168f
6
+ metadata.gz: 066c3e9b82f892de1fdbbf6e505a6a73a282fd4217cbafefe70a617e93221ec765d50a015ee54887ff51ecbd0ec0d4e035af2ad0e7b5d8cf84e63aa9435eaeb9
7
+ data.tar.gz: a48ee6e96da7dce706951edc2bfe8e8569a2f4db21eef42c65512ac041b8a66e6080cd1c6b5caa89487416949a9b1734fcd721b5eaf7688f3ca914c5e0af80c6
data/bin/burglar CHANGED
@@ -10,6 +10,7 @@ def add_common_opts(c)
10
10
  c.option :config, '-c FILE', '--config FILE', 'Config file to load'
11
11
  c.option :begin, '-b DATE', '--begin DATE', 'Beginning of date range'
12
12
  c.option :end, '-e DATE', '--end DATE', 'End of date range'
13
+ c.option :pending, '-p', '--pending', 'Include pending transactions'
13
14
  end
14
15
 
15
16
  def load_config(file)
@@ -12,7 +12,7 @@ module LogCabin
12
12
 
13
13
  def raw_transactions # rubocop:disable Metrics/MethodLength
14
14
  @raw_transactions ||= all_transactions.map do |row|
15
- amount = "$#{row.amount}"
15
+ amount = format('$%.2f', row.amount)
16
16
  name = row.name.downcase
17
17
  action = guess_action(name)
18
18
  state = row.pending ? :pending : :cleared
@@ -24,7 +24,8 @@ module LogCabin
24
24
  actions: [
25
25
  { name: action, amount: amount },
26
26
  { name: account_name }
27
- ]
27
+ ],
28
+ tags: { 'transaction_id' => row.transaction_id }
28
29
  )
29
30
  end
30
31
  end
@@ -58,6 +59,7 @@ module LogCabin
58
59
  new, total = get_transactions_page(list.length)
59
60
  list += new
60
61
  end
62
+ list.reject!(&:pending) unless @options[:pending]
61
63
  @all_transactions = list
62
64
  end
63
65
 
@@ -77,15 +79,18 @@ module LogCabin
77
79
  @accounts ||= api_client.accounts.get(access_token)['accounts']
78
80
  end
79
81
 
82
+ def account
83
+ @account ||= accounts.first if accounts.size == 1
84
+ @account ||= accounts.find { |x| x['name'] == account_clean_name }
85
+ end
86
+
80
87
  def account_id
81
- @account_id ||= accounts.find do |x|
82
- x['name'] == account_clean_name
83
- end['account_id']
88
+ @account_id ||= account['account_id']
84
89
  end
85
90
 
86
91
  def account_clean_name
87
92
  @account_clean_name ||= @options[:name] || raise(
88
- 'No account name provided'
93
+ 'Account name needed (more than one option) but not provided'
89
94
  )
90
95
  end
91
96
 
@@ -3,5 +3,5 @@
3
3
  ##
4
4
  # Set the version (needed for Mercenary -v)
5
5
  module Burglar
6
- VERSION = '0.1.0'.freeze
6
+ VERSION = '0.1.1'.freeze
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: burglar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Les Aker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-26 00:00:00.000000000 Z
11
+ date: 2019-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cymbal