Class: FineAnts::Adapters::SimpleBancorp

Inherits:
Object
  • Object
show all
Defined in:
lib/fine_ants/adapters/simple_bancorp.rb

Instance Method Summary collapse

Constructor Details

#initialize(credentials) ⇒ SimpleBancorp

Returns a new instance of SimpleBancorp.



6
7
8
9
# File 'lib/fine_ants/adapters/simple_bancorp.rb', line 6

def initialize(credentials)
  @user = credentials[:user]
  @password = credentials[:password]
end

Instance Method Details

#downloadObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/fine_ants/adapters/simple_bancorp.rb', line 21

def download
  balance = find(".sts-available").find("b").text
  available_balance = find("#sts-flag").text.strip
  user_name = find(".masthead-username").text

  [
    {
      adapter: :simple_bancorp,
      user: @user,
      id: user_name.to_s,
      name: user_name.to_s,
      amount: parse_currency(balance),
      available_amount: parse_currency(available_balance)
    }
  ].tap { logout! }
end

#loginObject



11
12
13
14
15
16
17
18
19
# File 'lib/fine_ants/adapters/simple_bancorp.rb', line 11

def 
  visit "https://www.simple.com"
  click_link "Log In"

  fill_in "username", with: @user
  fill_in "passphrase", with: @password
  click_button "Sign in"
  verify_login!
end