class RhetButler::Stasis::HTTPLoader

Public Class Methods

new() click to toggle source
# File lib/rhet-butler/stasis/http-loader.rb, line 5
def initialize
  require 'net/http'
end

Public Instance Methods

load(source_uri) click to toggle source
# 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