Class: KindleNotebook::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/kindle_notebook/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(email: KindleNotebook.configuration.login, password: KindleNotebook.configuration.password, headless_mode: KindleNotebook.configuration.headless_mode, selenium_driver: KindleNotebook.configuration.selenium_driver) ⇒ Client

Returns a new instance of Client.



7
8
9
10
11
12
13
14
15
16
# File 'lib/kindle_notebook/client.rb', line 7

def initialize(email: KindleNotebook.configuration.,
               password: KindleNotebook.configuration.password,
               headless_mode: KindleNotebook.configuration.headless_mode,
               selenium_driver: KindleNotebook.configuration.selenium_driver)
  @email = email
  @password = password
  @headless_mode = headless_mode
  @selenium_driver = selenium_driver.to_sym
  @session = new_capybara_session
end

Instance Attribute Details

#sessionObject (readonly)

Returns the value of attribute session.



5
6
7
# File 'lib/kindle_notebook/client.rb', line 5

def session
  @session
end

Instance Method Details

#booksObject



18
19
20
# File 'lib/kindle_notebook/client.rb', line 18

def books
  @books ||= fetch_books
end

#sign_inObject



22
23
24
# File 'lib/kindle_notebook/client.rb', line 22

def 
  AmazonAuth.new(password: password, email: email).
end