Class: MFYNAB::MoneyForward::AccountStatus::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/mfynab/money_forward/account_status.rb

Instance Method Summary collapse

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|
     = parse_html_table_row(node)
    next unless .include?(.name)

    status_data = determine_status_data()
    .assign_status_data(**status_data)

    
  end
end