Sha256: 663edef94ceba3642d8b898b63243071fb101a61d2430961f1bdfa0eff47039f

Contents?: true

Size: 427 Bytes

Versions: 8

Compression:

Stored size: 427 Bytes

Contents

require 'rhet-butler/stasis'
module RhetButler
  module Stasis
    class HTTPLoader
      def initialize
        require 'net/http'
      end

      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
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
rhet-butler-0.14.1 lib/rhet-butler/stasis/http-loader.rb
rhet-butler-0.14.0 lib/rhet-butler/stasis/http-loader.rb
rhet-butler-0.13.0 lib/rhet-butler/stasis/http-loader.rb
rhet-butler-0.12.1 lib/rhet-butler/stasis/http-loader.rb
rhet-butler-0.11.1 lib/rhet-butler/stasis/http-loader.rb
rhet-butler-0.11.0 lib/rhet-butler/stasis/http-loader.rb
rhet-butler-0.10.0 lib/rhet-butler/stasis/http-loader.rb
rhet-butler-0.9.0 lib/rhet-butler/stasis/http-loader.rb