Class: FineAnts::Adapters::Strs
- Inherits:
-
Object
- Object
- FineAnts::Adapters::Strs
- Defined in:
- lib/fine_ants/adapters/strs.rb
Instance Method Summary collapse
- #download ⇒ Object
-
#initialize(credentials) ⇒ Strs
constructor
A new instance of Strs.
- #login ⇒ Object
- #two_factor_response(answer) ⇒ Object
Constructor Details
#initialize(credentials) ⇒ Strs
Returns a new instance of Strs.
6 7 8 9 |
# File 'lib/fine_ants/adapters/strs.rb', line 6 def initialize(credentials) @user = credentials[:user] @password = credentials[:password] end |
Instance Method Details
#download ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fine_ants/adapters/strs.rb', line 37 def download [ { :adapter => :strs, :user => @user, :id => find(".plan-info-plan .disabled-phone-link").text, :name => find(".plan-info-plan").text, :amount => BigDecimal.new(find(".dash-health-alt__total_number").text.gsub(/[\$,]/,'')) } ].tap do click_link "Log Out" end end |
#login ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/fine_ants/adapters/strs.rb', line 11 def login visit "https://www.nrsstrsoh.org/iApp/tcm/nrsstrsoh/index.jsp" fill_in "Username", :with => @user fill_in "Password (Case sensitive)", :with => @password "Log In" begin find_field "contactPoint" return false rescue Capybara::ElementNotFound verify_login! return true end end |
#two_factor_response(answer) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/fine_ants/adapters/strs.rb', line 25 def two_factor_response(answer) fill_in "confirmationCode", :with => answer find_field("continue").click begin find "#rememberTrue" choose "#rememberTrue" find_field("#search").click rescue Capybara::ElementNotFound end verify_login! end |