Sha256: bec334158486d16da880a8cc94a75076bc7133da6f3cc18822ca007140a6ee12
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
module KindleManager class Client include AmazonAuth::CommonExtension attr_accessor :adapter def initialize(options = {}) @options = options @client = AmazonAuth::Client.new(@options) extend(AmazonAuth::SessionExtension) end def session @_session ||= @client.session end def sign_in @client.sign_in end def fetch_kindle_list sign_in set_adapter(:books, @options.merge(session: session)) adapter.fetch end def fetch_kindle_highlights session.visit KindleManager::HighlightsAdapter::KINDLE_HIGHLIGHT_URL @client.submit_signin_form set_adapter(:highlights, @options.merge(session: session)) adapter.fetch end def load_kindle_books set_adapter(:books, @options.except(:create)) adapter.load end def load_kindle_highlights set_adapter(:highlights, @options.except(:create)) adapter.load end def quit session.driver.quit end def set_adapter(type, options) @adapter = "KindleManager::#{type.to_s.camelize}Adapter".constantize.new(options.merge(sub_dir: type)) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
kindle_manager-0.4.0 | lib/kindle_manager/client.rb |