triannon-client 0.1.0 → 0.2.0.pre.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/.env_example +1 -1
  3. data/.travis.yml +1 -2
  4. data/README.md +12 -3
  5. data/bin/test.sh +8 -9
  6. data/lib/triannon-client.rb +8 -3
  7. data/lib/triannon-client/triannon_client.rb +180 -0
  8. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_application/n-quads_.yml +4088 -0
  9. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_application/n-triples_.yml +4088 -0
  10. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_application/rdf_json_.yml +4088 -0
  11. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_application/rdf_n3_.yml +4088 -0
  12. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_application/trig_.yml +4088 -0
  13. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_application/trix_.yml +4088 -0
  14. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_application/turtle_.yml +4088 -0
  15. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_application/x-ld_json_.yml +4088 -0
  16. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_application/x-trig_.yml +4088 -0
  17. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_text/n3_.yml +4088 -0
  18. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_text/rdf_n3_.yml +4088 -0
  19. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_text/rdf_turtle_.yml +4088 -0
  20. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/cannot_get_an_open_annotation_by_ID_with_content_type_text/x-nquads_.yml +4088 -0
  21. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_application/ld_json_.yml +4946 -0
  22. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_application/n-quads_.yml +4088 -0
  23. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_application/n-triples_.yml +4088 -0
  24. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_application/rdf_json_.yml +4088 -0
  25. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_application/rdf_n3_.yml +4088 -0
  26. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_application/rdf_xml_.yml +2565 -0
  27. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_application/trig_.yml +4088 -0
  28. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_application/trix_.yml +4088 -0
  29. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_application/turtle_.yml +4088 -0
  30. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_application/x-ld_json_.yml +4088 -0
  31. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_application/x-trig_.yml +4088 -0
  32. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_application/x-turtle_.yml +2566 -0
  33. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_text/n3_.yml +4088 -0
  34. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_text/rdf_n3_.yml +4088 -0
  35. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_text/rdf_turtle_.yml +4088 -0
  36. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_text/turtle_.yml +2566 -0
  37. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/gets_an_open_annotation_by_ID_with_content_type_text/x-nquads_.yml +4088 -0
  38. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_accepting_JSON-LD_content.yml +2502 -0
  39. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_accepting_a_default_JSON-LD_content.yml +2502 -0
  40. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_using_a_default_JSON-LD_content.yml +2502 -0
  41. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_application/ld_json_.yml +2502 -0
  42. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_application/n-quads_.yml +2502 -0
  43. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_application/n-triples_.yml +2502 -0
  44. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_application/rdf_json_.yml +2502 -0
  45. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_application/rdf_n3_.yml +2502 -0
  46. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_application/rdf_xml_.yml +2502 -0
  47. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_application/trig_.yml +2502 -0
  48. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_application/trix_.yml +2502 -0
  49. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_application/turtle_.yml +2502 -0
  50. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_application/x-ld_json_.yml +2502 -0
  51. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_application/x-trig_.yml +2502 -0
  52. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_application/x-turtle_.yml +2502 -0
  53. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_text/n3_.yml +2502 -0
  54. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_text/rdf_n3_.yml +2502 -0
  55. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_text/rdf_turtle_.yml +2502 -0
  56. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_text/turtle_.yml +2502 -0
  57. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_content_type_text/x-nquads_.yml +2502 -0
  58. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_optional_content_type_parameter.yml +2502 -0
  59. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_content_type/requests_an_open_annotation_by_ID_with_turtle_content_type_parameter.yml +2502 -0
  60. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_no_content_type/checks_the_annotation_ID.yml +2561 -0
  61. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_no_content_type/logs_exceptions.yml +2502 -0
  62. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_no_content_type/raises_an_argument_error_with_a_nil_ID.yml +2502 -0
  63. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_no_content_type/raises_an_argument_error_with_an_empty_string_ID.yml +2502 -0
  64. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_no_content_type/raises_an_argument_error_with_an_integer_ID.yml +2502 -0
  65. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_no_content_type/returns_an_EMPTY_RDF_graph_for_a_500_server_response.yml +2502 -0
  66. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_no_content_type/returns_an_EMPTY_RDF_graph_with_a_valid_ID_for_NO_annotation_on_the_server.yml +3623 -0
  67. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/with_no_content_type/returns_an_RDF_graph_with_a_valid_ID_for_an_annotation_on_the_server.yml +4946 -0
  68. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/without_content_type/checks_the_annotation_ID.yml +2502 -0
  69. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/without_content_type/logs_exceptions.yml +2502 -0
  70. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/without_content_type/raises_an_argument_error_with_a_nil_ID.yml +2502 -0
  71. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/without_content_type/raises_an_argument_error_with_an_empty_string_ID.yml +2502 -0
  72. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/without_content_type/raises_an_argument_error_with_an_integer_ID.yml +2502 -0
  73. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/without_content_type/requests_an_open_annotation_by_ID_accepting_a_default_JSON-LD_content.yml +2502 -0
  74. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/without_content_type/returns_an_EMPTY_RDF_graph_for_a_500_server_response.yml +2502 -0
  75. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/without_content_type/returns_an_EMPTY_RDF_graph_with_a_valid_ID_for_NO_annotation_on_the_server.yml +3328 -0
  76. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_annotation/without_content_type/returns_an_RDF_graph_with_a_valid_ID_for_an_annotation_on_the_server.yml +4946 -0
  77. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_iiif_annotation/requests_an_open_annotation_by_ID_using_a_IIIF_profile.yml +2746 -0
  78. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_iiif_annotation/returns_an_RDF_Graph_of_an_open_annotation.yml +2746 -0
  79. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_oa_annotation/requests_an_open_annotation_by_ID_using_an_OA_profile.yml +4946 -0
  80. data/spec/fixtures/vcr_cassettes/TriannonClient/GET_annotation_by_ID_/_get_oa_annotation/returns_an_RDF_Graph_of_an_open_annotation.yml +4946 -0
  81. data/spec/fixtures/vcr_cassettes/TriannonClient/_delete_annotation/deletes_an_open_annotation_that_exists.yml +2548 -0
  82. data/spec/fixtures/vcr_cassettes/TriannonClient/_delete_annotation/fails_to_delete_an_open_annotation_that_does_NOT_exist.yml +123 -0
  83. data/spec/fixtures/vcr_cassettes/TriannonClient/_delete_annotation/returns_false_for_a_500_response_to_a_DELETE_request.yml +64 -0
  84. data/spec/fixtures/vcr_cassettes/TriannonClient/_delete_annotation/returns_true_for_a_200_response_to_a_DELETE_request.yml +64 -0
  85. data/spec/fixtures/vcr_cassettes/TriannonClient/_delete_annotation/returns_true_for_a_202_response_to_a_DELETE_request.yml +64 -0
  86. data/spec/fixtures/vcr_cassettes/TriannonClient/_delete_annotation/returns_true_for_a_204_response_to_a_DELETE_request.yml +64 -0
  87. data/spec/fixtures/vcr_cassettes/TriannonClient/_delete_annotation/validates_the_annotation_ID.yml +64 -0
  88. data/spec/fixtures/vcr_cassettes/TriannonClient/_get_annotations/returns_an_RDF_Graph.yml +295 -0
  89. data/spec/fixtures/vcr_cassettes/TriannonClient/_get_annotations/returns_an_RDF_Graph_that_contains_an_AnnotationList.yml +295 -0
  90. data/spec/fixtures/vcr_cassettes/TriannonClient/_get_annotations/returns_an_annotation_list_with_an_annotation_created_by_a_prior_POST.yml +2795 -0
  91. data/spec/fixtures/vcr_cassettes/TriannonClient/_post_annotation/does_not_raise_an_error_when_submitting_a_valid_open_annotation.yml +2502 -0
  92. data/spec/fixtures/vcr_cassettes/TriannonClient/_post_annotation/returns_a_RestClient_Response_object.yml +2502 -0
  93. data/spec/fixtures/vcr_cassettes/TriannonClient/response_processing_utilities/_annotation_id/returns_a_String_ID_from_the_RDF_URI_of_an_annotation.yml +2502 -0
  94. data/spec/fixtures/vcr_cassettes/TriannonClient/response_processing_utilities/_annotation_id/returns_a_String_ID_that_is_not_empty.yml +2502 -0
  95. data/spec/fixtures/vcr_cassettes/TriannonClient/response_processing_utilities/_annotation_uri/returns_an_RDF_URI_from_an_RDF_Graph_of_an_annotation.yml +2502 -0
  96. data/spec/fixtures/vcr_cassettes/TriannonClient/response_processing_utilities/_annotation_uri/returns_an_RDF_URI_that_is_a_valid_URI.yml +2550 -0
  97. data/spec/fixtures/vcr_cassettes/TriannonClient/response_processing_utilities/_response2graph/accepts_a_RestClient_Response_instance.yml +4898 -0
  98. data/spec/fixtures/vcr_cassettes/TriannonClient/response_processing_utilities/_response2graph/raises_ArgumentError_when_given_an_empty_String.yml +2502 -0
  99. data/spec/fixtures/vcr_cassettes/TriannonClient/response_processing_utilities/_response2graph/raises_ArgumentError_when_given_nil.yml +2502 -0
  100. data/spec/fixtures/vcr_cassettes/TriannonClient/response_processing_utilities/_response2graph/returns_an_RDF_Graph.yml +2502 -0
  101. data/spec/lib/triannon-client/triannon_client_spec.rb +502 -0
  102. data/spec/spec_helper.rb +12 -1
  103. data/triannon-client.gemspec +5 -2
  104. metadata +234 -7
  105. data/Gemfile.lock +0 -203
  106. data/lib/triannon-client/triannon-client.rb +0 -135
  107. data/spec/lib/triannon-client/triannon-client_spec.rb +0 -44
