Class: MangaPlus::Api::WebHomeView

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

Constant Summary collapse

OPTIONS =
"?lang=%<language>s"
URL =
API + '/web/web_home' + OPTIONS

Instance Method Summary collapse

Constructor Details

#initialize(language: 'eng') ⇒ WebHomeView

Returns a new instance of WebHomeView.



83
84
85
# File 'lib/manga_plus/api.rb', line 83

def initialize(language: 'eng')
  @options = { language: language }
end

Instance Method Details

#callObject



87
88
89
90
91
# File 'lib/manga_plus/api.rb', line 87

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