qa-ldf 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +15 -0
  3. data/.rubocop.yml +21 -0
  4. data/.travis.yml +15 -0
  5. data/.yardopts +9 -0
  6. data/CONTRIBUTING.md +109 -0
  7. data/Gemfile +18 -0
  8. data/Guardfile +27 -0
  9. data/LICENSE +14 -0
  10. data/README.md +42 -0
  11. data/Rakefile +30 -0
  12. data/VERSION +1 -0
  13. data/config/ldf.yml +15 -0
  14. data/lib/qa/ldf.rb +43 -0
  15. data/lib/qa/ldf/authorities.rb +1 -0
  16. data/lib/qa/ldf/authorities/lc_names.rb +31 -0
  17. data/lib/qa/ldf/authority.rb +104 -0
  18. data/lib/qa/ldf/client.rb +39 -0
  19. data/lib/qa/ldf/configuration.rb +67 -0
  20. data/lib/qa/ldf/empty_search_service.rb +18 -0
  21. data/lib/qa/ldf/json_mapper.rb +35 -0
  22. data/lib/qa/ldf/model.rb +49 -0
  23. data/lib/qa/ldf/spec.rb +3 -0
  24. data/lib/qa/ldf/spec/authority.rb +112 -0
  25. data/lib/qa/ldf/spec/model.rb +9 -0
  26. data/lib/qa/ldf/spec/search_service.rb +30 -0
  27. data/lib/qa/ldf/version.rb +34 -0
  28. data/qa-ldf.gemspec +35 -0
  29. data/spec/contracts/qa_loc_as_search_service_spec.rb +38 -0
  30. data/spec/qa/ldf/authorities/lc_names_spec.rb +52 -0
  31. data/spec/qa/ldf/authority_spec.rb +29 -0
  32. data/spec/qa/ldf/client_spec.rb +23 -0
  33. data/spec/qa/ldf/configuration_spec.rb +93 -0
  34. data/spec/qa/ldf/empty_search_service_spec.rb +11 -0
  35. data/spec/qa/ldf/json_mapper_spec.rb +22 -0
  36. data/spec/qa/ldf/model_spec.rb +53 -0
  37. data/spec/qa/ldf_spec.rb +43 -0
  38. data/spec/spec_helper.rb +18 -0
  39. data/spec/support/cache_server.rb +25 -0
  40. data/spec/support/fake_client.rb +31 -0
  41. data/spec/support/fake_search_service.rb +40 -0
  42. data/spec/support/shared_examples/ld_cache_client.rb +35 -0
  43. metadata +232 -0
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+
3
+ ##
4
+ # A fake version of `Qa::LDF::SearchService`.
5
+ #
6
+ # Configure with a hash of queries and responses to provide behavior.
7
+ #
8
+ # @example
9
+ # service = FakeSearchService.new do |service|
10
+ # service.queries['a query'] =
11
+ # [{ id: 'http://example.com/an_id', key: 'value' }]
12
+ # end
13
+ #
14
+ # service.query('a query')
15
+ # # => [{ id: 'http://example.com/an_id', key: 'value' }]
16
+ #
17
+ class FakeSearchService
18
+ attr_accessor :queries
19
+
20
+ def initialize
21
+ @queries = {}
22
+ yield self if block_given?
23
+ end
24
+
25
+ def search(query)
26
+ queries[query] || {}
27
+ end
28
+ end
29
+
30
+ describe FakeSearchService do
31
+ subject(:search_service) do
32
+ described_class.new { |service| service.queries = searches }
33
+ end
34
+
35
+ subject(:searches) do
36
+ { 'a fake query' => [{ id: 'http://example.com/an_id', key: 'value' }] }
37
+ end
38
+
39
+ it_behaves_like 'an ldf search service'
40
+ end
@@ -0,0 +1,35 @@
1
+ shared_examples 'an ld cache client' do
2
+ before do
3
+ raise 'Must define `uri` via `let(:uri)` to use examples' unless
4
+ defined?(uri)
5
+ raise 'Must define `client` via `let(:client)` to use examples' unless
6
+ defined?(client)
7
+ end
8
+
9
+ define :be_a_graph_with_subject do |expected|
10
+ match do |actual|
11
+ expect(actual).to respond_to :each_statement
12
+ expect(actual).to respond_to :query
13
+ expect(actual).to have_subject RDF::URI(expected)
14
+ end
15
+ end
16
+
17
+ describe '#get' do
18
+ it 'gives a graph with the subject' do
19
+ expect(client.get(uri: uri)).to be_a_graph_with_subject RDF::URI(uri)
20
+ end
21
+
22
+ it 'adds to the root dataset'
23
+
24
+ context 'when passing a named dataset' do
25
+ let(:dataset) { 'viaf' }
26
+
27
+ it 'gives a graph with the subject' do
28
+ expect(client.get(uri: uri, dataset: dataset))
29
+ .to be_a_graph_with_subject RDF::URI(uri)
30
+ end
31
+
32
+ it 'adds to the named dataset'
33
+ end
34
+ end
35
+ end
metadata ADDED
@@ -0,0 +1,232 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: qa-ldf
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Tom Johnson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2017-02-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: qa
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: 0.11.0
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: 0.11.0
27
+ - !ruby/object:Gem::Dependency
28
+ name: guard
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.14'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.14'
41
+ - !ruby/object:Gem::Dependency
42
+ name: ld_cache_fragment
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.1'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.1'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rake
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '12.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '12.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.5'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.5'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop-rspec
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: 1.10.0
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: 1.10.0
97
+ - !ruby/object:Gem::Dependency
98
+ name: sham_rack
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '1.4'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '1.4'
111
+ - !ruby/object:Gem::Dependency
112
+ name: webmock
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '2.3'
118
+ - - ">="
119
+ - !ruby/object:Gem::Version
120
+ version: 2.3.2
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - "~>"
126
+ - !ruby/object:Gem::Version
127
+ version: '2.3'
128
+ - - ">="
129
+ - !ruby/object:Gem::Version
130
+ version: 2.3.2
131
+ - !ruby/object:Gem::Dependency
132
+ name: yard
133
+ requirement: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ type: :development
139
+ prerelease: false
140
+ version_requirements: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '0'
145
+ description: Questioning Authority cached with a Linked Data Fragment.
146
+ email:
147
+ - tom@curationexperts.com
148
+ executables: []
149
+ extensions: []
150
+ extra_rdoc_files: []
151
+ files:
152
+ - ".gitignore"
153
+ - ".rubocop.yml"
154
+ - ".travis.yml"
155
+ - ".yardopts"
156
+ - CONTRIBUTING.md
157
+ - Gemfile
158
+ - Guardfile
159
+ - LICENSE
160
+ - README.md
161
+ - Rakefile
162
+ - VERSION
163
+ - config/ldf.yml
164
+ - lib/qa/ldf.rb
165
+ - lib/qa/ldf/authorities.rb
166
+ - lib/qa/ldf/authorities/lc_names.rb
167
+ - lib/qa/ldf/authority.rb
168
+ - lib/qa/ldf/client.rb
169
+ - lib/qa/ldf/configuration.rb
170
+ - lib/qa/ldf/empty_search_service.rb
171
+ - lib/qa/ldf/json_mapper.rb
172
+ - lib/qa/ldf/model.rb
173
+ - lib/qa/ldf/spec.rb
174
+ - lib/qa/ldf/spec/authority.rb
175
+ - lib/qa/ldf/spec/model.rb
176
+ - lib/qa/ldf/spec/search_service.rb
177
+ - lib/qa/ldf/version.rb
178
+ - qa-ldf.gemspec
179
+ - spec/contracts/qa_loc_as_search_service_spec.rb
180
+ - spec/qa/ldf/authorities/lc_names_spec.rb
181
+ - spec/qa/ldf/authority_spec.rb
182
+ - spec/qa/ldf/client_spec.rb
183
+ - spec/qa/ldf/configuration_spec.rb
184
+ - spec/qa/ldf/empty_search_service_spec.rb
185
+ - spec/qa/ldf/json_mapper_spec.rb
186
+ - spec/qa/ldf/model_spec.rb
187
+ - spec/qa/ldf_spec.rb
188
+ - spec/spec_helper.rb
189
+ - spec/support/cache_server.rb
190
+ - spec/support/fake_client.rb
191
+ - spec/support/fake_search_service.rb
192
+ - spec/support/shared_examples/ld_cache_client.rb
193
+ homepage: http://github.com/curationexperts/qa-ldf
194
+ licenses:
195
+ - Apache-2.0
196
+ metadata: {}
197
+ post_install_message:
198
+ rdoc_options: []
199
+ require_paths:
200
+ - lib
201
+ required_ruby_version: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - ">="
204
+ - !ruby/object:Gem::Version
205
+ version: 2.2.2
206
+ required_rubygems_version: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: '0'
211
+ requirements: []
212
+ rubyforge_project:
213
+ rubygems_version: 2.6.8
214
+ signing_key:
215
+ specification_version: 4
216
+ summary: Provides a bridge between questioning authority and a caching linked data
217
+ fragment for URI authorities.
218
+ test_files:
219
+ - spec/contracts/qa_loc_as_search_service_spec.rb
220
+ - spec/qa/ldf/authorities/lc_names_spec.rb
221
+ - spec/qa/ldf/authority_spec.rb
222
+ - spec/qa/ldf/client_spec.rb
223
+ - spec/qa/ldf/configuration_spec.rb
224
+ - spec/qa/ldf/empty_search_service_spec.rb
225
+ - spec/qa/ldf/json_mapper_spec.rb
226
+ - spec/qa/ldf/model_spec.rb
227
+ - spec/qa/ldf_spec.rb
228
+ - spec/spec_helper.rb
229
+ - spec/support/cache_server.rb
230
+ - spec/support/fake_client.rb
231
+ - spec/support/fake_search_service.rb
232
+ - spec/support/shared_examples/ld_cache_client.rb