# frozen_string_literal: true module Toggl module Jobcan # Jobcan client class Client attr_accessor :credentials attr_reader :driver attr_reader :toggl include Toggl::Jobcan::TogglSupport JOBCAN_URLS = { attendance: 'https://ssl.jobcan.jp/employee/attendance', attendance_modify: 'https://ssl.jobcan.jp/employee/adit/modify/' }.freeze XPATHS = { notice: %(//textarea[@name='notice']), load_button: %(//input[@value='表示']), submit: %(//button[@type='submit']), password_label: %(//label[@for='password']) }.freeze def initialize( credentials: nil, options: Selenium::WebDriver::Chrome::Options.new, toggl_worktime_config:, dryrun: false ) @credentials = credentials options.add_argument('--headless') @driver = Selenium::WebDriver.for :chrome, options: options @toggl = Toggl::Worktime::Driver.new( config: Toggl::Worktime::Config.new(path: toggl_worktime_config) ) @dryrun = dryrun end def login @driver.navigate.to JOBCAN_URLS[:attendance] # login if