Class: TurkishBanks::Bank
- Inherits:
-
Object
- Object
- TurkishBanks::Bank
- Defined in:
- lib/turkish_banks/bank.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#city ⇒ Object
readonly
Returns the value of attribute city.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #branches ⇒ Object
-
#initialize(bank_name) ⇒ Bank
constructor
A new instance of Bank.
Constructor Details
#initialize(bank_name) ⇒ Bank
Returns a new instance of Bank.
5 6 7 8 9 10 11 |
# File 'lib/turkish_banks/bank.rb', line 5 def initialize(bank_name) bank_params = TurkishBanks.get_bank_params(bank_name) @name = bank_params['bAd'] @code = bank_params['bKd'] @city = bank_params['bIlAd'] @address = bank_params['adr'] end |
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
3 4 5 |
# File 'lib/turkish_banks/bank.rb', line 3 def address @address end |
#city ⇒ Object (readonly)
Returns the value of attribute city.
3 4 5 |
# File 'lib/turkish_banks/bank.rb', line 3 def city @city end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
3 4 5 |
# File 'lib/turkish_banks/bank.rb', line 3 def code @code end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/turkish_banks/bank.rb', line 3 def name @name end |
Instance Method Details
#branches ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/turkish_banks/bank.rb', line 13 def branches nodes = TurkishBanks::DOC.xpath("//sube[bKd= '#{@code}']") nodes.map do |node| branch_params = Hash.from_xml(node.to_s)['sube'] TurkishBanks::Branch.new(branch_params) end end |