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
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 betterment_accounts = find("h2", text: "Betterment Accounts"). find(:xpath, "../..") accounts = betterment_accounts.all(".SummaryTable-card") accounts.map do |account| { :adapter => :betterment, :user => @user, :id => id_for(account), :name => name_for(account), :amount => total_for(account) } end.tap do find('.sc-Nav-panelTrigger').click find('.sc-Nav-panelTrigger').click find('.sc-Nav-panelTrigger .SecondaryNavLogoutAction button', visible: false).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]" return false rescue ::ElementNotFound verify_login! return 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 |