Sha256: 8c5730827e21ea0c4a07259e030b83507693b15e72f4a599f455597afd66a50e

Contents?: true

Size: 420 Bytes

Versions: 13

Compression:

Stored size: 420 Bytes

Contents

class String
  def fetch(headers = {})
    headers['User-Agent'] = 'GemVein Museum'
    require 'net/http'
    require 'net/https'

    uri = URI.parse(self)
    http = Net::HTTP.new(uri.host, uri.port)
    http.use_ssl = (uri.scheme == "https")
    http.verify_mode = OpenSSL::SSL::VERIFY_NONE

    request = Net::HTTP::Get.new(uri.request_uri, headers)

    response = http.request(request)
    response.body
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
museum-0.5.8 lib/museum/methods.rb
museum-0.5.7 lib/museum/methods.rb
museum-0.5.6 lib/museum/methods.rb
museum-0.5.4 lib/museum/methods.rb
museum-0.5.3 lib/museum/methods.rb
museum-0.5.2 lib/museum/methods.rb
museum-0.5.1 lib/museum/methods.rb
museum-0.5.0 lib/museum/methods.rb
museum-0.3.0 lib/museum/methods.rb
museum-0.2.2 lib/museum/methods.rb
museum-0.1.5 lib/museum/methods.rb
museum-0.1.4 lib/museum/methods.rb
museum-0.1.3 lib/museum/methods.rb