Sha256: 176e02c551de1fef7949b4952eb968109652cbf573984363b7168767d04f84d3
Contents?: true
Size: 685 Bytes
Versions: 1
Compression:
Stored size: 685 Bytes
Contents
module IndieWeb module Endpoints class Client def initialize(url) raise ArgumentError, "url must be a String (given #{url.class.name})" unless url.is_a?(String) @uri = Addressable::URI.parse(url) raise ArgumentError, 'url must be an absolute URL (e.g. https://example.com)' unless @uri.absolute? rescue Addressable::URI::InvalidURIError => exception raise InvalidURIError, exception end def endpoints @endpoints ||= OpenStruct.new(Parsers.registered.transform_values { |parser| parser.new(response).results }) end def response @response ||= HttpRequest.get(@uri) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
indieweb-endpoints-0.4.0 | lib/indieweb/endpoints/client.rb |