class RubyTapasDownloader::FeedFetcher

Fetches feed from Ruby Tapas.

Attributes

agent[R]

@return [Mechanize] the Mechanize agent.

email[R]

@return [String] the e-mail for the user.

password[R]

@return [String] the password for the user.

Public Class Methods

new(agent, email, password) click to toggle source
# File lib/ruby_tapas_downloader/feed_fetcher.rb, line 12
def initialize(agent, email, password)
  @agent    = agent
  @email    = email
  @password = password
end

Public Instance Methods

fetch() click to toggle source

Fetch feed from Ruby Tapas.

@return [RSS::Rss] the feed for Ruby Tapas.

# File lib/ruby_tapas_downloader/feed_fetcher.rb, line 21
def fetch
  RubyTapasDownloader.logger.info 'Fetching episodes feed...'

  feed_url = RubyTapasDownloader::Config.urls[:feed]

  agent.add_auth feed_url, email, password
  RSS::Parser.parse agent.get(feed_url).body
end