Class: FineAnts::Adapters::Betterment
- Inherits:
-
Object
- Object
- FineAnts::Adapters::Betterment
- Defined in:
- lib/fine_ants/adapters/betterment.rb
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(credentials) ⇒ Betterment
constructor
A new instance of Betterment.
- #login ⇒ Object
- #two_factor_response(answer) ⇒ Object
Constructor Details
#initialize(credentials) ⇒ Betterment
Returns a new instance of Betterment.
6 7 8 9 |
# File 'lib/fine_ants/adapters/betterment.rb', line 6 def initialize(credentials) @user = credentials[:user] @password = credentials[:password] end |
Instance Method Details
#download ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fine_ants/adapters/betterment.rb', line 32 def download all(".ft-goalAccordionLabel").each do |accordion| accordion.click sleep 0.3 end accounts = all ".ft-goalExpandedFooter .sc-ContentLayout:nth-child(1) .ft-accounts .ft-subAccountExpandedRow" accounts.map { |account| { adapter: :betterment, user: @user, id: id_for(account), name: name_for(account), amount: total_for(account) } }.tap do .click end end |
#login ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fine_ants/adapters/betterment.rb', line 11 def login visit "https://wwws.betterment.com/app/login" fill_in "web_authentication[email]", with: @user fill_in "web_authentication[password]", with: @password "Log in" begin find_field "web_second_factor_authentication[verification_code]" false rescue Capybara::ElementNotFound verify_login! true end end |
#two_factor_response(answer) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/fine_ants/adapters/betterment.rb', line 25 def two_factor_response(answer) fill_in "web_second_factor_authentication[verification_code]", with: answer find(".web_second_factor_authentication_trust_device").click "Verify" verify_login! end |