total_in 0.5.0 → 0.5.1
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 +4 -4
- data/lib/total_in/document.rb +8 -0
- data/lib/total_in/version.rb +1 -1
- data/spec/total_in/document_spec.rb +40 -0
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9daf2078aea2bffac2851c381b979d49c65cce6f
|
4
|
+
data.tar.gz: 918f03d6bd88d8c99c3f2f6ef54232aa60922ae0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffa4a64cd178435c8eae2d7de63ee20bcf58074190f92cb6fa75d3dd4d399c20d9e0354b5edb88b7937903392cda373bcf5fbfdb13ded8491fb9d781df3be3e8
|
7
|
+
data.tar.gz: 4a84dd6f73a09230540a0e77be52a7ac402071b0d92052991ea763cefae3ccd6c7f1374e45dafd91850246965178d5881be775993a108b4b818425ad04a65220
|
data/lib/total_in/document.rb
CHANGED
@@ -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
|
data/lib/total_in/version.rb
CHANGED
@@ -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.
|
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
|