Sends a GET request to the server; returns an instance of a subclass of Net::HTTPResponse
.
The request is based on the Net::HTTP::Get
object created from string path
and initial headers hash initheader
.
With a block given, calls the block with the response body:
http = Net::HTTP.new(hostname) http.get('/todos/1') do |res| p res end # => #<Net::HTTPOK 200 OK readbody=true>
Output:
"{\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"delectus aut autem\",\n \"completed\": false\n}"
With no block given, simply returns the response object:
http.get('/') # => #<Net::HTTPOK 200 OK readbody=true>
Related:
Net::HTTP::Get
: request class for HTTP method GET.
Net::HTTP.get
: sends GET request, returns response body.
Sends a LOCK request to the server; returns an instance of a subclass of Net::HTTPResponse
.
The request is based on the Net::HTTP::Lock
object created from string path
, string body
, and initial headers hash initheader
.
data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}' http = Net::HTTP.new(hostname) http.lock('/todos/1', data)
Sends an UNLOCK request to the server; returns an instance of a subclass of Net::HTTPResponse
.
The request is based on the Net::HTTP::Unlock
object created from string path
, string body
, and initial headers hash initheader
.
data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}' http = Net::HTTP.new(hostname) http.unlock('/todos/1', data)
Returns the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator.
Returns the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator.
Returns the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator.
Returns the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator.
Returns the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator.
Mirrors the C extension’s StringQuery::local?
method.
Parse the enum result and return an appropriate boolean.
Whether or not this string is a valid local variable name.
Returns the value of the node as an IntegerNode or a FloatNode. This method is deprecated in favor of value
or numerator/#denominator.
Returns the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator.
Returns the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator.
Returns the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator.
A Location
object representing the location of this token in the source.
Gets the IP address of name
from the hosts file.
Gets all IP addresses for name
from the hosts file.
Gets the hostname of address
from the hosts file.
Gets all hostnames for address
from the hosts file.
Closes the DNS
resolver.
Gets the IP address of name
from the DNS
resolver.
name
can be a Resolv::DNS::Name
or a String
. Retrieved address will be a Resolv::IPv4
or Resolv::IPv6
Gets all IP addresses for name
from the DNS
resolver.
name
can be a Resolv::DNS::Name
or a String
. Retrieved addresses will be a Resolv::IPv4
or Resolv::IPv6