Class: FineAnts::Adapters::Chase
- Inherits:
-
Object
- Object
- FineAnts::Adapters::Chase
- Defined in:
- lib/fine_ants/adapters/chase.rb
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(credentials) ⇒ Chase
constructor
A new instance of Chase.
- #login ⇒ Object
- #logout ⇒ Object
Constructor Details
#initialize(credentials) ⇒ Chase
Returns a new instance of Chase.
6 7 8 9 |
# File 'lib/fine_ants/adapters/chase.rb', line 6 def initialize(credentials) @user = credentials[:user] @password = credentials[:password] end |
Instance Method Details
#download ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fine_ants/adapters/chase.rb', line 31 def download # Select credit card find("h3", text: "CREDIT CARDS") .find(:xpath, "../..") .first(".account-tile") .click credit_card_table = find("div.account") balance = credit_card_table.find("#accountCurrentBalanceWithToolTipValue").text available_balance = credit_card_table.find("#availableCreditWithTransferBalanceValue").text next_due_date = credit_card_table.find("#nextPaymentDueDateValue").text accounts = [ { adapter: :chase, user: @user, id: find(".ACTNAME").text, name: find(".ACTNAME").text, type: :credit_card, amount: -1 * parse_currency(balance), available_amount: parse_currency(available_balance), next_due_date: parse_due_date(next_due_date) } ] logout accounts end |
#login ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/fine_ants/adapters/chase.rb', line 11 def login visit "https://www.chase.com" within_frame(find("#logonbox")) do fill_in "Username", with: @user fill_in "Password", with: @password # I'm not happy with this. Chase's site seems to blank out the # username and password fields if you hit "Sign in" immediately after # the dialog appears. We're sleeping to sidestep this behavior. sleep 0.1 click_on "Sign in" end verify_login! end |
#logout ⇒ Object
27 28 29 |
# File 'lib/fine_ants/adapters/chase.rb', line 27 def logout "Sign out" end |