Sends an HTTP request to the server; returns an instance of a subclass of Net::HTTPResponse
.
The request is based on the Net::HTTPRequest
object created from string path
, string data
, and initial headers hash header
. That object is an instance of the subclass of Net::HTTPRequest, that corresponds to the given uppercase string name
, which must be an HTTP request method or a WebDAV request method.
Examples:
http = Net::HTTP.new(hostname) http.send_request('GET', '/todos/1') # => #<Net::HTTPOK 200 OK readbody=true> http.send_request('POST', '/todos', 'xyzzy') # => #<Net::HTTPCreated 201 Created readbody=true>
Sets the body stream for the request:
req = Net::HTTP::Post.new(uri) # => #<Net::HTTP::Post POST> req.body_stream # => nil require 'stringio' req.body_stream = StringIO.new('xyzzy') # => #<StringIO:0x0000027d1e5affa8> req.body_stream # => #<StringIO:0x0000027d1e5affa8>
Returns the full path for an HTTP
request, as required by Net::HTTP::Get
.
If the URI
contains a query, the full path is URI#path + ‘?’ + URI#query. Otherwise, the path is simply URI#path.
Example:
uri = URI::HTTP.build(path: '/foo/bar', query: 'test=true') uri.request_uri # => "/foo/bar?test=true"
Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc.
Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc.
Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc.
Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc.
Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc.
Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc.
Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc.
Returns the location of the binary operator used to modify the receiver. This method is deprecated in favor of binary_operator_loc.
Returns a string representation of the syntax tree with the errors displayed inline.
Paths in the gem to add to $LOAD_PATH
when this gem is activated.
See also require_paths=
If you have an extension you do not need to add "ext"
to the require path, the extension build process will copy the extension files into “lib” for you.
The default value is "lib"
Usage:
# If all library files are in the root directory... spec.require_path = '.'
Register the Symbol
command
as a gem command.
Unregister the Symbol
command
as a gem command.
Return a hash of predecessors. result[spec]
is an Array
of gemspecs that have a dependency satisfied by the named gemspec.
Resolve the requested dependencies against the gems available via Gem.path
and return an Array
of Specification objects to be activated.
Paths in the gem to add to $LOAD_PATH
when this gem is activated. If you have an extension you do not need to add "ext"
to the require path, the extension build process will copy the extension files into “lib” for you.
The default value is "lib"
Usage:
# If all library files are in the root directory... spec.require_paths = ['.']
Returns a Gem::StubSpecification
for installed gem named name
only returns stubs that match Gem.platforms