Class: BU::Api
- Inherits:
-
Object
- Object
- BU::Api
- Defined in:
- lib/bu/api.rb
Instance Method Summary collapse
- #dashboard(manga) ⇒ Object
- #doc(url) ⇒ Object
-
#initialize ⇒ Api
constructor
A new instance of Api.
- #scanlators ⇒ Object
Constructor Details
#initialize ⇒ Api
Returns a new instance of Api.
6 7 8 9 10 11 12 |
# File 'lib/bu/api.rb', line 6 def initialize @conn = Faraday.new(url: BU::ROOT) do |f| f.request(:url_encoded) # f.response(:logger) # for debugging f.adapter(Faraday.default_adapter) end end |
Instance Method Details
#dashboard(manga) ⇒ Object
14 15 16 17 |
# File 'lib/bu/api.rb', line 14 def dashboard(manga) url = series_url(manga) BU::Dashboard.new(url, doc(url)) end |
#doc(url) ⇒ Object
24 25 26 |
# File 'lib/bu/api.rb', line 24 def doc(url) Nokogiri::HTML(@conn.get(url).body) end |
#scanlators ⇒ Object
19 20 21 22 |
# File 'lib/bu/api.rb', line 19 def scanlators url = 'https://www.mangaupdates.com/groups.html' BU::Scanlators.new(url, self) end |