Sha256: 2320316f3ae864503a83285cea002d2681bc37ed2541327349546ecf5f6a951c

Contents?: true

Size: 746 Bytes

Versions: 12

Compression:

Stored size: 746 Bytes

Contents

# frozen_string_literal: true

class BrowserFactory
  class << self
    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

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

  def self.browser(url_options: {})
    BrowseEverything::Browser.new(url_options)
  end
  private_class_method :browser
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
browse-everything-1.4.0 app/services/browser_factory.rb
browse-everything-1.3.0 app/services/browser_factory.rb
browse-everything-1.2.0 app/services/browser_factory.rb
browse-everything-1.1.2 app/services/browser_factory.rb
browse-everything-1.1.1 app/services/browser_factory.rb
browse-everything-1.1.0 app/services/browser_factory.rb
browse-everything-1.0.2 app/services/browser_factory.rb
browse-everything-1.0.1 app/services/browser_factory.rb
browse-everything-1.0.0 app/services/browser_factory.rb
browse-everything-1.0.0.rc2 app/services/browser_factory.rb
browse-everything-1.0.0.rc1 app/services/browser_factory.rb
browse-everything-0.16.1 app/services/browser_factory.rb