coda_standard 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 05d6ff0f431170fc7ce3d0847194a9c81dc26ca4
4
- data.tar.gz: 9cb2ffe57f5bc23e6cec60f7664458d7a62febbf
3
+ metadata.gz: 642ed89a40b23ef43c468b8087c29f0af3e1bea3
4
+ data.tar.gz: d3c4a4a533aad85c8fb64ccd4c414737f85c39d1
5
5
  SHA512:
6
- metadata.gz: 281c8af15a299d86a70aaa71f4a5c5c3cdcc260e8f09202ce4088e9a481b81559ac2a70b13ddd9cf0724e2efe9438eab6d497f28ce2afc9aa64f5aa9fee82e93
7
- data.tar.gz: 7de41a2731cdaffd21c53b7aef86f1f3f6089e0a5649376589d8235acff99100212db4fccd64262c562368cac759f84b43bcf73c6375b41cd209bfdd7e682c23
6
+ metadata.gz: 409f68bb12632332bffe9a980f35bef829896e843c10a128dd03c7a5c3d0eb6f6f7d7adfadd895b60f301b391b20b2fb1a8aeec714d325d302ae4497a8d20ddd
7
+ data.tar.gz: 64416cd18dbca8e0f696fc023ef3132e84cc831f9cac51b3a2628d200a4eed543f3b06ee7b51a5ea77a3fc5a9e946cd806c7f4ea9d4fec2e5289c980c33ca094
data/.gitignore ADDED
@@ -0,0 +1,51 @@
1
+
2
+ /.bundle/
3
+ /.yardoc
4
+ /Gemfile.lock
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+ *.bundle
12
+ *.so
13
+ *.o
14
+ *.a
15
+ mkmf.log
16
+
17
+ *.gem
18
+ *.rbc
19
+ /.config
20
+ /coverage/
21
+ /InstalledFiles
22
+ /pkg/
23
+ /spec/reports/
24
+ /test/tmp/
25
+ /test/version_tmp/
26
+ /tmp/
27
+
28
+ ## Specific to RubyMotion:
29
+ .dat*
30
+ .repl_history
31
+ build/
32
+
33
+ ## Documentation cache and generated files:
34
+ /.yardoc/
35
+ /_yardoc/
36
+ /doc/
37
+ /rdoc/
38
+
39
+ ## Environment normalisation:
40
+ /.bundle/
41
+ /vendor/bundle
42
+ /lib/bundler/man/
43
+
44
+ # for a library or gem, you might want to ignore these files since the code is
45
+ # intended to run in multiple environments; otherwise, check them in:
46
+ # Gemfile.lock
47
+ # .ruby-version
48
+ # .ruby-gemset
49
+
50
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
51
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in coda-standard.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2015 Alvaro Leal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
data/README.md ADDED
@@ -0,0 +1,46 @@
1
+ # coda_standard Gem
2
+
3
+ This gem parses the Coded statement of account (CODA) bank standard.
4
+ ## Installation
5
+
6
+ Add this line to your application's Gemfile:
7
+
8
+ ```ruby
9
+ gem 'coda_standard'
10
+ ```
11
+
12
+ And then execute:
13
+
14
+ $ bundle
15
+
16
+ Or install it yourself as:
17
+
18
+ $ gem install coda_standard
19
+
20
+ ## Usage
21
+
22
+ $ CodaStandard::Parser.new.parse(filename)
23
+
24
+ Returns an TransactionList object
25
+
26
+ $ CodaStandard::Parser.new.parse(filename).transactions
27
+
28
+ Returns an array of transactions
29
+
30
+ $ CodaStandard::Parser.new.parse(filename).current_bic => "GEBABEBB"
31
+
32
+ You can get different common data from the TransactionList (current_bic, old_balance, current_account, current_account_type)
33
+
34
+ $ CodaStandard::Parser.new.show(filename)
35
+
36
+ Shows the transactions info in the terminal
37
+
38
+ ## Contributing
39
+
40
+ 1. Fork it ( https://github.com/Bluesmile82/coda_standard/fork )
41
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
42
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
43
+ 4. Push to the branch (`git push origin my-new-feature`)
44
+ 5. Create a new Pull Request
45
+
46
+ =======
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,25 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'coda_standard/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "coda_standard"
8
+ spec.version = CodaStandard::VERSION
9
+ spec.authors = ["Alvaro Leal"]
10
+ spec.email = ["pursuance@gmail.com"]
11
+ spec.summary = %q{CODA bank standard file parser}
12
+ spec.description = "This gem parses the Coded statement of account (CODA) bank standard"
13
+ spec.homepage = "https://github.com/Bluesmile82/coda_standard"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split("\n")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.required_ruby_version = '~> 2.0'
22
+ spec.add_development_dependency "bundler", "~> 1.7"
23
+ spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_development_dependency "rspec", "~> 3.1"
25
+ end
@@ -0,0 +1,116 @@
1
+ module CodaStandard
2
+ class Line
3
+ attr_reader :line
4
+
5
+ def initialize(line)
6
+ @line = line
7
+ @regexp = {
8
+ current_bic: /^0.{59}(.{11})/,
9
+ current_account: /^1(.{41})/,
10
+ name: /^23.{45}(.{35})/,
11
+ currency: /^23.{42}(.{3})/,
12
+ entry_date: /^21.{113}(\d{6})/,
13
+ reference_number: /^21.{8}(.{21})/,
14
+ address: /^32.{8}(.{105})/,
15
+ account: /^23\d{8}(\w+)\D/,
16
+ bic: /^22.{96}(.{11})/,
17
+ amount: /^21\d+\s+(\d{16})/,
18
+ old_balance: /^1.{41}(\d)(\d{15})/,
19
+ clean_zeros: /0*([^0]\d+)(\d{3})/,
20
+ sep_address: /(^.+)(\d{4})\s(\S+)(\s\S+)?$/,
21
+ sep_account: /(^.)(.{3})(.+)/,
22
+ bban_be_account: /(^.{12})/,
23
+ bban_foreign_account: /(^.{34})/,
24
+ iban_be_account: /(^.{31})/,
25
+ iban_foreign_account: /(^.{34})/,
26
+ currencies:/(^.+)(AED|AFN|ALL|AMD|ANG|AOA|ARS|AUD|AWG|AZN|BAM|BBD|BDT|BGN|BHD|BIF|BMD|BND|BOB|BOV|BRL|BSD|BTN|BWP|BYR|BZD|CAD|CDF|CHE|CHF|CHW|CLF|CLP|CNY|COP|COU|CRC|CUC|CUP|CVE|CZK|DJF|DKK|DOP|DZD|EGP|ERN|ETB|EUR|FJD|FKP|GBP|GEL|GHS|GIP|GMD|GNF|GTQ|GYD|HKD|HNL|HRK|HTG|HUF|IDR|ILS|INR|IQD|IRR|ISK|JMD|JOD|JPY|KES|KGS|KHR|KMF|KPW|KRW|KWD|KYD|KZT|LAK|LBP|LKR|LRD|LSL|LTL|LVL|LYD|MAD|MDL|MGA|MKD|MMK|MNT|MOP|MRO|MUR|MVR|MWK|MXN|MXV|MYR|MZN|NAD|NGN|NIO|NOK|NPR|NZD|OMR|PAB|PEN|PGK|PHP|PKR|PLN|PYG|QAR|RON|RSD|RUB|RWF|SAR|SBD|SCR|SDG|SEK|SGD|SHP|SLL|SOS|SRD|SSP|STD|SVC|SYP|SZL|THB|TJS|TMT|TND|TOP|TRY|TTD|TWD|TZS|UAH|UGX|USD|USN|USS|UYI|UYU|UZS|VEF|VND|VUV|WST|XAF|XAG|XAU|XBA|XBB|XBC|XBD|XCD|XDR|XFU|XOF|XPD|XPF|XPT|XSU|XTS|XUA|XXX|YER|ZAR|ZMW|ZWL)/
27
+ }
28
+ end
29
+
30
+ def current_bic
31
+ extract(:current_bic)
32
+ end
33
+
34
+ def current_account
35
+ extract(:current_account)
36
+ end
37
+
38
+ def old_balance
39
+ extract(:old_balance)
40
+ end
41
+
42
+ def entry_date
43
+ extract(:entry_date)
44
+ end
45
+
46
+ def reference_number
47
+ extract(:reference_number)
48
+ end
49
+
50
+ def amount
51
+ extract(:amount)
52
+ end
53
+
54
+ def bic
55
+ extract(:bic)
56
+ end
57
+
58
+ def currency
59
+ extract(:currency)
60
+ end
61
+
62
+ def name
63
+ extract(:name)
64
+ end
65
+
66
+ def account
67
+ extract(:account)
68
+ end
69
+
70
+ def address
71
+ extract(:address)
72
+ end
73
+
74
+ private
75
+
76
+ def extract(field)
77
+ result = @line.scan(@regexp[field]).join.strip
78
+ case field
79
+ when :address
80
+ result = separate_address(result)
81
+ when :current_account
82
+ result = clean_account(result)
83
+ when :old_balance, :amount
84
+ result = clean_zeros(result)
85
+ end
86
+ result
87
+ end
88
+
89
+ def separate_address(address)
90
+ address_fields = address.scan(@regexp[:sep_address])[0]
91
+ {address: address_fields[0].strip, postcode: address_fields[1], city: address_fields[2], country: address_fields[3]}
92
+ end
93
+
94
+ def clean_account(account)
95
+ account_type = account.scan(@regexp[:sep_account])[0][0]
96
+ sequence_number = account.scan(@regexp[:sep_account])[0][1]
97
+ raw_account = account.scan(@regexp[:sep_account])[0][2]
98
+ case account_type
99
+ when "0" then account_type = "bban_be_account"
100
+ when "1" then account_type = "bban_foreign_account"
101
+ when "2" then account_type = "iban_be_account"
102
+ when "3" then account_type = "iban_foreign_account"
103
+ end
104
+ account_number = raw_account.scan(@regexp[account_type.to_sym]).join
105
+ {account_type: account_type, account_number: account_number}
106
+ end
107
+
108
+ def clean_zeros(amount)
109
+ amount[0] == "0" ? amount_sign = "" : amount_sign = "-"
110
+ amount_integral = amount.scan(@regexp[:clean_zeros])[0][0]
111
+ amount_decimals = amount.scan(@regexp[:clean_zeros])[0][1]
112
+ separator = ","
113
+ amount_sign + amount_integral + separator + amount_decimals
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,62 @@
1
+ module CodaStandard
2
+ class Parser
3
+ attr_reader :transactions, :old_balance, :current_bic, :current_account, :current_transaction
4
+ def initialize
5
+ @transactions = TransactionList.new
6
+ @current_transaction = Transaction.new
7
+ end
8
+
9
+ def parse(file_name)
10
+ file = File.open( file_name ).each do |row|
11
+ line = Line.new(row)
12
+ case
13
+ when line.line =~ /^0/
14
+ @transactions.current_bic = line.current_bic
15
+ when line.line =~ /^1/
16
+ set_account(line.current_account)
17
+ @transactions.old_balance = line.old_balance
18
+ when line.line =~ /^21/
19
+ @current_transaction = @transactions.create
20
+ @current_transaction.entry_date = line.entry_date
21
+ @current_transaction.reference_number = line.reference_number
22
+ @current_transaction.amount = line.amount
23
+ when line.line =~ /^22/
24
+ @current_transaction.bic = line.bic
25
+ when line.line =~ /^23/
26
+ @current_transaction.currency = line.currency
27
+ @current_transaction.name = line.name
28
+ @current_transaction.account = line.account
29
+ when line.line =~ /^32/
30
+ set_address(line.address)
31
+ end
32
+ end
33
+ @transactions
34
+ end
35
+
36
+ def set_address(address)
37
+ @current_transaction.address = address[:address]
38
+ @current_transaction.postcode = address[:postcode]
39
+ @current_transaction.city = address[:city]
40
+ @current_transaction.country = address[:country]
41
+ end
42
+
43
+ def set_account(account)
44
+ @transactions.current_account = account[:account_number]
45
+ @transactions.current_account_type = account[:account_type]
46
+ end
47
+
48
+ def show(file_name)
49
+ parse(file_name)
50
+ puts "**--Transactions--**\n\n"
51
+ puts "Account: #{@transactions.current_account} Account type: #{@transactions.current_account_type} BIC: #{@transactions.current_bic}"
52
+ puts "Old balance: #{@transactions.old_balance} \n\n"
53
+ @transactions.each_with_index do |transaction, index|
54
+ puts "-- Transaction n.#{index + 1} in date #{transaction.entry_date}-- \n\n"
55
+ puts " RN: #{transaction.reference_number} Account: #{transaction.account} BIC:#{transaction.bic}"
56
+ puts " Amount: #{transaction.amount} #{transaction.currency}"
57
+ puts " Name: #{transaction.name}"
58
+ puts " Address: #{transaction.address} #{transaction.postcode} #{transaction.city} #{transaction.country} \n\n"
59
+ end
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,5 @@
1
+ module CodaStandard
2
+ class Transaction
3
+ attr_accessor :name, :currency, :bic, :address, :postcode, :city, :country, :amount, :account, :entry_date, :reference_number
4
+ end
5
+ end
@@ -0,0 +1,19 @@
1
+ module CodaStandard
2
+ class TransactionList
3
+ attr_accessor :current_bic, :old_balance, :current_account, :current_account_type
4
+ attr_reader :transactions
5
+
6
+ def initialize
7
+ @transactions = []
8
+ end
9
+
10
+ def create
11
+ @transactions << Transaction.new
12
+ @transactions.last
13
+ end
14
+
15
+ def each_with_index(&blk)
16
+ @transactions.each_with_index(&blk)
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,3 @@
1
+ module CodaStandard
2
+ VERSION = "0.1.2"
3
+ end
@@ -0,0 +1,7 @@
1
+ require "coda_standard/version"
2
+ require "coda_standard/parser"
3
+ require "coda_standard/transaction"
4
+ require "coda_standard/transaction_list"
5
+ require "coda_standard/line"
6
+ module CodaStandard
7
+ end
data/spec/coda.cod ADDED
@@ -0,0 +1,14 @@
1
+ 0000031031520005 MMIF SA/BANK GEBABEBB 00538839354 00000 2
2
+ 10016539007547034 EUR0BE 0000000057900000300315MMIF SA/EVOCURE 017
3
+ 21000100000001500000103 0000000000500000010415001500001101100000834941 31031501601 0
4
+ 2200010000 GKCCBEBB 1 0
5
+ 2300010000BE53900754703405 EURLASTNM PERSON 0 1
6
+ 31000100010001500000103 001500001001LASTNM PERSON 1 0
7
+ 3200010001CHAUSSEE DE BIERE 10 1978 SOMECITY 0 0
8
+ 21000200000001500000104 0000000000200000010415001500001102100000835749 31031501601 0
9
+ 2200020000 BILLLULL 1 0
10
+ 2300020000LU539007547034898400 EURM.JOHN DOE 0 1
11
+ 31000200010001500000104 001500001001M.JOHN DOE 1 0
12
+ 32000200015 STREET 3654 CITY BELGIQUE 0 0
13
+ 8016035918134040 EUR0BE 0000000058900000310315 0
14
+ 9 000027000000000000000000000001000000 1
data/spec/line_spec.rb ADDED
@@ -0,0 +1,79 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe CodaStandard::Line do
4
+ before :each do
5
+ @line0 = CodaStandard::Line.new("0000031031520005 MMIF SA/EVOCURE GEBABEBB 00538839354 00000 2")
6
+ @line1 = CodaStandard::Line.new("10016035918134040 EUR0BE 0000000057900000300315MMIF SA/EVOCURE 017")
7
+ @line21 = CodaStandard::Line.new("21000100000001500000103 0000000000500000010415001500001101100000834941 31031501601 0")
8
+ @line22 = CodaStandard::Line.new("2200010000 GKCCBEBB 1 0")
9
+ @line23 = CodaStandard::Line.new("2300010000BE96553242750005 EURCOUREL PASCAL 0 1")
10
+ @line32 = CodaStandard::Line.new("3200010001CHAUSSEE DE MALINES 10 1970 WEZEMBEEK-OPPEM 0 0")
11
+ end
12
+
13
+ describe "current_bic" do
14
+ it "extracts the current_bic" do
15
+ expect(@line0.current_bic).to eq("GEBABEBB")
16
+ end
17
+ end
18
+
19
+ describe "current_account" do
20
+ it "extracts the current_account" do
21
+ expect(@line1.current_account).to eq({account_number:"035918134040", account_type:"bban_be_account"})
22
+ end
23
+ end
24
+
25
+ describe "old_balance" do
26
+ it "extracts the old_balance" do
27
+ expect(@line1.old_balance).to eq("57900,000")
28
+ end
29
+ end
30
+
31
+ describe "entry_date" do
32
+ it "extracts the entry_date" do
33
+ expect(@line21.entry_date).to eq("310315")
34
+ end
35
+ end
36
+
37
+ describe "reference_number" do
38
+ it "extracts the reference_number" do
39
+ expect(@line21.reference_number).to eq("0001500000103")
40
+ end
41
+ end
42
+
43
+ describe "amount" do
44
+ it "extracts the amount" do
45
+ expect(@line21.amount).to eq("500,000")
46
+ end
47
+ end
48
+
49
+ describe "bic" do
50
+ it "extracts the bic" do
51
+ expect(@line22.bic).to eq("GKCCBEBB")
52
+ end
53
+ end
54
+
55
+ describe "currency" do
56
+ it "extracts the currency" do
57
+ expect(@line23.currency).to eq("EUR")
58
+ end
59
+ end
60
+
61
+ describe "name" do
62
+ it "extracts the name" do
63
+ expect(@line23.name).to eq("COUREL PASCAL")
64
+ end
65
+ end
66
+
67
+ describe "account" do
68
+ it "extracts the account" do
69
+ expect(@line23.account).to eq("BE96553242750005")
70
+ end
71
+ end
72
+
73
+ describe "address" do
74
+ it "extracts the address" do
75
+ expect(@line32.address).to eq({:address=>"CHAUSSEE DE MALINES 10", :postcode=>"1970", :city=>"WEZEMBEEK-OPPEM", :country=>nil})
76
+ end
77
+ end
78
+
79
+ end
@@ -0,0 +1,69 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe CodaStandard::Parser do
4
+
5
+ before :each do
6
+ @file_name = 'spec/coda.cod'
7
+ @file = File.open( @file_name )
8
+ @parser = CodaStandard::Parser.new
9
+ end
10
+
11
+ describe "initialize" do
12
+ it "initializes some class variables" do
13
+ expect(@parser.transactions).to be_a(CodaStandard::TransactionList)
14
+ end
15
+ end
16
+
17
+ describe "parse" do
18
+ before :each do
19
+ @parser.parse(@file_name)
20
+ end
21
+ it "returns a Transactions object" do
22
+ expect(@parser.parse(@file_name)).to be_a(CodaStandard::TransactionList)
23
+ end
24
+ end
25
+
26
+ describe "set_address" do
27
+ before :each do
28
+ address = {:address=>"5 RUE DU CENTCINQUANTENAIRE", :postcode=>"6750", :city=>"MUSSY-LA-VILLE", :country=>" BELGIQUE"}
29
+ @parser.set_address(address)
30
+ end
31
+
32
+ it "sets the address field to the current transaction" do
33
+ expect(@parser.current_transaction.address).to eq("5 RUE DU CENTCINQUANTENAIRE")
34
+ end
35
+
36
+ it "sets the postcode field to the current transaction" do
37
+ expect(@parser.current_transaction.postcode).to eq("6750")
38
+ end
39
+
40
+ it "sets the city field to the current transaction" do
41
+ expect(@parser.current_transaction.city).to eq("MUSSY-LA-VILLE")
42
+ end
43
+
44
+ it "sets the country field to the current transaction" do
45
+ expect(@parser.current_transaction.country).to eq(" BELGIQUE")
46
+ end
47
+ end
48
+
49
+ describe "set_account" do
50
+ before :each do
51
+ account = {account_number:"035918134040", account_type:"bban_be_account"}
52
+ @parser.set_account(account)
53
+ end
54
+
55
+ it "sets the current_account field to the TransactionList" do
56
+ expect(@parser.transactions.current_account).to eq("035918134040")
57
+ end
58
+
59
+ it "sets the account_type field to the TransactionList" do
60
+ expect(@parser.transactions.current_account_type).to eq("bban_be_account")
61
+ end
62
+ end
63
+
64
+ describe "show" do
65
+ it "shows the info from the transactions" do
66
+ expect{@parser.show(@file_name)}.to output("**--Transactions--**\n\nAccount: 539007547034 Account type: bban_be_account BIC: GEBABEBB\nOld balance: 57900,000 \n\n-- Transaction n.1 in date 310315-- \n\n RN: 0001500000103 Account: BE53900754703405 BIC:GKCCBEBB\n Amount: 500,000 EUR\n Name: LASTNM PERSON\n Address: CHAUSSEE DE BIERE 10 1978 SOMECITY \n\n-- Transaction n.2 in date 310315-- \n\n RN: 0001500000104 Account: LU539007547034898400 BIC:BILLLULL\n Amount: 200,000 EUR\n Name: M.JOHN DOE\n Address: 5 STREET 3654 CITY BELGIQUE \n\n").to_stdout
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,4 @@
1
+ require 'bundler/setup'
2
+ Bundler.setup
3
+
4
+ require 'coda_standard'
@@ -0,0 +1,20 @@
1
+ require_relative 'spec_helper'
2
+
3
+ describe CodaStandard::TransactionList do
4
+ before :each do
5
+ @transaction_list = CodaStandard::TransactionList.new
6
+ end
7
+
8
+ describe "initialize some values" do
9
+ it "has an transactions array" do
10
+ expect(@transaction_list.transactions).to eq([])
11
+ end
12
+ end
13
+
14
+ describe "create" do
15
+ it "creates a new transaction and puts it into the array" do
16
+ @transaction_list.create
17
+ expect(@transaction_list.create).to eq @transaction_list.transactions.last
18
+ end
19
+ end
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coda_standard
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alvaro Leal
@@ -42,23 +42,40 @@ dependencies:
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3.1'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '3.1'
55
55
  description: This gem parses the Coded statement of account (CODA) bank standard
56
56
  email:
57
57
  - pursuance@gmail.com
58
58
  executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
- files: []
61
+ files:
62
+ - ".gitignore"
63
+ - Gemfile
64
+ - LICENSE
65
+ - README.md
66
+ - Rakefile
67
+ - coda_standard.gemspec
68
+ - lib/coda_standard.rb
69
+ - lib/coda_standard/line.rb
70
+ - lib/coda_standard/parser.rb
71
+ - lib/coda_standard/transaction.rb
72
+ - lib/coda_standard/transaction_list.rb
73
+ - lib/coda_standard/version.rb
74
+ - spec/coda.cod
75
+ - spec/line_spec.rb
76
+ - spec/parser_spec.rb
77
+ - spec/spec_helper.rb
78
+ - spec/transaction_list_spec.rb
62
79
  homepage: https://github.com/Bluesmile82/coda_standard
63
80
  licenses:
64
81
  - MIT
@@ -69,9 +86,9 @@ require_paths:
69
86
  - lib
70
87
  required_ruby_version: !ruby/object:Gem::Requirement
71
88
  requirements:
72
- - - ">="
89
+ - - "~>"
73
90
  - !ruby/object:Gem::Version
74
- version: '0'
91
+ version: '2.0'
75
92
  required_rubygems_version: !ruby/object:Gem::Requirement
76
93
  requirements:
77
94
  - - ">="
@@ -83,4 +100,9 @@ rubygems_version: 2.4.5
83
100
  signing_key:
84
101
  specification_version: 4
85
102
  summary: CODA bank standard file parser
86
- test_files: []
103
+ test_files:
104
+ - spec/coda.cod
105
+ - spec/line_spec.rb
106
+ - spec/parser_spec.rb
107
+ - spec/spec_helper.rb
108
+ - spec/transaction_list_spec.rb