Class: IndieWeb::Endpoints::Parsers::BaseParser
- Inherits:
-
Object
- Object
- IndieWeb::Endpoints::Parsers::BaseParser
- Defined in:
- lib/indieweb/endpoints/parsers.rb
Direct Known Subclasses
AuthorizationEndpointParser, MicropubParser, RedirectUriParser, TokenEndpointParser, WebmentionParser
Constant Summary collapse
- REGEXP_REG_REL_TYPE_PATTERN =
Ultra-orthodox pattern matching allowed values in Link header ‘rel` parameter tools.ietf.org/html/rfc8288#section-3.3
'[a-z\d][a-z\d\-\.]*'.freeze
- REGEXP_TARGET_URI_PATTERN =
Liberal pattern matching a string of text between angle brackets tools.ietf.org/html/rfc5988#section-5.1
/^<(.*)>;/.freeze
Instance Method Summary collapse
-
#initialize(response) ⇒ BaseParser
constructor
A new instance of BaseParser.
- #results ⇒ Object
Constructor Details
#initialize(response) ⇒ BaseParser
Returns a new instance of BaseParser.
15 16 17 18 19 |
# File 'lib/indieweb/endpoints/parsers.rb', line 15 def initialize(response) raise ArgumentError, "response must be an HTTP::Response (given #{response.class.name})" unless response.is_a?(HTTP::Response) @response = response end |
Instance Method Details
#results ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/indieweb/endpoints/parsers.rb', line 21 def results return unless results_from_http_request @results ||= Absolutely.to_absolute_uri(base: @response.uri.to_s, relative: results_from_http_request) rescue Absolutely::InvalidURIError => exception raise InvalidURIError, exception end |