Class: WebmentionCLI::Webmention
- Inherits:
-
Thor
- Object
- Thor
- WebmentionCLI::Webmention
- Defined in:
- lib/webmention_cli/webmention.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.exit_on_failure? ⇒ Boolean
3 4 5 |
# File 'lib/webmention_cli/webmention.rb', line 3 def self.exit_on_failure? true end |
Instance Method Details
#endpoint(url) ⇒ Object
8 9 10 11 12 13 14 15 16 |
# File 'lib/webmention_cli/webmention.rb', line 8 def endpoint(url) result = ::Webmention::Endpoint.discover(url) puts result if result exit(result ? true : false) rescue ::Webmention::Endpoint::ArgumentError, ::Webmention::Endpoint::InvalidURIError raise Thor::MalformattedArgumentError, "ERROR: Expected '#{url}' to be an absolute URI (e.g. https://example.com)" end |
#verify(source, target) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/webmention_cli/webmention.rb', line 26 def verify(source, target) result = ::Webmention::Verification::Client.new(source, target, strict: [:strict]).verified? if result puts "SUCCESS: #{source} links to #{target}" else puts "ERROR: #{source} does not link to #{target}" end exit(result) rescue ::Webmention::Verification::ArgumentError raise Thor::MalformattedArgumentError, "ERROR: Expected '#{source}' and '#{target}' to be absolute URIs (e.g. https://example.com)" end |