mrjoy-mintkit 0.0.4 → 0.0.5

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: 633ece54cef071dd677e7e93c4dbaee9c7865f91
4
- data.tar.gz: a482977dd634ce5218afc96255ef6958e43665f3
3
+ metadata.gz: 8bc6fae8daafc060f403f3e1b88f6509016be05a
4
+ data.tar.gz: 9b1111adcec6366bb4f6600e1c28584dc7752127
5
5
  SHA512:
6
- metadata.gz: 060e7cc1acbdd7ca8f804ab4750d38b02acfaae757870b6525d9b8ad81c7e7a42510ff57cafc5fe1fb5c9aa8e0aefe3b40f329405f901110eb9b6f2e1e638e4c
7
- data.tar.gz: 17835b25425072306869058c00871222aa6995ab9dc51d46b1982c6a29e52bf1b85079fe80d8862c6625f56c1ce271b43f7d18c0a99a2a36c281d2bb4e4c225b
6
+ metadata.gz: 72a49cf8a2b95b308a2e8d698eb9cdf10ac25c3afd7abafe4d3603c85e7b9fb765b2c57ba64178707349b9a21218fcf212fd3f6365186af91c86e5abd1f4cc76
7
+ data.tar.gz: 07186b66b7391ee28f794fd273256a919f4680d29b7ec9c21edc8793a3965a0d2426ce2a7c0a05727939b7a4af8bf459bec90f1000c65ad00f67c5a027e29758
data/CHANGELOG.md CHANGED
@@ -1,5 +1,15 @@
1
1
  ### dev
2
- [full changelog](http://github.com/MrJoy/mintkit/compare/v0.0.4...master)
2
+ [full changelog](http://github.com/MrJoy/mintkit/compare/v0.0.5...master)
3
+
4
+
5
+ ### v0.0.5
6
+ [full changelog](http://github.com/MrJoy/mintkit/compare/v0.0.4...v0.0.5)
7
+
8
+ Changes
9
+
10
+ * Updated to use a proper CSV parser in order to properly handle transactions
11
+ with commas in the values.
12
+
3
13
 
4
14
  ### v0.0.4
5
15
  [full changelog](http://github.com/MrJoy/mintkit/compare/3f12e2d21ef2adaf79dff02d634d2fd3ea45b33e...v0.0.4)
data/README.md CHANGED
@@ -4,7 +4,8 @@ A Mint.com API. Not at all affiliated with or endorsed by mint.com/intuit. You
4
4
 
5
5
  ## This Fork
6
6
 
7
- * This fork has been updated to work with Mint.com as of 2013-11-10.
7
+ * Updated to work with Mint.com as of 2013-11-10.
8
+ * Updated to properly handle transactions with commas in any field.
8
9
 
9
10
  ## Installation
10
11
 
@@ -1,6 +1,7 @@
1
1
  require "mechanize"
2
2
  require "json"
3
3
  require "mintkit/error"
4
+ require "csv"
4
5
 
5
6
  module Mintkit
6
7
 
@@ -21,32 +22,31 @@ module Mintkit
21
22
 
22
23
  transos = []
23
24
 
24
- raw_transactions.split("\n").each_with_index do |line,index|
25
-
26
- if index > 1
27
- line_array = line.split(",")
28
- transaction = {
29
- :date => Date.strptime(remove_quotes(line_array[0]), '%m/%d/%Y'),
30
- :description=>remove_quotes(line_array[1]),
31
- :original_description=>remove_quotes(line_array[2]),
32
- :amount=>remove_quotes(line_array[3]).to_f,
33
- :type=>remove_quotes(line_array[4]),
34
- :category=>remove_quotes(line_array[5]),
35
- :account=>remove_quotes(line_array[6]),
36
- :labels=>remove_quotes(line_array[7]),
37
- :notes=>remove_quotes(line_array[8])
38
- }
39
- transos << transaction
25
+ CSV::Converters[:string] = proc do |field|
26
+ field.encode(ConverterEncoding) rescue field
27
+ end
40
28
 
41
- if block_given?
42
- yield transaction
43
- end
29
+ transos = CSV.parse(raw_transactions, { :headers => true }).map do |row|
30
+ puts row.inspect
31
+ {
32
+ :date => Date.strptime(row['Date'], '%m/%d/%Y'),
33
+ :description => row['Description'],
34
+ :original_description => row['Original Description'],
35
+ :amount => row['Amount'].to_f,
36
+ :type => row['Transaction Type'],
37
+ :category => row['Category'],
38
+ :account => row['Account Name'],
39
+ :labels => row['Labels'],
40
+ :notes => row['Notes'],
41
+ }
42
+ end
44
43
 
44
+ if block_given?
45
+ transos.each do |transaction|
46
+ yield transaction
45
47
  end
46
-
47
48
  end
48
49
  transos
49
-
50
50
  end
51
51
 
52
52
  def accounts
@@ -93,7 +93,7 @@ module Mintkit
93
93
  @agent.post("https://wwws.mint.com/refreshFILogins.xevent", {"token"=>@token})
94
94
 
95
95
  true
96
-
96
+
97
97
  end
98
98
  private
99
99
 
@@ -1,3 +1,3 @@
1
1
  module Mintkit
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mrjoy-mintkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Frisby