Skip to content

Commit

Permalink
updated gems, added 'unless _changed?' trap
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanmartin committed Aug 3, 2012
1 parent 134f2d6 commit d2d8883
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 77 deletions.
8 changes: 4 additions & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ gem "rails", ">= 3.0.0"
gem 'kontoapi-ruby', ">= 0.2.0"

group :development do
gem "rspec", "~> 2.3.0"
gem "bundler", "~> 1.0.0"
gem "jeweler", "~> 1.5.2"
gem "rcov", ">= 0"
gem "rspec", ">= 2.3.0"
gem "bundler", ">= 1.1.0"
gem "jeweler", ">= 1.5.2"
gem "simplecov", ">= 0"
end
162 changes: 90 additions & 72 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,96 +1,114 @@
GEM
remote: http://rubygems.org/
specs:
abstract (1.0.0)
actionmailer (3.0.7)
actionpack (= 3.0.7)
mail (~> 2.2.15)
actionpack (3.0.7)
activemodel (= 3.0.7)
activesupport (= 3.0.7)
builder (~> 2.1.2)
erubis (~> 2.6.6)
i18n (~> 0.5.0)
rack (~> 1.2.1)
rack-mount (~> 0.6.14)
rack-test (~> 0.5.7)
tzinfo (~> 0.3.23)
activemodel (3.0.7)
activesupport (= 3.0.7)
builder (~> 2.1.2)
i18n (~> 0.5.0)
activerecord (3.0.7)
activemodel (= 3.0.7)
activesupport (= 3.0.7)
arel (~> 2.0.2)
tzinfo (~> 0.3.23)
activeresource (3.0.7)
activemodel (= 3.0.7)
activesupport (= 3.0.7)
activesupport (3.0.7)
addressable (2.2.7)
arel (2.0.9)
builder (2.1.2)
diff-lcs (1.1.2)
erubis (2.6.6)
abstract (>= 1.0.0)
actionmailer (3.2.7)
actionpack (= 3.2.7)
mail (~> 2.4.4)
actionpack (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
builder (~> 3.0.0)
erubis (~> 2.7.0)
journey (~> 1.0.4)
rack (~> 1.4.0)
rack-cache (~> 1.2)
rack-test (~> 0.6.1)
sprockets (~> 2.1.3)
activemodel (3.2.7)
activesupport (= 3.2.7)
builder (~> 3.0.0)
activerecord (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
arel (~> 3.0.2)
tzinfo (~> 0.3.29)
activeresource (3.2.7)
activemodel (= 3.2.7)
activesupport (= 3.2.7)
activesupport (3.2.7)
i18n (~> 0.6)
multi_json (~> 1.0)
addressable (2.3.2)
arel (3.0.2)
builder (3.0.0)
diff-lcs (1.1.3)
erubis (2.7.0)
git (1.2.5)
i18n (0.5.0)
jeweler (1.5.2)
bundler (~> 1.0.0)
hike (1.2.1)
i18n (0.6.0)
jeweler (1.8.4)
bundler (~> 1.0)
git (>= 1.2.5)
rake
rdoc
journey (1.0.4)
json (1.7.4)
kontoapi-ruby (0.2.0)
addressable
yajl-ruby
mail (2.2.17)
activesupport (>= 2.3.6)
mail (2.4.4)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
polyglot (0.3.1)
rack (1.2.2)
rack-mount (0.6.14)
rack (>= 1.0.0)
rack-test (0.5.7)
mime-types (1.19)
multi_json (1.3.6)
polyglot (0.3.3)
rack (1.4.1)
rack-cache (1.2)
rack (>= 0.4)
rack-ssl (1.3.2)
rack
rack-test (0.6.1)
rack (>= 1.0)
rails (3.0.7)
actionmailer (= 3.0.7)
actionpack (= 3.0.7)
activerecord (= 3.0.7)
activeresource (= 3.0.7)
activesupport (= 3.0.7)
rails (3.2.7)
actionmailer (= 3.2.7)
actionpack (= 3.2.7)
activerecord (= 3.2.7)
activeresource (= 3.2.7)
activesupport (= 3.2.7)
bundler (~> 1.0)
railties (= 3.0.7)
railties (3.0.7)
actionpack (= 3.0.7)
activesupport (= 3.0.7)
railties (= 3.2.7)
railties (3.2.7)
actionpack (= 3.2.7)
activesupport (= 3.2.7)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
thor (~> 0.14.4)
rake (0.8.7)
rcov (0.9.9)
rspec (2.3.0)
rspec-core (~> 2.3.0)
rspec-expectations (~> 2.3.0)
rspec-mocks (~> 2.3.0)
rspec-core (2.3.1)
rspec-expectations (2.3.0)
diff-lcs (~> 1.1.2)
rspec-mocks (2.3.0)
thor (0.14.6)
treetop (1.4.9)
rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0)
rake (0.9.2.2)
rdoc (3.12)
json (~> 1.4)
rspec (2.11.0)
rspec-core (~> 2.11.0)
rspec-expectations (~> 2.11.0)
rspec-mocks (~> 2.11.0)
rspec-core (2.11.1)
rspec-expectations (2.11.2)
diff-lcs (~> 1.1.3)
rspec-mocks (2.11.1)
simplecov (0.6.4)
multi_json (~> 1.0)
simplecov-html (~> 0.5.3)
simplecov-html (0.5.3)
sprockets (2.1.3)
hike (~> 1.2)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
thor (0.15.4)
tilt (1.3.3)
treetop (1.4.10)
polyglot
polyglot (>= 0.3.1)
tzinfo (0.3.26)
tzinfo (0.3.33)
yajl-ruby (1.1.0)

PLATFORMS
ruby

DEPENDENCIES
bundler (~> 1.0.0)
jeweler (~> 1.5.2)
bundler (>= 1.1.0)
jeweler (>= 1.5.2)
kontoapi-ruby (>= 0.2.0)
rails (>= 3.0.0)
rcov
rspec (~> 2.3.0)
rspec (>= 2.3.0)
simplecov
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.2
0.2.3
2 changes: 2 additions & 0 deletions lib/kontoapi-rails/orm/active_record_extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def validates_iban(field, options={})
options.reverse_merge!( :allow_nil => true, :on_timeout => :ignore )
define_method :iban_validation do
value = send(field)
return true unless send(:"#{field}_changed?")
return true if options[:allow_nil] && value.nil?
begin
errors.add(field, :invalid) unless KontoAPI::valid?( :iban => value )
Expand All @@ -70,6 +71,7 @@ def validates_bic(field, options={})
options.reverse_merge!( :allow_nil => true, :on_timeout => :ignore )
define_method :bic_validation do
value = send(field)
return true unless send(:"#{field}_changed?")
return true if options[:allow_nil] && value.nil?
begin
errors.add(field, :invalid) unless KontoAPI::valid?( :bic => send(field) )
Expand Down
1 change: 1 addition & 0 deletions lib/kontoapi-rails/validators/bank_account_validator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class BankAccountValidator < ActiveModel::Validator
def validate(record)
account_number = record.send(:"#{options[:account_number_field]}")
bank_code = record.send(:"#{options[:bank_code_field]}")
return true unless send(:"#{options[:account_number_field]}_changed?") || send(:"#{options[:bank_code_field]}_changed?")
return true if options[:allow_nil] && (account_number.nil? || bank_code.nil?)
record.errors.add(:"#{options[:account_number_field]}", :invalid) unless KontoAPI::valid?( :ktn => account_number, :blz => bank_code )
rescue Timeout::Error => ex
Expand Down

0 comments on commit d2d8883

Please sign in to comment.