Class: FineAnts::Adapters::Pnc
- Inherits:
-
Object
- Object
- FineAnts::Adapters::Pnc
- Defined in:
- lib/fine_ants/adapters/pnc.rb
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(credentials) ⇒ Pnc
constructor
A new instance of Pnc.
- #login ⇒ Object
- #two_factor_response(text_or_answer) ⇒ Object
Constructor Details
#initialize(credentials) ⇒ Pnc
Returns a new instance of Pnc.
6 7 8 9 |
# File 'lib/fine_ants/adapters/pnc.rb', line 6 def initialize(credentials) @user = credentials[:user] @password = credentials[:password] end |
Instance Method Details
#download ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/fine_ants/adapters/pnc.rb', line 38 def download rows = all("#depositAccountsWrapper tr.depAccount") rows.map { |row| cells = row.all("td") { adapter: :pnc, user: @user, id: cells[2].text, # TODO - this won't be unique, only gives last 4 :-/ name: cells[0].text, amount: BigDecimal(cells[3].text.match(/\$(.*)$/)[1].delete(",")) } }.tap { click_link "Sign Off" } end |
#login ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fine_ants/adapters/pnc.rb', line 11 def login visit "https://www.onlinebanking.pnc.com/alservlet/SignonInitServlet" fill_in "userId", with: @user fill_in "password", with: @password "Sign In" if all("input[value='Generate Code']").any? "Generate Code" false elsif all("input[name=answer]").any? false else verify_login! true end end |
#two_factor_response(text_or_answer) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/fine_ants/adapters/pnc.rb', line 28 def two_factor_response(text_or_answer) if all("input[name=answer]").any? # Security Q fill_in "answer", with: text_or_answer else # Text message challenge fill_in "otpNumber", with: text_or_answer end "Continue" verify_login! end |