class YoptaSwitcher::CLI::OperationBuilder

Attributes

client[R]
driver[R]
operation[R]
options[R]

Public Class Methods

new(options) click to toggle source
# File lib/yopta_switcher/cli/operation_builder.rb, line 9
def initialize(options)
  @options = options
  @driver = build_driver(options)
  @client = build_client(@driver, options)
end

Public Instance Methods

build() click to toggle source
# File lib/yopta_switcher/cli/operation_builder.rb, line 15
def build
  @operation ||=
    options.
      operation_class.
      new(
        client: client,
        login: options.login,
        password: options.password
      )
end

Private Instance Methods

build_client(driver, options) click to toggle source
# File lib/yopta_switcher/cli/operation_builder.rb, line 34
def build_client(driver, options)
  client_class.new(
    driver: driver,
    login_url: options.login_url
  )
end
build_driver(options) click to toggle source
# File lib/yopta_switcher/cli/operation_builder.rb, line 28
def build_driver(options)
  wait = wait_class.new(timeout: options.wait_timeout)
  driver = webdriver_class.for(options.browser)
  driver_adapter_class.new(driver: driver, wait_instance: wait)
end
client_class() click to toggle source
# File lib/yopta_switcher/cli/operation_builder.rb, line 41
def client_class
  YoptaSwitcher::Client
end
driver_adapter_class() click to toggle source
# File lib/yopta_switcher/cli/operation_builder.rb, line 53
def driver_adapter_class
  YoptaSwitcher::SeleniumDriverAdapter
end
wait_class() click to toggle source
# File lib/yopta_switcher/cli/operation_builder.rb, line 45
def wait_class
  Selenium::WebDriver::Wait
end
webdriver_class() click to toggle source
# File lib/yopta_switcher/cli/operation_builder.rb, line 49
def webdriver_class
  Selenium::WebDriver
end