Class: TCMB_exchanger
- Inherits:
-
Object
- Object
- TCMB_exchanger
- Defined in:
- lib/tcmb_exchanger.rb
Overview
get, parse and show exchanges from tcmb
Constant Summary collapse
- LINK =
'https://www.tcmb.gov.tr/kurlar/today.xml'.freeze
- Hierarcy =
['Tarih_Date', 'Currency'].freeze
- VAR_NAMES =
{ 'Isim' => 'isim', 'CurrencyName' => 'name', 'ForexBuying' => 'for_buy', 'ForexSelling' => 'for_sel', 'BanknoteBuying' => 'bank_buy', 'BanknoteSelling' => 'bank_sell', 'CrossRateUSD' => 'cross_usd', 'CrossRateOther' => 'cross_other', 'CrossOrder' => 'order', 'Kod' => 'kod', 'CurrencyCode' => 'code' }.freeze
Instance Attribute Summary collapse
-
#exchanges ⇒ Object
readonly
Returns the value of attribute exchanges.
Instance Method Summary collapse
-
#initialize(function_names: VAR_NAMES, write_cache: false, cache_folder: nil) ⇒ TCMB_exchanger
constructor
A new instance of TCMB_exchanger.
- #process ⇒ Object
Constructor Details
#initialize(function_names: VAR_NAMES, write_cache: false, cache_folder: nil) ⇒ TCMB_exchanger
Returns a new instance of TCMB_exchanger.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/tcmb_exchanger.rb', line 27 def initialize( function_names: VAR_NAMES, write_cache: false, cache_folder: nil ) @var_names = function_names @write_cache = write_cache @cache_folder = cache_folder @cache_file = set_cache_file_name @exchanges = {} end |
Instance Attribute Details
#exchanges ⇒ Object (readonly)
Returns the value of attribute exchanges.
8 9 10 |
# File 'lib/tcmb_exchanger.rb', line 8 def exchanges @exchanges end |
Instance Method Details
#process ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/tcmb_exchanger.rb', line 40 def process # get exchanges or read the cache file get_body cache rename_param xml2obj end |