Sha256: aa256c0c550395565268ae89a36db2b91bae7b1c04818b1d7f14aec498e2a34d

Contents?: true

Size: 1.3 KB

Versions: 26

Compression:

Stored size: 1.3 KB

Contents

require 'openid/yadis/filters'
require 'openid/yadis/discovery'
require 'openid/yadis/xrds'

module OpenID
  module Yadis
    def Yadis.get_service_endpoints(input_url, flt=nil)
      # Perform the Yadis protocol on the input URL and return an
      # iterable of resulting endpoint objects.
      #
      # @param flt: A filter object or something that is convertable
      # to a filter object (using mkFilter) that will be used to
      # generate endpoint objects. This defaults to generating
      # BasicEndpoint objects.
      result = Yadis.discover(input_url)
      begin
        endpoints = Yadis.apply_filter(result.normalized_uri,
                                       result.response_text, flt)
      rescue XRDSError => err
        raise DiscoveryFailure.new(err.to_s, nil)
      end

      return [result.normalized_uri, endpoints]
    end

    def Yadis.apply_filter(normalized_uri, xrd_data, flt=nil)
      # Generate an iterable of endpoint objects given this input data,
      # presumably from the result of performing the Yadis protocol.

      flt = Yadis.make_filter(flt)
      et = Yadis.parseXRDS(xrd_data)

      endpoints = []
      each_service(et) { |service_element|
        endpoints += flt.get_service_endpoints(normalized_uri, service_element)
      }

      return endpoints
    end
  end
end

Version data entries

26 entries across 26 versions & 4 rubygems

Version Path
ruby-openid-2.9.2 lib/openid/yadis/services.rb
ruby-openid-2.9.1 lib/openid/yadis/services.rb
ruby-openid-2.8.0 lib/openid/yadis/services.rb
ruby-openid-2.7.0 lib/openid/yadis/services.rb
ruby-openid-2.6.0 lib/openid/yadis/services.rb
pelle-ruby-openid-2.1.8 lib/openid/yadis/services.rb
ruby-openid-2.5.0 lib/openid/yadis/services.rb
ruby-openid-2.4.0 lib/openid/yadis/services.rb
ruby-openid-2.3.0 lib/openid/yadis/services.rb
ruby-openid-2.2.3 lib/openid/yadis/services.rb
ruby-openid-2.2.2 lib/openid/yadis/services.rb
ruby-openid-2.2.1 lib/openid/yadis/services.rb
ruby-openid-2.2.0 lib/openid/yadis/services.rb
entp-ruby-openid-2.2 lib/openid/yadis/services.rb
nov-ruby-openid-2.1.9 lib/openid/yadis/services.rb
ruby-openid-2.1.8 lib/openid/yadis/services.rb
pelle-ruby-openid-2.1.9 lib/openid/yadis/services.rb
ruby-openid-2.1.7 lib/openid/yadis/services.rb
ruby-openid-2.0.2 lib/openid/yadis/services.rb
ruby-openid-2.0.1 lib/openid/yadis/services.rb