Class: PRSS::Feed
- Inherits:
-
Object
- Object
- PRSS::Feed
- Defined in:
- lib/prss/feed.rb
Constant Summary collapse
- PERSONAL_FEED_URL =
"https://hdbits.org/rss/my"
Instance Attribute Summary collapse
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #download_to(output) ⇒ Object
- #downloader ⇒ Object
-
#initialize(passkey) ⇒ Feed
constructor
A new instance of Feed.
- #links ⇒ Object
- #output ⇒ Object
- #response ⇒ Object
Constructor Details
#initialize(passkey) ⇒ Feed
Returns a new instance of Feed.
10 11 12 13 14 |
# File 'lib/prss/feed.rb', line 10 def initialize(passkey) #@passkey = passkey @uri = URI(PERSONAL_FEED_URL) @uri.query = "passkey=#{passkey}" end |
Instance Attribute Details
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
8 9 10 |
# File 'lib/prss/feed.rb', line 8 def uri @uri end |
Instance Method Details
#download_to(output) ⇒ Object
30 31 32 |
# File 'lib/prss/feed.rb', line 30 def download_to(output) downloader.download_to(output) end |
#downloader ⇒ Object
34 35 36 |
# File 'lib/prss/feed.rb', line 34 def downloader Downloader.new(links) end |
#links ⇒ Object
26 27 28 |
# File 'lib/prss/feed.rb', line 26 def links Links.new(output) end |
#output ⇒ Object
22 23 24 |
# File 'lib/prss/feed.rb', line 22 def output response.body end |
#response ⇒ Object
16 17 18 19 20 |
# File 'lib/prss/feed.rb', line 16 def response Typhoeus::Request.get(@uri.to_s).tap do |response| puts "Fetched #{@uri} in #{response.total_time}s" end end |