Class: RubyTapasDownloader::FeedFetcher
- Inherits:
-
Object
- Object
- RubyTapasDownloader::FeedFetcher
- Defined in:
- lib/ruby_tapas_downloader/feed_fetcher.rb
Overview
Fetches feed from Ruby Tapas.
Instance Attribute Summary collapse
-
#agent ⇒ Mechanize
readonly
The Mechanize agent.
-
#email ⇒ String
readonly
The e-mail for the user.
-
#password ⇒ String
readonly
The password for the user.
Instance Method Summary collapse
-
#fetch ⇒ RSS::Rss
Fetch feed from Ruby Tapas.
-
#initialize(agent, email, password) ⇒ FeedFetcher
constructor
A new instance of FeedFetcher.
Constructor Details
#initialize(agent, email, password) ⇒ FeedFetcher
Returns a new instance of FeedFetcher.
12 13 14 15 16 |
# File 'lib/ruby_tapas_downloader/feed_fetcher.rb', line 12 def initialize(agent, email, password) @agent = agent @email = email @password = password end |
Instance Attribute Details
#agent ⇒ Mechanize (readonly)
Returns the Mechanize agent.
4 5 6 |
# File 'lib/ruby_tapas_downloader/feed_fetcher.rb', line 4 def agent @agent end |
#email ⇒ String (readonly)
Returns the e-mail for the user.
7 8 9 |
# File 'lib/ruby_tapas_downloader/feed_fetcher.rb', line 7 def email @email end |
#password ⇒ String (readonly)
Returns the password for the user.
10 11 12 |
# File 'lib/ruby_tapas_downloader/feed_fetcher.rb', line 10 def password @password end |
Instance Method Details
#fetch ⇒ RSS::Rss
Fetch feed from Ruby Tapas.
21 22 23 24 25 26 27 28 |
# 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 |