Class: BU::Api

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

Instance Method Summary collapse

Constructor Details

#initializeApi

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

#scanlatorsObject



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