main.rb342 chars18 lines
Explanation:
send_post_request
that accepts two parameters, the URL we want to send the request to, and the body of our request.Net::HTTP
class with the host and port of the URL we want to send the request to.Net::HTTP::Post
class and pass the URL we want to send the request to as an argument to its constructor.basic_auth
method on our instance of the Net::HTTP::Post
class and passing our username and password as arguments.set_form_data
method and passing our body
parameter.request
method on our http
object with our request
object as the argument.gistlibby LogSnag