Class: MFYNAB::MoneyForward::AccountStatus::Fetcher
- Inherits:
-
Object
- Object
- MFYNAB::MoneyForward::AccountStatus::Fetcher
- Defined in:
- lib/mfynab/money_forward/account_status.rb
Instance Method Summary collapse
- #fetch(account_names:) ⇒ Object
-
#initialize(session, logger:) ⇒ Fetcher
constructor
A new instance of Fetcher.
Constructor Details
#initialize(session, logger:) ⇒ Fetcher
Returns a new instance of Fetcher.
12 13 14 15 |
# File 'lib/mfynab/money_forward/account_status.rb', line 12 def initialize(session, logger:) @logger = logger @session = session end |
Instance Method Details
#fetch(account_names:) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/mfynab/money_forward/account_status.rb', line 17 def fetch(account_names:) logger.info("Checking Money Forward accounts status") html = session.http_get("/accounts") table_rows_selector = "section.accounts section.common-account-table-container > table > tr[id]" Nokogiri::HTML(html).css(table_rows_selector).filter_map do |node| account = parse_html_table_row(node) next unless account_names.include?(account.name) status_data = determine_status_data(account) account.assign_status_data(**status_data) account end end |