Class: MangaPlus::Api::MangaViewer

Inherits:
Object
  • Object
show all
Defined in:
lib/manga_plus/api.rb

Constant Summary collapse

OPTIONS =
'chapter_id=%<chapter_id>s&split=%<split>s&img_quality=%<img_quality>s'
URL =
API + '/manga_viewer?' + OPTIONS

Instance Method Summary collapse

Constructor Details

#initialize(chapter_id, split: 'yes', img_quality: 'super_high') ⇒ MangaViewer

Returns a new instance of MangaViewer.



64
65
66
67
68
69
70
# File 'lib/manga_plus/api.rb', line 64

def initialize(chapter_id, split: 'yes', img_quality: 'super_high')
  @options = {
    chapter_id: chapter_id,
    split: split,
    img_quality: img_quality
  }
end

Instance Method Details

#callObject



72
73
74
75
76
# File 'lib/manga_plus/api.rb', line 72

def call
  protobuf = HTTParty.get(URL % @options).body
  response = MangaPlus::Response.decode(protobuf).to_h
  response.dig(:success, :mangaViewer)
end