Class: Talis::Feeds::Feed

Inherits:
Resource show all
Defined in:
lib/talis/feeds/feed.rb

Overview

Represents a feed, as a way of bringing back a collection of annotations.

Class Method Summary collapse

Methods inherited from Resource

handle_response, new_req_id

Class Method Details

.find(request_id: new_req_id, target_uri:) ⇒ Array<Talis::Feeds::Annotation>

Returns a collection of annotations matching the provided target.

Parameters:

  • request_id (String) (defaults to: new_req_id)

    (‘uuid’) unique ID for the remote request.

  • target_uri (String)

    The URI uniquely identifying the target.

Returns:

Raises:



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/talis/feeds/feed.rb', line 16

def find(request_id: new_req_id, target_uri:)
  md5_target_uri = Digest::MD5.hexdigest(target_uri)
  response = fetch_feed(request_id, md5_target_uri)
  begin
    build handle_response(response)
  rescue Talis::NotFoundError
    []
  end
rescue SocketError
  raise Talis::ServerCommunicationError
end