Class: RhetButler::Stasis::HTTPLoader
- Inherits:
-
Object
- Object
- RhetButler::Stasis::HTTPLoader
- Defined in:
- lib/rhet-butler/stasis/http-loader.rb
Instance Method Summary collapse
-
#initialize ⇒ HTTPLoader
constructor
A new instance of HTTPLoader.
- #load(source_uri) ⇒ Object
Constructor Details
#initialize ⇒ HTTPLoader
Returns a new instance of HTTPLoader.
5 6 7 |
# File 'lib/rhet-butler/stasis/http-loader.rb', line 5 def initialize require 'net/http' end |
Instance Method Details
#load(source_uri) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/rhet-butler/stasis/http-loader.rb', line 9 def load(source_uri) response = Net::HTTP.get_response(URI(source_uri.to_s)) Document.new.tap do |doc| doc.body = response.body doc.source_uri = source_uri doc.type = response["Content-Type"] end end |