Class: Webmention::Url
- Inherits:
-
Object
- Object
- Webmention::Url
- Extended by:
- Forwardable
- Defined in:
- lib/webmention/url.rb
Instance Attribute Summary collapse
- #uri ⇒ String readonly
Instance Method Summary collapse
-
#initialize(url) ⇒ Webmention::Url
constructor
Create a new Webmention::Url.
-
#inspect ⇒ String
:nocov:.
- #response ⇒ Webmention::Response, Webmention::ErrorResponse
- #webmention_endpoint ⇒ String?
- #webmention_endpoint? ⇒ Boolean
Constructor Details
#initialize(url) ⇒ Webmention::Url
Create a new Webmention::Url.
19 20 21 |
# File 'lib/webmention/url.rb', line 19 def initialize(url) @uri = HTTP::URI.parse(url.to_s) end |
Instance Attribute Details
#uri ⇒ String (readonly)
8 9 10 |
# File 'lib/webmention/url.rb', line 8 def uri @uri end |
Instance Method Details
#inspect ⇒ String
:nocov:
25 26 27 28 |
# File 'lib/webmention/url.rb', line 25 def inspect "#<#{self.class}:#{format("%#0x", object_id)} " \ "uri: #{uri}>" end |
#response ⇒ Webmention::Response, Webmention::ErrorResponse
32 33 34 |
# File 'lib/webmention/url.rb', line 32 def response @response ||= Request.get(uri) end |
#webmention_endpoint ⇒ String?
37 38 39 |
# File 'lib/webmention/url.rb', line 37 def webmention_endpoint @webmention_endpoint ||= IndieWeb::Endpoints::Parser.new(response).results[:webmention] if response.ok? end |
#webmention_endpoint? ⇒ Boolean
42 43 44 |
# File 'lib/webmention/url.rb', line 42 def webmention_endpoint? !webmention_endpoint.nil? end |