multicash 0.0.5 → 0.0.6

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: 43c6ef97f40cc606f40359fe407c4103a32805d8
4
- data.tar.gz: a65c33778894354ee335b19790313ff3b93ec7ec
3
+ metadata.gz: 2934f0c6a9738ee90df45b12650f01b604866094
4
+ data.tar.gz: 82a90df7b4e71881f117ae054c2cb831050787ef
5
5
  SHA512:
6
- metadata.gz: 35004cfdf2e723e34e0d6332cb33e1356bf7e66b63dde091cac61a4b2130bdbddfd23de4246eecd2cce2524b1476c203e6eed21ac96167a84db20031d12f4a1d
7
- data.tar.gz: 1adb1a6139458149c7e884c61f4dc51d0c24fb69ca41e808b6833acec29b8c45ad491c94c407a1550ed63c011ba0661a95d70937b647a7c2540c463bc1735a9d
6
+ metadata.gz: 98abc1dfdfa5442883016e225a8b92f61459cf6e7a0aa8ef71dbed3d899a63360ab5995b6595ca82b67b911e4e934e4c24724f69fe90ee08d615d17afff6b29b
7
+ data.tar.gz: 1fb2d961e5ad960d20291e4071b3f7525772c542df2a18c6b649eabf09b25480f49896191f7d158f7932d27c9898f29f6cc7f3fa3833f6bffc2ceb8304840cb7
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.5
1
+ 0.0.6
@@ -6,6 +6,8 @@ module Multicash
6
6
  attr_accessor :reference, :transfers_number, :errors
7
7
  attr_reader :transfers, :total_ammount, :currency, :ordering_bae, :date
8
8
 
9
+ validate :valid_transfers
10
+
9
11
  def initialize
10
12
  @currency = nil
11
13
  @date = Time.now.strftime('%y%m%d')
@@ -16,15 +18,11 @@ module Multicash
16
18
  end
17
19
 
18
20
  def << (transfer)
19
- if transfer.valid?
20
- @transfers << transfer
21
- transfer.reference_counter = @transfers.size
22
- @total_ammount += (transfer.ammount.to_f)
23
- @currency ||= transfer.currency
24
- @ordering_bae ||= transfer.ordering_bae
25
- else
26
- errors.add("transfer - #{@transfers.size}", transfer.errors.full_messages)
27
- end
21
+ @transfers << transfer
22
+ transfer.reference_counter = @transfers.size
23
+ @total_ammount += (transfer.ammount.to_f)
24
+ @currency ||= transfer.currency
25
+ @ordering_bae ||= transfer.ordering_bae
28
26
  end
29
27
 
30
28
  def header
@@ -76,5 +74,13 @@ module Multicash
76
74
 
77
75
  bank_file
78
76
  end
77
+
78
+ private
79
+
80
+ def valid_transfers
81
+ transfers.each_with_index do |transfer, index|
82
+ self.errors.add("transfer_#{index}", transfer.errors.full_messages) unless transfer.valid?
83
+ end
84
+ end
79
85
  end
80
86
  end
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: multicash 0.0.5 ruby lib
5
+ # stub: multicash 0.0.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "multicash"
9
- s.version = "0.0.5"
9
+ s.version = "0.0.6"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Anton Yordanov"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: multicash
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anton Yordanov