Module: WebFinger

Defined in:
lib/webfinger/response.rb,
lib/webfinger.rb,
lib/webfinger/request.rb,
lib/webfinger/exception.rb,
lib/webfinger/debugger/request_filter.rb

Overview

NOTE:

Make a JSON Resource Descriptor (JRD) gem as separate one and use it as superclass?

Defined Under Namespace

Modules: Debugger Classes: BadRequest, Exception, Forbidden, HttpError, NotFound, Request, Response, Unauthorized

Constant Summary collapse

VERSION =
File.read(
  File.join(File.dirname(__FILE__), '../VERSION')
).delete("\n\r")

Class Method Summary collapse

Class Method Details

.debug!Object



32
33
34
# File 'lib/webfinger.rb', line 32

def debug!
  self.debugging = true
end

.debugging=(boolean) ⇒ Object



29
30
31
# File 'lib/webfinger.rb', line 29

def debugging=(boolean)
  @debugging = boolean
end

.debugging?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/webfinger.rb', line 26

def debugging?
  @debugging
end

.discover!(resource, options = {}) ⇒ Object



13
14
15
# File 'lib/webfinger.rb', line 13

def discover!(resource, options = {})
  Request.new(resource, options).discover!
end

.http_clientObject



44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/webfinger.rb', line 44

def http_client
  _http_client_ = HTTPClient.new(
    agent_name: "WebFinger (#{VERSION})"
  )

  # NOTE: httpclient gem seems stopped maintaining root certtificate set, use OS default.
  _http_client_.ssl_config.clear_cert_store
  _http_client_.ssl_config.cert_store.set_default_paths

  _http_client_.request_filter << Debugger::RequestFilter.new if debugging?
  http_config.try(:call, _http_client_)
  _http_client_
end

.http_config(&block) ⇒ Object



57
58
59
# File 'lib/webfinger.rb', line 57

def http_config(&block)
  @http_config ||= block
end

.loggerObject



17
18
19
# File 'lib/webfinger.rb', line 17

def logger
  @logger
end

.logger=(logger) ⇒ Object



20
21
22
# File 'lib/webfinger.rb', line 20

def logger=(logger)
  @logger = logger
end

.url_builderObject



37
38
39
# File 'lib/webfinger.rb', line 37

def url_builder
  @url_builder ||= URI::HTTPS
end

.url_builder=(builder) ⇒ Object



40
41
42
# File 'lib/webfinger.rb', line 40

def url_builder=(builder)
  @url_builder = builder
end