Hi this is my very first Ruby program. I'm trying to write a simple ruby app to make a request to a URL and see if it's available. If it is, it'll print OK and else it'll print false.
This is what I've got so far, can you please assist, do I need to import any libs?
class WebRequest
def initialize(name)
@name = name.capitalize
end
def makeRequest
puts "Hello #{@name}!"
@uri = URI.parse("https://example.com/some/path")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE # read into this
@data = http.get(uri.request_uri)
end
end
req = WebRequest.new("Archie")
req.makeRequest