Class: FineAnts::Adapters::Etrade
- Inherits:
-
Object
- Object
- FineAnts::Adapters::Etrade
- Defined in:
- lib/fine_ants/adapters/etrade.rb
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(credentials) ⇒ Etrade
constructor
A new instance of Etrade.
- #login ⇒ Object
Constructor Details
#initialize(credentials) ⇒ Etrade
Returns a new instance of Etrade.
6 7 8 9 |
# File 'lib/fine_ants/adapters/etrade.rb', line 6 def initialize(credentials) @user = credentials[:user] @password = credentials[:password] end |
Instance Method Details
#download ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/fine_ants/adapters/etrade.rb', line 20 def download all("section.account").map { |account| { adapter: :etrade, user: @user, id: account.find("#acctNum .number-reveal", visible: false).text(:all), name: account.find("a.account-id").text, amount: BigDecimal(account.find(".table-horizontal .text-right.secondary").text.gsub(/[\$,]/, "")) } }.tap do click_link "Log Off" end end |
#login ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/fine_ants/adapters/etrade.rb', line 11 def login visit "https://us.etrade.com/e/t/user/login" fill_in "USER", with: @user sleep 0.3 fill_in "PASSWORD", with: @password "Log on" verify_login! end |