Class: Tapas::FeedSource
- Inherits:
-
Object
- Object
- Tapas::FeedSource
- Defined in:
- lib/tapas/feed_source.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
Instance Method Summary collapse
- #feed ⇒ Object
-
#initialize(config) ⇒ FeedSource
constructor
A new instance of FeedSource.
Constructor Details
#initialize(config) ⇒ FeedSource
7 8 9 |
# File 'lib/tapas/feed_source.rb', line 7 def initialize(config) @config = config end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
5 6 7 |
# File 'lib/tapas/feed_source.rb', line 5 def config @config end |
Instance Method Details
#feed ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/tapas/feed_source.rb', line 11 def feed if config.feed_file File.read(config.feed_file) elsif config.feed_url open(config.feed_url, http_basic_authentication: [config.username, config.password]).read end rescue OpenURI::HTTPError => e raise Tapas:: if e. == "401 Unauthorized" raise end |