Class: AdopsReportScrapper::SovrnClient

Inherits:
BaseClient
  • Object
show all
Defined in:
lib/adops_report_scrapper/sovrn_client.rb

Instance Method Summary collapse

Methods inherited from BaseClient

#before_quit_with_error, #get_data, #initialize, #logout

Constructor Details

This class inherits a constructor from AdopsReportScrapper::BaseClient

Instance Method Details

#date_supported?(date = nil) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
# File 'lib/adops_report_scrapper/sovrn_client.rb', line 6

def date_supported?(date = nil)
  _date = date || @date
  return true if _date >= Date.today - 7
  false
end

#init_clientObject



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/adops_report_scrapper/sovrn_client.rb', line 12

def init_client
  Capybara.register_driver :selenium do |app|
    profile = Selenium::WebDriver::Firefox::Profile.new
    @download_dir = '/tmp/sovrn'
    profile['browser.download.dir'] = @download_dir
    clean_up_download_dir
    profile['browser.download.folderList'] = 2
    profile['browser.helperApps.neverAsk.saveToDisk'] = 'application/octet-stream'
    Capybara::Selenium::Driver.new(app, :browser => :firefox, :profile => profile)
  end
  @client = Capybara::Session.new(:selenium)
end