Class: ZenginLite::Branch

Inherits:
Object
  • Object
show all
Defined in:
lib/zengin_lite/branch.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code:, bank_code:, name:, kana:, hira:, roma:) ⇒ Branch

Returns a new instance of Branch.



9
10
11
12
13
14
15
16
# File 'lib/zengin_lite/branch.rb', line 9

def initialize(code:, bank_code:, name:, kana:, hira:, roma:)
  @code = code
  @bank_code = bank_code
  @name = name
  @kana = kana
  @hira = hira
  @roma = roma
end

Instance Attribute Details

#bank_codeObject (readonly)

Returns the value of attribute bank_code.



3
4
5
# File 'lib/zengin_lite/branch.rb', line 3

def bank_code
  @bank_code
end

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/zengin_lite/branch.rb', line 3

def code
  @code
end

#hiraObject (readonly)

Returns the value of attribute hira.



3
4
5
# File 'lib/zengin_lite/branch.rb', line 3

def hira
  @hira
end

#kanaObject (readonly)

Returns the value of attribute kana.



3
4
5
# File 'lib/zengin_lite/branch.rb', line 3

def kana
  @kana
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/zengin_lite/branch.rb', line 3

def name
  @name
end

#romaObject (readonly)

Returns the value of attribute roma.



3
4
5
# File 'lib/zengin_lite/branch.rb', line 3

def roma
  @roma
end

Class Method Details

.from_row(row) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/zengin_lite/branch.rb', line 34

def self.from_row(row)
  return nil unless row
  
  new(
    code: row[0],
    bank_code: row[1],
    name: row[2],
    kana: row[3],
    hira: row[4],
    roma: row[5]
  )
end

Instance Method Details

#bankObject



5
6
7
# File 'lib/zengin_lite/branch.rb', line 5

def bank
  ZenginLite.bank(bank_code)
end

#inspectObject



29
30
31
# File 'lib/zengin_lite/branch.rb', line 29

def inspect
  "#<#{self.class.name} code=#{code.inspect}, bank_code=#{bank_code.inspect}, name=#{name.inspect}, kana=#{kana.inspect}>"
end

#to_hObject



18
19
20
21
22
23
24
25
26
27
# File 'lib/zengin_lite/branch.rb', line 18

def to_h
  {
    code: code,
    bank_code: bank_code,
    name: name,
    kana: kana,
    hira: hira,
    roma: roma
  }
end