Class: Metallum::Agent

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

Overview

Instance Method Summary collapse

Constructor Details

#initialize(url) ⇒ Agent

Returns a new instance of Agent.



7
8
9
10
11
# File 'lib/metallum/metallum.rb', line 7

def initialize(url)
  @agent = Mechanize.new
  @page = @agent.get(url)
  @discography = @agent.get("http://www.metal-archives.com/band/discography/id/#{extract_band_id}/tab/all")
end

Instance Method Details

#extract_band_idObject



21
22
23
# File 'lib/metallum/metallum.rb', line 21

def extract_band_id
  @page.uri.to_s.match(/\/(\d+)/)[1]
end

#fetch_albumObject



17
18
19
# File 'lib/metallum/metallum.rb', line 17

def fetch_album
  album = Album.new(@page)
end

#fetch_bandObject



13
14
15
# File 'lib/metallum/metallum.rb', line 13

def fetch_band
  band = Band.new(@page, @discography) 
end