Class: IndieWeb::Endpoints::ResponseHeadersParser Private

Inherits:
Object
  • Object
show all
Defined in:
lib/indieweb/endpoints/response_headers_parser.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ ResponseHeadersParser

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of ResponseHeadersParser.

Parameters:

  • response (HTTP::Response)


8
9
10
11
# File 'lib/indieweb/endpoints/response_headers_parser.rb', line 8

def initialize(response)
  @headers = response.headers.get("link")
  @uri = response.uri
end

Instance Method Details

#results_for(identifier) ⇒ Array<String>?

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Parameters:

  • identifier (Symbol)

Returns:

  • (Array<String>, nil)


15
16
17
18
19
20
# File 'lib/indieweb/endpoints/response_headers_parser.rb', line 15

def results_for(identifier)
  # Reject endpoints that contain a fragment identifier
  parsed_headers[identifier]&.filter_map do |header|
    header.target_uri unless HTTP::URI.parse(header.target_uri).fragment
  end
end