Class: JapanNetBank::Transfer::Row
- Inherits:
-
Object
- Object
- JapanNetBank::Transfer::Row
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/japan_net_bank/transfer/row.rb
Constant Summary collapse
- RECORD_TYPE_DATA =
'1'
- RECORD_TYPE_TRAILER =
'2'
- ACCOUNT_TYPES =
{ '1' => 'ordinary', '2' => 'checking', '4' => 'savings' }
Instance Attribute Summary collapse
-
#account_type ⇒ Object
Returns the value of attribute account_type.
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#bank_code ⇒ Object
Returns the value of attribute bank_code.
-
#branch_code ⇒ Object
Returns the value of attribute branch_code.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Object
Returns the value of attribute number.
-
#record_type ⇒ Object
Returns the value of attribute record_type.
Instance Method Summary collapse
- #==(other_row) ⇒ Object
-
#initialize(record_type: RECORD_TYPE_DATA, bank_code: nil, branch_code: nil, account_type: nil, number: nil, name: nil, amount: nil) ⇒ Row
constructor
A new instance of Row.
- #to_a ⇒ Object
Constructor Details
#initialize(record_type: RECORD_TYPE_DATA, bank_code: nil, branch_code: nil, account_type: nil, number: nil, name: nil, amount: nil) ⇒ Row
Returns a new instance of Row.
22 23 24 25 26 27 28 29 30 31 32 |
# 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. unless valid? end |
Instance Attribute Details
#account_type ⇒ Object
Returns the value of attribute account_type.
9 10 11 |
# File 'lib/japan_net_bank/transfer/row.rb', line 9 def account_type @account_type end |
#amount ⇒ Object
Returns the value of attribute amount.
9 10 11 |
# File 'lib/japan_net_bank/transfer/row.rb', line 9 def amount @amount end |
#bank_code ⇒ Object
Returns the value of attribute bank_code.
9 10 11 |
# File 'lib/japan_net_bank/transfer/row.rb', line 9 def bank_code @bank_code end |
#branch_code ⇒ Object
Returns the value of attribute branch_code.
9 10 11 |
# File 'lib/japan_net_bank/transfer/row.rb', line 9 def branch_code @branch_code end |
#name ⇒ Object
Returns the value of attribute name.
9 10 11 |
# File 'lib/japan_net_bank/transfer/row.rb', line 9 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
9 10 11 |
# File 'lib/japan_net_bank/transfer/row.rb', line 9 def number @number end |
#record_type ⇒ Object
Returns the value of attribute record_type.
9 10 11 |
# File 'lib/japan_net_bank/transfer/row.rb', line 9 def record_type @record_type end |
Instance Method Details
#==(other_row) ⇒ Object
46 47 48 49 50 |
# File 'lib/japan_net_bank/transfer/row.rb', line 46 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 ⇒ Object
34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/japan_net_bank/transfer/row.rb', line 34 def to_a [ @record_type, @bank_code, @branch_code, account_type_code, @number, convert_to_hankaku_katakana(@name).encode('Shift_JIS'), @amount.to_s, ] end |