Class: KingDta::Account
- Inherits:
-
Object
- Object
- KingDta::Account
- Includes:
- Helper
- Defined in:
- lib/king_dta/account.rb
Overview
Bank account and owner information
Instance Attribute Summary collapse
-
#bank_account_number ⇒ Object
Returns the value of attribute bank_account_number.
-
#bank_bic ⇒ Object
Returns the value of attribute bank_bic.
-
#bank_city ⇒ Object
Returns the value of attribute bank_city.
-
#bank_country_code ⇒ Object
Returns the value of attribute bank_country_code.
-
#bank_iban ⇒ Object
Returns the value of attribute bank_iban.
-
#bank_name ⇒ Object
Returns the value of attribute bank_name.
-
#bank_number ⇒ Object
Returns the value of attribute bank_number.
-
#bank_street ⇒ Object
Returns the value of attribute bank_street.
-
#bank_zip ⇒ Object
Returns the value of attribute bank_zip.
-
#owner_city ⇒ Object
Returns the value of attribute owner_city.
-
#owner_country_code ⇒ Object
Returns the value of attribute owner_country_code.
-
#owner_name ⇒ Object
Returns the value of attribute owner_name.
-
#owner_number ⇒ Object
Returns the value of attribute owner_number.
-
#owner_street ⇒ Object
Returns the value of attribute owner_street.
-
#owner_zip_code ⇒ Object
Returns the value of attribute owner_zip_code.
Instance Method Summary collapse
- #bank_zip_city ⇒ Object
-
#initialize(args = {}) ⇒ Account
constructor
A new instance of Account.
- #owner_zip_city ⇒ Object
Methods included from Helper
Constructor Details
#initialize(args = {}) ⇒ Account
Returns a new instance of Account.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/king_dta/account.rb', line 14 def initialize(args={}) args = args.dup @bank_street = convert_text(args.delete(:bank_street)) @bank_city = convert_text(args.delete(:bank_city)) @bank_name = convert_text(args.delete(:bank_name)) @owner_name = convert_text(args.delete(:owner_name)) @owner_street = convert_text(args.delete(:owner_street)) @owner_city = convert_text(args.delete(:owner_city)) args.each do |key,value| self.send("#{key}=",value) end raise ArgumentError.new('Owner number too long, max 10 allowed') if @owner_number && "#{@owner_number}".length > 10 raise ArgumentError.new('Owner street too long, max 35 allowed') if @owner_street && @owner_street.length > 35 raise ArgumentError.new('Owner city too long, max 35 allowed') if @owner_city && @owner_city.length > 35 raise ArgumentError.new('Owner country code too long, max 2 allowed') if @owner_country_code && @owner_country_code.length > 2 raise ArgumentError.new("Bank iban wrong length: #{@bank_iban.length}, must be between 15-34") if @bank_iban && !@bank_iban.length.between?(15,34) raise ArgumentError.new("Bank bic wrong length: #{@bank_bic.length} must be between 8-11") if @bank_bic && !@bank_bic.length.between?(8,11) raise ArgumentError.new('Bank street too long, max 35 allowed') if @bank_street && @bank_street.length > 35 raise ArgumentError.new('Bank city too long, max 35 allowed') if @bank_city && @bank_city.length > 35 raise ArgumentError.new('Bank name too long, max 35 allowed') if @bank_name && @bank_name.length > 35 raise ArgumentError.new('Bank country code too long, max 2 allowed') if @bank_country_code && @bank_country_code.length > 2 @owner_country_code = @bank_iban[0..1 ] if @bank_iban && !@owner_country_code end |
Instance Attribute Details
#bank_account_number ⇒ Object
Returns the value of attribute bank_account_number.
12 13 14 |
# File 'lib/king_dta/account.rb', line 12 def bank_account_number @bank_account_number end |
#bank_bic ⇒ Object
Returns the value of attribute bank_bic.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def bank_bic @bank_bic end |
#bank_city ⇒ Object
Returns the value of attribute bank_city.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def bank_city @bank_city end |
#bank_country_code ⇒ Object
Returns the value of attribute bank_country_code.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def bank_country_code @bank_country_code end |
#bank_iban ⇒ Object
Returns the value of attribute bank_iban.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def bank_iban @bank_iban end |
#bank_name ⇒ Object
Returns the value of attribute bank_name.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def bank_name @bank_name end |
#bank_number ⇒ Object
Returns the value of attribute bank_number.
12 13 14 |
# File 'lib/king_dta/account.rb', line 12 def bank_number @bank_number end |
#bank_street ⇒ Object
Returns the value of attribute bank_street.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def bank_street @bank_street end |
#bank_zip ⇒ Object
Returns the value of attribute bank_zip.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def bank_zip @bank_zip end |
#owner_city ⇒ Object
Returns the value of attribute owner_city.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def owner_city @owner_city end |
#owner_country_code ⇒ Object
Returns the value of attribute owner_country_code.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def owner_country_code @owner_country_code end |
#owner_name ⇒ Object
Returns the value of attribute owner_name.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def owner_name @owner_name end |
#owner_number ⇒ Object
Returns the value of attribute owner_number.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def owner_number @owner_number end |
#owner_street ⇒ Object
Returns the value of attribute owner_street.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def owner_street @owner_street end |
#owner_zip_code ⇒ Object
Returns the value of attribute owner_zip_code.
7 8 9 |
# File 'lib/king_dta/account.rb', line 7 def owner_zip_code @owner_zip_code end |
Instance Method Details
#bank_zip_city ⇒ Object
69 70 71 |
# File 'lib/king_dta/account.rb', line 69 def bank_zip_city "#{@bank_zip} #{@bank_city}" end |
#owner_zip_city ⇒ Object
73 74 75 |
# File 'lib/king_dta/account.rb', line 73 def owner_zip_city "#{@owner_zip_code} #{@owner_city}" end |