class Pione::Location::HTTPSLocation

Public Instance Methods

http_get(&b) click to toggle source

Send a request HTTPS Get and evaluate the block with the response.

# File lib/pione/location/https-location.rb, line 11
def http_get(&b)
  http = Net::HTTP.new(@uri.host, @uri.port)
  http.use_ssl = true
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  req = Net::HTTP::Get.new(@uri.path)
  res = http.request(req)
  if res.kind_of?(Net::HTTPSuccess)
    return b.call(res)
  else
    raise NotFound.new(@uri)
  end
end
http_head(&b) click to toggle source

Send a request HTTPS Head and evaluate the block with the response.

# File lib/pione/location/https-location.rb, line 25
def http_head(&b)
  http = Net::HTTP.new(@uri.host, @uri.port)
  http.use_ssl = true
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
  req = Net::HTTP::Head.new(@uri.path)
  res = http.request(req)
  if res.kind_of?(Net::HTTPSuccess)
    return b.call(res)
  else
    raise NotFound(@uri)
  end
end