Class: OpenID::Yadis::BasicServiceEndpoint

Inherits:
Object
  • Object
show all
Defined in:
lib/openid/yadis/filters.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(yadis_url, type_uris, uri, service_element) ⇒ BasicServiceEndpoint

Generic endpoint object that contains parsed service information, as well as a reference to the service element from which it was generated. If there is more than one xrd:Type or xrd:URI in the xrd:Service, this object represents just one of those pairs.

This object can be used as a filter, because it implements fromBasicServiceEndpoint.

The simplest kind of filter you can write implements fromBasicServiceEndpoint, which takes one of these objects.



22
23
24
25
26
27
# File 'lib/openid/yadis/filters.rb', line 22

def initialize(yadis_url, type_uris, uri, service_element)
  @type_uris = type_uris
  @yadis_url = yadis_url
  @uri = uri
  @service_element = service_element
end

Instance Attribute Details

#service_elementObject (readonly)

Returns the value of attribute service_element.



9
10
11
# File 'lib/openid/yadis/filters.rb', line 9

def service_element
  @service_element
end

#type_urisObject (readonly)

Returns the value of attribute type_uris.



9
10
11
# File 'lib/openid/yadis/filters.rb', line 9

def type_uris
  @type_uris
end

#uriObject (readonly)

Returns the value of attribute uri.



9
10
11
# File 'lib/openid/yadis/filters.rb', line 9

def uri
  @uri
end

#yadis_urlObject (readonly)

Returns the value of attribute yadis_url.



9
10
11
# File 'lib/openid/yadis/filters.rb', line 9

def yadis_url
  @yadis_url
end

Class Method Details

.from_basic_service_endpoint(endpoint) ⇒ Object

Trivial transform from a basic endpoint to itself. This method exists to allow BasicServiceEndpoint to be used as a filter.

If you are subclassing this object, re-implement this function.



42
43
44
# File 'lib/openid/yadis/filters.rb', line 42

def self.from_basic_service_endpoint(endpoint)
  return endpoint
end

Instance Method Details

#from_basic_service_endpoint(endpoint) ⇒ Object

A hack to make both this class and its instances respond to this message since Ruby doesn’t support static methods.



48
49
50
# File 'lib/openid/yadis/filters.rb', line 48

def from_basic_service_endpoint(endpoint)
  return self.class.from_basic_service_endpoint(endpoint)
end

#match_types(type_uris) ⇒ Object

Query this endpoint to see if it has any of the given type URIs. This is useful for implementing other endpoint classes that e.g. need to check for the presence of multiple versions of a single protocol.



33
34
35
# File 'lib/openid/yadis/filters.rb', line 33

def match_types(type_uris)
  return @type_uris & type_uris
end