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) ⇒ Url
constructor
Create a new Url.
-
#inspect ⇒ String
:nocov:.
- #response ⇒ Response, ErrorResponse
- #webmention_endpoint ⇒ String?
- #webmention_endpoint? ⇒ Boolean
Constructor Details
#initialize(url) ⇒ Url
Create a new Webmention::Url.
17 18 19 |
# File 'lib/webmention/url.rb', line 17 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:
23 24 25 26 |
# File 'lib/webmention/url.rb', line 23 def inspect "#<#{self.class}:#{format("%#0x", object_id)} " \ "uri: #{uri}>" end |
#response ⇒ Response, ErrorResponse
30 31 32 |
# File 'lib/webmention/url.rb', line 30 def response @response ||= Request.get(uri) end |
#webmention_endpoint ⇒ String?
35 36 37 |
# File 'lib/webmention/url.rb', line 35 def webmention_endpoint @webmention_endpoint ||= IndieWeb::Endpoints::Parser.new(response).to_h[:webmention] if response.ok? end |
#webmention_endpoint? ⇒ Boolean
40 41 42 |
# File 'lib/webmention/url.rb', line 40 def webmention_endpoint? !webmention_endpoint.nil? end |