Class: Manga::Tools::Client

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

Overview

Client Application class

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



15
16
17
# File 'lib/manga/tools/client.rb', line 15

def initialize
  @session = Manga::Tools::Session.new
end

Instance Attribute Details

#sessionManga::Tools::Session (readonly)

Returns a session instance.

Returns:



13
14
15
# File 'lib/manga/tools/client.rb', line 13

def session
  @session
end

Instance Method Details

#follow(key, options) ⇒ Object

Follow a title for a given follow ‘key`

Parameters:

  • key (String)

    follow key

  • options (Hash)

    command options from Thor



30
31
32
33
34
# 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) ⇒ Object

Displays the follow list

Parameters:

  • options (Hash)

    command options from Thor



38
39
40
41
# 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) ⇒ Object

Search ‘word` with options.

Parameters:

  • word (String)

    search string

  • options (Hash)

    command options from Thor



22
23
24
25
# 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