Results for: "Logger"

No documentation available
No documentation available
No documentation available

Reads the next expression from this printer.

See IO#gets for more information.

Returns true; retained for compatibility.

Sends a GET request and returns the HTTP response body as a string.

With string arguments hostname and path:

hostname = 'jsonplaceholder.typicode.com'
path = '/todos/1'
puts Net::HTTP.get(hostname, path)

Output:

{
  "userId": 1,
  "id": 1,
  "title": "delectus aut autem",
  "completed": false
}

With URI object uri and optional hash argument headers:

uri = URI('https://jsonplaceholder.typicode.com/todos/1')
headers = {'Content-type' => 'application/json; charset=UTF-8'}
Net::HTTP.get(uri, headers)

Related:

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:

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)
No documentation available
No documentation available
No documentation available

Pushes back erred argument(s) to argv.

Default stringizing method to emit standard error message.

Register a listener for one or more events.

def register: (Listener, *Symbol) -> void

def operator: () -> String

def operator: () -> String

def closing: () -> String?

def closing: () -> String?

def operator: () -> String?

def operator: () -> String

def operator: () -> String

def closing: () -> String

def operator: () -> String

def closing: () -> String?

Search took: 4ms  ·  Total Results: 2737