Module: Net::Tofu

Defined in:
lib/net/tofu.rb,
lib/net/tofu/pub.rb,
lib/net/tofu/error.rb,
lib/net/tofu/socket.rb,
lib/net/tofu/request.rb,
lib/net/tofu/version.rb,
lib/net/tofu/response.rb

Overview

Top level module for Geminispace requests.

Defined Under Namespace

Classes: InvalidCertificateError, Pub, PublicKeyMismatchError, Request, Response, Socket, UnknownHostError

Constant Summary collapse

VERSION =
"0.2.0"

Class Method Summary collapse

Class Method Details

.get(uri, trust: false) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/net/tofu.rb', line 18

def self.get(uri, trust: false)
  req = Request.new(uri, trust: trust)
  req.gets

  return req.resp.body if req.resp.success?

  req.resp.meta
end

.get_response(uri, trust: false) ⇒ Object



27
28
29
30
31
32
# File 'lib/net/tofu.rb', line 27

def self.get_response(uri, trust: false)
  req = Request.new(uri, trust: trust)
  req.gets

  req.resp
end