qa 5.7.0 → 5.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +8 -3
- data/app/controllers/qa/terms_controller.rb +26 -24
- data/app/services/qa/linked_data/graph_service.rb +1 -1
- data/app/services/qa/pagination_service.rb +586 -0
- data/config/initializers/mime_types.rb +4 -0
- data/lib/qa/authorities/assign_fast/generic_authority.rb +2 -0
- data/lib/qa/authorities/crossref/generic_authority.rb +1 -0
- data/lib/qa/authorities/discogs/generic_authority.rb +1 -0
- data/lib/qa/authorities/geonames.rb +1 -1
- data/lib/qa/authorities/linked_data/config.rb +2 -2
- data/lib/qa/authorities/linked_data/find_term.rb +9 -3
- data/lib/qa/authorities/linked_data/generic_authority.rb +1 -0
- data/lib/qa/authorities/loc/generic_authority.rb +1 -0
- data/lib/qa/authorities/local/file_based_authority.rb +1 -0
- data/lib/qa/authorities/local/registry.rb +1 -3
- data/lib/qa/authorities/local/table_based_authority.rb +1 -0
- data/lib/qa/authorities/local.rb +2 -4
- data/lib/qa/authorities/mesh_tools/mesh_data_parser.rb +3 -1
- data/lib/qa/authorities/oclcts/generic_oclc_authority.rb +2 -1
- data/lib/qa/version.rb +1 -1
- data/spec/controllers/terms_controller_spec.rb +74 -1
- data/spec/lib/authorities/getty/aat_spec.rb +4 -1
- data/spec/lib/authorities/getty/tgn_spec.rb +4 -1
- data/spec/lib/authorities/getty/ulan_spec.rb +4 -1
- data/spec/services/pagination_service_spec.rb +682 -0
- data/spec/spec_helper.rb +0 -14
- data/spec/test_app_templates/Gemfile.extra +13 -0
- metadata +147 -145
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f4e4d8c917617e8cba95cd8bc8e0f06ebb60c9b580672b3736c717ef1ce3746
|
4
|
+
data.tar.gz: bd9624a47e0c513d8b7fdf7a278d2c904867b3331217faaf7951321326f7549d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a6f568c19f5aad67ca850bf0d666afd63f971b7bbab83e51b4299791b52c94e93fcae9e49a9ff6aec4d2e8329cf1b41ab39131fa8dc3e0eb0baec5725934499b
|
7
|
+
data.tar.gz: 69d1bed451753f68ae20551aa1ac2a77e8acbfffeb2600e42d50726d113f28300c01faaf74af9b65dcfc5a168410019fb99bc84b09928b9846b466fd20fc9e63
|
data/README.md
CHANGED
@@ -152,9 +152,14 @@ If you're working on PR for this project, create a feature branch off of `main`.
|
|
152
152
|
This repository follows the [Samvera Community Code of Conduct](https://samvera.atlassian.net/wiki/spaces/samvera/pages/405212316/Code+of+Conduct) and [language recommendations](https://github.com/samvera/maintenance/blob/main/templates/CONTRIBUTING.md#language). Please ***do not*** create a branch called `master` for this repository or as part of your pull request; the branch will either need to be removed or renamed before it can be considered for inclusion in the code base and history of this repository.
|
153
153
|
|
154
154
|
## Compatibility
|
155
|
-
|
156
|
-
-
|
157
|
-
-
|
155
|
+
This gem works with Rails 5.0-6.1 and Ruby 2.5-3.1, provided the version of Rails supports the version of Ruby.
|
156
|
+
- Consult `.circleci/config.yml` for a list of supported combinations.
|
157
|
+
- The combination of Ruby 3.1 and Rails 6.0 comes with three caveats:
|
158
|
+
- your app will not be able to use `psych 4` (which ordinarily comes with 3.1). See https://bugs.ruby-lang.org/issues/17866 and https://stackoverflow.com/questions/71191685/visit-psych-nodes-alias-unknown-alias-default-psychbadalias/71192990#71192990 for an explanation. One workaround is to modify your app's `Gemfile` to hold back `psych`: `gem 'psych', '< 4'`.
|
159
|
+
- likewise, you want to add gem 'net-smtp', require: false to your Gemfile to get around the bug described in https://stackoverflow.com/questions/70500220/rails-7-ruby-3-1-loaderror-cannot-load-such-file-net-smtp .
|
160
|
+
- finally, you may want to opt in to the latest version of "mail". Again, add to your Gemfile the line `gem "mail", ">= 2.8.0.rc1"`.
|
161
|
+
|
162
|
+
See also `.circleci/config.yml` and `spec/test_app_templates/Gemfile.extra`.
|
158
163
|
|
159
164
|
## Product Owner & Maintenance
|
160
165
|
|
@@ -4,6 +4,9 @@
|
|
4
4
|
# same methods.
|
5
5
|
|
6
6
|
class Qa::TermsController < ::ApplicationController
|
7
|
+
class_attribute :pagination_service_class
|
8
|
+
self.pagination_service_class = Qa::PaginationService
|
9
|
+
|
7
10
|
before_action :check_vocab_param, :init_authority
|
8
11
|
before_action :check_query_param, only: :search
|
9
12
|
|
@@ -23,7 +26,11 @@ class Qa::TermsController < ::ApplicationController
|
|
23
26
|
def search
|
24
27
|
terms = @authority.method(:search).arity == 2 ? @authority.search(url_search, self) : @authority.search(url_search)
|
25
28
|
cors_allow_origin_header(response)
|
26
|
-
|
29
|
+
respond_to do |wants|
|
30
|
+
wants.json { render json: pagination_service(format: :json, results: terms).build_response }
|
31
|
+
wants.jsonapi { render json: pagination_service(format: :jsonapi, results: terms).build_response }
|
32
|
+
wants.any { render json: pagination_service(format: :json, results: terms).build_response, content_type: json_content_type }
|
33
|
+
end
|
27
34
|
end
|
28
35
|
|
29
36
|
# If the subauthority supports it, return all the information for a given term
|
@@ -31,7 +38,13 @@ class Qa::TermsController < ::ApplicationController
|
|
31
38
|
def show
|
32
39
|
term = @authority.method(:find).arity == 2 ? @authority.find(params[:id], self) : @authority.find(params[:id])
|
33
40
|
cors_allow_origin_header(response)
|
34
|
-
|
41
|
+
respond_to do |wants|
|
42
|
+
wants.json { render json: term }
|
43
|
+
wants.n3 { render json: term }
|
44
|
+
wants.jsonld { render json: term }
|
45
|
+
wants.ntriples { render json: term }
|
46
|
+
wants.any { render json: term, content_type: json_content_type }
|
47
|
+
end
|
35
48
|
end
|
36
49
|
|
37
50
|
# If the subauthority supports it, return all the information for a given term
|
@@ -39,7 +52,13 @@ class Qa::TermsController < ::ApplicationController
|
|
39
52
|
def fetch
|
40
53
|
term = @authority.method(:find).arity == 2 ? @authority.find(params[:uri], self) : @authority.find(params[:uri])
|
41
54
|
cors_allow_origin_header(response)
|
42
|
-
|
55
|
+
respond_to do |wants|
|
56
|
+
wants.json { render json: term }
|
57
|
+
wants.n3 { render json: term }
|
58
|
+
wants.jsonld { render json: term }
|
59
|
+
wants.ntriples { render json: term }
|
60
|
+
wants.any { render json: term, content_type: json_content_type }
|
61
|
+
end
|
43
62
|
end
|
44
63
|
|
45
64
|
def check_vocab_param
|
@@ -90,28 +109,11 @@ class Qa::TermsController < ::ApplicationController
|
|
90
109
|
params[:q].gsub("*", "%2A")
|
91
110
|
end
|
92
111
|
|
93
|
-
def
|
94
|
-
|
95
|
-
return 'json' if params[:format].blank?
|
96
|
-
params[:format]
|
97
|
-
end
|
98
|
-
|
99
|
-
def jsonld?
|
100
|
-
format.casecmp?('jsonld')
|
101
|
-
end
|
102
|
-
|
103
|
-
def n3?
|
104
|
-
format.casecmp?('n3')
|
105
|
-
end
|
106
|
-
|
107
|
-
def ntriples?
|
108
|
-
format.casecmp?('ntriples')
|
112
|
+
def json_content_type
|
113
|
+
Mime::Type.lookup_by_extension(:json).to_str
|
109
114
|
end
|
110
115
|
|
111
|
-
def
|
112
|
-
|
113
|
-
return 'text/n3' if n3?
|
114
|
-
return 'application/n-triples' if ntriples?
|
115
|
-
'application/json'
|
116
|
+
def pagination_service(results:, format:)
|
117
|
+
pagination_service_class.new(request: request, results: results, format: format)
|
116
118
|
end
|
117
119
|
end
|