class Foodie::WhoIs

Your code goes here…

Public Class Methods

awesome?() click to toggle source
# File lib/foodie.rb, line 8
def self.awesome?
  puts 'YOU ARE AWESOME!!'
end
httpbin() click to toggle source
# File lib/foodie.rb, line 12
def self.httpbin
  url = 'https://httpbin.org/get'
  uri = URI.parse(url)
  response = Net::HTTP.get(uri)
  puts response
  response
end
httpbin_basic() click to toggle source
# File lib/foodie.rb, line 20
def self.httpbin_basic
  url = 'https://httpbin.org/basic-auth/user/passwd'
  uri = URI(url)

  req = Net::HTTP::Get.new(uri)
  req.basic_auth 'user', 'passwd'

  Net::HTTP.start(uri.hostname, uri.port,
                  :use_ssl => uri.scheme == 'https', :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|
    request = Net::HTTP::Get.new uri.request_uri
    request.basic_auth 'user', 'passwd'

    response = http.request request # Net::HTTPResponse object

    puts response
    puts response.body
    return response
  end
end

Public Instance Methods

version_info() click to toggle source
# File lib/foodie.rb, line 40
def version_info
  Foodie::VERSION
end