class Manga::Tools::Client
Client
Application class
Attributes
session[R]
@return [Manga::Tools::Session] a session instance
Public Class Methods
new()
click to toggle source
# File lib/manga/tools/client.rb, line 15 def initialize @session = Manga::Tools::Session.new end
Public Instance Methods
follow(key, options)
click to toggle source
Follow a title for a given follow `key` @param key [String] follow key @param options [Hash] command options from Thor
# File lib/manga/tools/client.rb, line 30 def follow(key, options) params = { key: key } session.options = adapt_to_dev_env(options) session.post('/follows', params) end
follow_list(options)
click to toggle source
Displays the follow list @param options [Hash] command options from Thor
# File lib/manga/tools/client.rb, line 38 def follow_list(options) session.options = adapt_to_dev_env(options) session.get('/follows') end
search(word, options)
click to toggle source
Search `word` with options. @param word [String] search string @param options [Hash] command options from Thor
# File lib/manga/tools/client.rb, line 22 def search(word, options) session.options = adapt_to_dev_env(options) session.get("/publications?keyword=#{CGI.escape(word)}") end
Private Instance Methods
adapt_to_dev_env(options)
click to toggle source
# File lib/manga/tools/client.rb, line 45 def adapt_to_dev_env(options) opts = options.dup if opts[:host] # If the `host` option is specified, it is assumed to be the development environment opts[:session_file_name] = 'session-development.txt' end opts end