payoneer_csv 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+
3
+ rvm:
4
+ - 1.9.2
5
+ - 1.9.3
6
+ - jruby-19mode
7
+
8
+ before_install:
9
+ - sudo apt-get update -qq
10
+ - sudo apt-get install poppler-utils
11
+
12
+ script:
13
+ - "rspec spec"
data/Gemfile CHANGED
@@ -8,5 +8,5 @@ group :development, :test do
8
8
  gem 'simplecov', require: false
9
9
 
10
10
  gem 'awesome_print'
11
- gem 'debugger'
11
+ gem 'debugger', platforms: :ruby
12
12
  end
data/README.md CHANGED
@@ -2,8 +2,14 @@
2
2
 
3
3
  Simple tool for converting payoneer pdf report to csv file.
4
4
 
5
+ [![Build status](https://secure.travis-ci.org/lucassus/payoneer_csv.png)](http://travis-ci.org/lucassus/payoneer_csv)
6
+
5
7
  ## Installation
6
8
 
9
+ First of all install `pdftotext` executable
10
+
11
+ $ sudo apt-get install poppler-utils
12
+
7
13
  Add this line to your application's Gemfile:
8
14
 
9
15
  gem 'payoneer_csv'
data/bin/payoneer_csv CHANGED
@@ -5,12 +5,14 @@ unless ARGV[0]
5
5
  exit
6
6
  end
7
7
 
8
- payoneer_csv_dir = File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
9
- $LOAD_PATH.unshift(payoneer_csv_dir) unless $LOAD_PATH.include?(payoneer_csv_dir)
10
-
11
8
  require 'payoneer_csv'
12
9
 
13
10
  file_path = File.expand_path(ARGV[0])
11
+ unless File.exist?(file_path)
12
+ puts "Cannot find file: #{file_path}"
13
+ exit
14
+ end
15
+
14
16
  reader = PayoneerCsv::PdfReader.new(file_path)
15
17
  csv_string = PayoneerCsv::Csv.new(reader.read).generate
16
18
  puts csv_string
@@ -1,3 +1,3 @@
1
1
  module PayoneerCsv
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
data/payoneer_csv.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["lucassus@gmail.com"]
7
7
  gem.description = %q{Simple tool for converting payoneer pdf report to csv file}
8
8
  gem.summary = %q{Convert payoneer pdf report to csv file}
9
- gem.homepage = ""
9
+ gem.homepage = "https://github.com/lucassus/payoneer_csv"
10
10
 
11
11
  gem.files = `git ls-files`.split($\)
12
12
  gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
@@ -17,30 +17,43 @@ describe PayoneerCsv::Csv do
17
17
 
18
18
  it { should be_an_instance_of(String) }
19
19
 
20
- it 'should include all transactions' do
21
- parsed = CSV.parse(csv_string)
22
-
23
- parsed.should have(3).items
24
-
25
- header = parsed[0]
26
- header[0].should == 'Transaction Date'
27
- header[1].should == 'Description'
28
- header[2].should == 'Amount'
29
- header[3].should == 'Currency'
30
-
31
- first_row = parsed[1]
32
- created_at, description, amount, currency = *first_row
33
- created_at.should == '10/11/2011'
34
- description.should == 'Foo'
35
- amount.should == '123.12'
36
- currency.should == 'USD'
37
-
38
- second_row = parsed[2]
39
- created_at, description, amount, currency = *second_row
40
- created_at.should == '01/09/2012'
41
- description.should == 'Bar'
42
- amount.should == '-9.99'
43
- currency.should == 'USD'
20
+ describe 'rows' do
21
+ def nth_row(n)
22
+ csv_string.split("\n")[n].split(',')
23
+ end
24
+
25
+ describe 'csv header' do
26
+ subject { nth_row(0) }
27
+
28
+ it { should have(4).items }
29
+
30
+ its([0]) { should == 'Transaction Date' }
31
+ its([1]) { should == 'Description' }
32
+ its([2]) { should == 'Amount' }
33
+ its([3]) { should == 'Currency' }
34
+ end
35
+
36
+ describe 'first row' do
37
+ subject { nth_row(1) }
38
+
39
+ it { should have(4).items }
40
+
41
+ its([0]) { should == '10/11/2011' }
42
+ its([1]) { should == 'Foo' }
43
+ its([2]) { should == '123.12' }
44
+ its([3]) { should == 'USD' }
45
+ end
46
+
47
+ describe 'second row' do
48
+ subject { nth_row(2) }
49
+
50
+ it { should have(4).items }
51
+
52
+ its([0]) { should == '01/09/2012' }
53
+ its([1]) { should == 'Bar' }
54
+ its([2]) { should == '-9.99' }
55
+ its([3]) { should == 'USD' }
56
+ end
44
57
  end
45
58
  end
46
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payoneer_csv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -21,6 +21,7 @@ extra_rdoc_files: []
21
21
  files:
22
22
  - .gitignore
23
23
  - .rspec
24
+ - .travis.yml
24
25
  - Gemfile
25
26
  - LICENSE
26
27
  - README.md
@@ -37,7 +38,7 @@ files:
37
38
  - spec/payoneer_csv/pdf_reader_spec.rb
38
39
  - spec/payoneer_csv/transaction_spec.rb
39
40
  - spec/spec_helper.rb
40
- homepage: ''
41
+ homepage: https://github.com/lucassus/payoneer_csv
41
42
  licenses: []
42
43
  post_install_message:
43
44
  rdoc_options: []