class JapanNetBank::Transfer::Row
Constants
- ACCOUNT_TYPES
- RECORD_TYPE_DATA
- RECORD_TYPE_TRAILER
Attributes
account_type[RW]
amount[RW]
bank_code[RW]
branch_code[RW]
name[RW]
number[RW]
record_type[RW]
Public Class Methods
new(record_type: RECORD_TYPE_DATA, bank_code: nil, branch_code: nil, account_type: nil, number: nil, name: nil, amount: nil)
click to toggle source
# File lib/japan_net_bank/transfer/row.rb, line 22 def initialize(record_type: RECORD_TYPE_DATA, bank_code: nil, branch_code: nil, account_type: nil, number: nil, name: nil, amount: nil) @record_type = record_type @bank_code = bank_code @branch_code = branch_code @account_type = account_type @number = number @name = name @amount = amount.to_i raise ArgumentError, errors.full_messages unless valid? end
Public Instance Methods
==(other_row)
click to toggle source
# File lib/japan_net_bank/transfer/row.rb, line 48 def ==(other_row) [:bank_code, :branch_code, :name, :account_type, :number, :amount].all? do |method| send(method) == other_row.send(method) end end
to_a(name_length_limit: 48)
click to toggle source
# File lib/japan_net_bank/transfer/row.rb, line 34 def to_a(name_length_limit: 48) name = convert_to_hankaku_katakana(@name).slice(0, name_length_limit) [ @record_type, @bank_code, @branch_code, account_type_code, @number, name.encode('Shift_JIS'), @amount.to_s, ] end
Private Instance Methods
account_type_code()
click to toggle source
# File lib/japan_net_bank/transfer/row.rb, line 60 def account_type_code case @account_type when 'ordinary' '1' when 'checking' '2' when 'savings' '4' end end
convert_to_hankaku_katakana(string)
click to toggle source
# File lib/japan_net_bank/transfer/row.rb, line 56 def convert_to_hankaku_katakana(string) NKF.nkf('-w -Z4', string) end