total_in 0.5.0 → 0.5.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
  SHA1:
3
- metadata.gz: 58ddedbe4d914ccb31dafda36de258488e2ad768
4
- data.tar.gz: 1d9deb3b756e9c5f974c231d6992688c8b1f321d
3
+ metadata.gz: 9daf2078aea2bffac2851c381b979d49c65cce6f
4
+ data.tar.gz: 918f03d6bd88d8c99c3f2f6ef54232aa60922ae0
5
5
  SHA512:
6
- metadata.gz: a4ed13121596580de19c2dc78abbd7ac60e4543986bb8132fdf0891a30335ed20600a7204b5c2f76dbeae0486a8970aff8c42a6e30853905879bccfadc4ec7b9
7
- data.tar.gz: 57ac3813d93ac77374a1de9e7b48d2ec4a94b1e98a28cf37b417fcb87e8f98b7e34e84e8b43184e36120a34345a65949477b8cdc2d6ef5d6f0017208a8bb5a48
6
+ metadata.gz: ffa4a64cd178435c8eae2d7de63ee20bcf58074190f92cb6fa75d3dd4d399c20d9e0354b5edb88b7937903392cda373bcf5fbfdb13ded8491fb9d781df3be3e8
7
+ data.tar.gz: 4a84dd6f73a09230540a0e77be52a7ac402071b0d92052991ea763cefae3ccd6c7f1374e45dafd91850246965178d5881be775993a108b4b818425ad04a65220
@@ -15,6 +15,14 @@ module TotalIn
15
15
  @accounts ||= []
16
16
  end
17
17
 
18
+ def payments
19
+ accounts.map { |a| a.payments }.flatten
20
+ end
21
+
22
+ def deductions
23
+ accounts.map { |a| a.deductions }.flatten
24
+ end
25
+
18
26
  class Account
19
27
  include AttributeMethods
20
28
  attribute :account_number
@@ -1,3 +1,3 @@
1
1
  module TotalIn
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -0,0 +1,40 @@
1
+ module TotalIn
2
+ RSpec.describe Document do
3
+ describe "#payments" do
4
+ it "returns payments from all accounts" do
5
+ document = Document.new
6
+ account_one = Document::Account.new
7
+ payment_one = Document::Payment.new
8
+ account_one.payments << payment_one
9
+
10
+ account_two = Document::Account.new
11
+ payment_two = Document::Payment.new
12
+ account_two.payments << payment_two
13
+
14
+ document.accounts << account_one
15
+ document.accounts << account_two
16
+
17
+ expect(document.payments).to eq [payment_one, payment_two]
18
+ end
19
+ end
20
+
21
+ describe "#deductions" do
22
+ it "returns deductions from all accounts" do
23
+ document = Document.new
24
+ account_one = Document::Account.new
25
+ deduction_one = Document::Deduction.new
26
+ account_one.deductions << deduction_one
27
+
28
+ account_two = Document::Account.new
29
+ deduction_two = Document::Deduction.new
30
+ account_two.deductions << deduction_two
31
+
32
+ document.accounts << account_one
33
+ document.accounts << account_two
34
+
35
+ expect(document.deductions).to eq [deduction_one, deduction_two]
36
+
37
+ end
38
+ end
39
+ end
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: total_in
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Junström
@@ -83,6 +83,7 @@ files:
83
83
  - spec/full_file_parse_spec.rb
84
84
  - spec/spec_helper.rb
85
85
  - spec/support/shared_examples_for_values_line_parsers.rb
86
+ - spec/total_in/document_spec.rb
86
87
  - spec/total_in/line_parsers/account_end_spec.rb
87
88
  - spec/total_in/line_parsers/account_start_spec.rb
88
89
  - spec/total_in/line_parsers/addresses_spec.rb
@@ -140,6 +141,7 @@ test_files:
140
141
  - spec/full_file_parse_spec.rb
141
142
  - spec/spec_helper.rb
142
143
  - spec/support/shared_examples_for_values_line_parsers.rb
144
+ - spec/total_in/document_spec.rb
143
145
  - spec/total_in/line_parsers/account_end_spec.rb
144
146
  - spec/total_in/line_parsers/account_start_spec.rb
145
147
  - spec/total_in/line_parsers/addresses_spec.rb