@@ -1,135 +0,0 @@
1
-
2
- module TriannonClient
3
-
4
- class TriannonClient
5
-
6
- @@config = nil
7
-
8
- attr_accessor :site
9
-
10
- def initialize
11
- # Configure triannon-app service
12
- @@config ||= ::TriannonClient.configuration
13
- @site = RestClient::Resource.new(
14
- @@config.host,
15
- :user => @@config.user,
16
- :password => @@config.pass,
17
- :open_timeout => 5, #seconds
18
- :read_timeout => 20, #seconds
19
- )
20
- end
21
-
22
- # Delete an annotation
23
- # @param iri [String] HTTP URL for a triannon annotation
24
- # @response [true|false] true when successful
25
- def delete_annotation(iri)
26
- uri = RDF::URI.parse(iri)
27
- response = @site[uri.path].delete
28
- [200, 202, 204].include? response.code
29
- end
30
-
31
- # @param oa [JSON-LD] a json-ld object with an open annotation context
32
- # @return response [RestClient::Response|nil]
33
- def post_annotation(oa)
34
- post_data = {
35
- "commit" => "Create Annotation",
36
- "annotation" => {"data" => oa}
37
- }
38
- response = nil
39
- tries = 0
40
- begin
41
- tries += 1
42
- response = @site["/annotations/"].post post_data, :content_type => :json
43
- rescue => e
44
- sleep 1*tries
45
- retry if tries < 3
46
- binding.pry if @@config.debug
47
- @@config.logger.error("Failed to POST annotation: #{e.message}")
48
- end
49
- return response
50
- end
51
-
52
- # Get a list of annotations
53
- # @param content_type [String] HTTP accept header value for content type negotiation
54
- # @response [RDF::Graph|RestClient::Response] RDF::Graph when content_type is not specified
55
- def get_annotations(content_type=nil)
56
- if content_type.nil?
57
- get("#{@site.url}/annotations")
58
- else
59
- get("/annotations", content_type)
60
- end
61
- end
62
-
63
- # Get an annotation (with a default annotation context)
64
- # @param id [String] String representation of an annotation URI
65
- # @param content_type [String] HTTP accept header value for content type negotiation
66
- # @response [RDF::Graph|RestClient::Response] RDF::Graph when content_type is not specified
67
- def get_annotation(id, content_type=nil)
68
- if content_type.nil?
69
- get("#{@site.url}/annotations/#{id}")
70
- else
71
- get("/annotations/#{id}", content_type)
72
- end
73
- end
74
-
75
- # Get an annotation with a IIIF context
76
- # @param id [String] String representation of an annotation URI
77
- # @param content_type [String] HTTP accept header value for content type negotiation
78
- # @response [RDF::Graph|RestClient::Response] RDF::Graph when content_type is not specified
79
- def get_iiif_annotation(id, content_type=nil)
80
- if content_type.nil?
81
- get("#{@site.url}/annotations/iiif/#{id}")
82
- else
83
- get("/annotations/iiif/#{id}", content_type)
84
- end
85
- end
86
-
87
- # Get an annotation with an open annotation context
88
- # @param id [String] String representation of an annotation URI
89
- # @param content_type [String] HTTP accept header value for content type negotiation
90
- # @response [RDF::Graph|RestClient::Response] RDF::Graph when content_type is not specified
91
- def get_oa_annotation(id, content_type=nil)
92
- if content_type.nil?
93
- get("#{@site.url}/annotations/oa/#{id}")
94
- else
95
- get("/annotations/oa/#{id}", content_type)
96
- end
97
- end
98
-
99
-
100
- private
101
-
102
- # GET annotations and annotation
103
- #
104
- # use HTTP Accept header with mime type to indicate desired
105
- # format ** default: jsonld ** also supports turtle, rdfxml, html
106
- # ** see https://github.com/sul-dlss/triannon/blob/master/app/controllers/triannon/annotations_controller.rb #show method for mime formats accepted
107
- #
108
- # JSON-LD context
109
- #
110
- # You can request IIIF or OA context for jsonld. You can use either of
111
- # these methods (with the correct HTTP Accept header):
112
- #
113
- # GET: http://(host)/annotations/iiif/(anno_id)
114
- # GET: http://(host)/annotations/(anno_id)?jsonld_context=iiif
115
- #
116
- # GET: http://(host)/annotations/oa/(anno_id)
117
- # GET: http://(host)/annotations/(anno_id)?jsonld_context=oa
118
- #
119
- # Note that OA (Open Annotation) is the default context if none is specified.
120
-
121
- def get(uri, content_type=nil)
122
- if content_type.nil?
123
- # try to get an RDF graph, let RDF.rb do content negotiation
124
- RDF::Graph.load(uri)
125
- else
126
- # content_type options should include: :html, :xml, :rdf, :json
127
- content_type = content_type.to_sym
128
- @site[uri].get({:accept => content_type})
129
- end
130
- end
131
-
132
- end
133
-
134
- end
135
-
@@ -1,44 +0,0 @@
1
- require 'spec_helper'
2
-
3
- # ::TriannonClient::TriannonClient class specs
4
-
5
- describe TriannonClient do
6
-
7
- describe "#delete_annotation" do
8
- it 'should DELETE an open annotation' do
9
- #TODO
10
- end
11
- end
12
-
13
- describe "#get_annotations" do
14
- it 'should get a list of open annotations' do
15
- #TODO
16
- end
17
- end
18
-
19
- describe "#get_annotation" do
20
- it 'should get an open annotation by URI' do
21
- #TODO
22
- end
23
- end
24
-
25
- describe "#get_iiif_annotation" do
26
- it 'should get an open annotation by URI, with IIIF context' do
27
- #TODO
28
- end
29
- end
30
-
31
- describe "#get_oa_annotation" do
32
- it 'should get an open annotation by URI, with OA context' do
33
- #TODO
34
- end
35
- end
36
-
37
- describe "#post_annotation" do
38
- it 'should POST an open annotation' do
39
- #TODO
40
- end
41
- end
42
-
43
- end
44
-