Module: AutoExpreso::DataUtils

Included in:
Client
Defined in:
lib/autoexpreso/data_utils.rb

Class Method Summary collapse

Class Method Details

.attributesObject



23
24
25
26
27
# File 'lib/autoexpreso/data_utils.rb', line 23

def attributes
  %w(name_id balance_id status_id last_payment_id last_payment_date_id).map do |field_name|
    "account_#{field_name}".to_sym
  end
end

.form_dataObject



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/autoexpreso/data_utils.rb', line 8

def form_data
  OpenStruct.new({
    login_form_id:                'aspnetForm',
    login_form_username_name:     'ctl00$ContentPlaceHolder1$Login1$uxUserNameField',
    login_form_password_name:     'ctl00$ContentPlaceHolder1$Login1$uxPasswordField',

    account_name_id:              '#ctl00_Content_uxLogonAccountName',
    account_balance_id:           '#ctl00_Content_uxLogonBalanceAmount',
    account_status_id:            '#ctl00_Content_uxLogonAccountStatus',
    account_last_payment_id:      '#ctl00_Content_uxLogonAmountLastPayment',
    account_last_payment_date_id: '#ctl00_Content_uxLogonDateLastPayment',
    account_transaction_table_id: '#ctl00_Content_uxLast20TransactionsGrid'
 })
end

.included(base) ⇒ Object



3
4
5
# File 'lib/autoexpreso/data_utils.rb', line 3

def self.included(base)
  base.extend self
end

.save_transactions(tds, transactions) ⇒ Object



29
30
31
32
33
34
35
36
# File 'lib/autoexpreso/data_utils.rb', line 29

def save_transactions(tds, transactions)
  transactions << {
    date:       tds[0].text.strip,
    location:   tds[1].text.strip,
    amount:     tds[2].text.strip,
    tag_number: tds[3].text.strip
  }
end