Class: BrowserFactory

Inherits:
Object
  • Object
show all
Defined in:
app/services/browser_factory.rb

Class Method Summary collapse

Class Method Details

.build(session:, url_options:) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'app/services/browser_factory.rb', line 5

def build(session:, url_options:)
  browser = BrowseEverything::Browser.new(url_options)
  browser.providers.each_value do |provider_handler|
    # The authentication token must be set here
    provider_session = BrowseEverythingSession::ProviderSession.for(session: session, name: provider_handler.key.to_sym)
    provider_handler.token = provider_session.token if provider_session.token
  end
  browser
end

.for(name:, url_options: {}) ⇒ Object



15
16
17
# File 'app/services/browser_factory.rb', line 15

def for(name:, url_options: {})
  browser(url_options: url_options).providers[name]
end