-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* added debtor feature * fix readme for SEPA::DebtorAddress * add more test coverage
- Loading branch information
Showing
9 changed files
with
131 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# encoding: utf-8 | ||
module SEPA | ||
class DebtorAddress | ||
include ActiveModel::Validations | ||
extend Converter | ||
|
||
attr_accessor :country_code, :address_line1, :address_line2 | ||
|
||
convert :country_code, to: :text | ||
convert :address_line1, to: :text | ||
convert :address_line2, to: :text | ||
|
||
validates_length_of :country_code, is: 2 | ||
validates_length_of :address_line1, maximum: 70 | ||
validates_length_of :address_line2, maximum: 70 | ||
|
||
def initialize(attributes = {}) | ||
attributes.each do |name, value| | ||
public_send("#{name}=", value) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# encoding: utf-8 | ||
require 'spec_helper' | ||
|
||
describe SEPA::DebtorAddress do | ||
it 'should initialize a new address' do | ||
expect( | ||
SEPA::DebtorAddress.new country_code: 'CH', | ||
address_line1: 'Mustergasse 123', | ||
address_line2: '12345 Musterstadt' | ||
).to be_valid | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters