qa 5.11.0 → 5.13.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/qa/authorities/assign_fast/generic_authority.rb +4 -1
- data/lib/qa/authorities/getty/aat.rb +1 -1
- data/lib/qa/authorities/getty/aat2.rb +1 -1
- data/lib/qa/version.rb +1 -1
- data/spec/controllers/terms_controller_spec.rb +1 -1
- data/spec/lib/authorities/assign_fast_spec.rb +22 -15
- data/spec/lib/authorities/getty/aat_spec.rb +1 -1
- data/spec/lib/authorities/getty/tgn_spec.rb +1 -1
- data/spec/lib/authorities/getty/ulan_spec.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c2bc5171a4ed527a81eb174b2e5e7f0e99d86c2df285c2619d415ec4587af84
|
4
|
+
data.tar.gz: 8fd957474f3f185867025fb18e08d4262e207ae051bca57bc43eaac10bc7b097
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54cc9b6d0289157de648f34c040355eb06f206ca0d616664d96e6ae3d3e5e754e950c447127d61cf16f6d3f15f874fd65d23845d1f912ce89c3e1571875a9d8e
|
7
|
+
data.tar.gz: 44e459c8a7424a8116f075979fa7ce2023b5307edb48c2a044cfdea5e5239435b8a85375687a9f2a51b7c63af60e2435bf27769043c9fa8be1de9d0f98c8fe9e
|
@@ -46,7 +46,10 @@ module Qa::Authorities
|
|
46
46
|
index = AssignFast.index_for_authority(subauthority)
|
47
47
|
return_data = "#{index}%2Cidroot%2Cauth%2Ctype"
|
48
48
|
num_rows = 20 # max allowed by the API
|
49
|
-
|
49
|
+
|
50
|
+
# sort=usage+desc is not documented by OCLC but seems necessary to get the sort
|
51
|
+
# we formerly got without specifying, that is most useful in our use case.
|
52
|
+
"http://fast.oclc.org/searchfast/fastsuggest?&query=#{escaped_query}&queryIndex=#{index}&queryReturn=#{return_data}&suggest=autoSubject&rows=#{num_rows}&sort=usage+desc"
|
50
53
|
end
|
51
54
|
|
52
55
|
private
|
@@ -54,7 +54,7 @@ module Qa::Authorities
|
|
54
54
|
end
|
55
55
|
rescue StandardError => e
|
56
56
|
cause = response.fetch('error', {}).fetch('cause', 'UNKNOWN')
|
57
|
-
cause = cause.
|
57
|
+
cause = cause.presence || 'UNKNOWN'
|
58
58
|
Rails.logger.warn " ERROR fetching Getty response: #{e.message}; cause: #{cause}"
|
59
59
|
{}
|
60
60
|
end
|
@@ -54,7 +54,7 @@ module Qa::Authorities
|
|
54
54
|
end
|
55
55
|
rescue StandardError => e
|
56
56
|
cause = response.fetch('error', {}).fetch('cause', 'UNKNOWN')
|
57
|
-
cause = cause.
|
57
|
+
cause = cause.presence || 'UNKNOWN'
|
58
58
|
Rails.logger.warn " ERROR fetching Getty response: #{e.message}; cause: #{cause}"
|
59
59
|
{}
|
60
60
|
end
|
data/lib/qa/version.rb
CHANGED
@@ -199,7 +199,7 @@ describe Qa::TermsController, type: :controller do
|
|
199
199
|
|
200
200
|
context "assign_fast" do
|
201
201
|
before do
|
202
|
-
stub_request(:get, "http://fast.oclc.org/searchfast/fastsuggest?query=word&queryIndex=suggest50&queryReturn=suggest50,idroot,auth,type&rows=20&suggest=autoSubject")
|
202
|
+
stub_request(:get, "http://fast.oclc.org/searchfast/fastsuggest?query=word&queryIndex=suggest50&queryReturn=suggest50,idroot,auth,type&rows=20&suggest=autoSubject&sort=usage+desc")
|
203
203
|
.with(headers: { 'Accept' => 'application/json' })
|
204
204
|
.to_return(body: webmock_fixture("assign-fast-topical-result.json"), status: 200, headers: {})
|
205
205
|
end
|
@@ -1,6 +1,9 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Qa::Authorities::AssignFast do
|
4
|
+
let(:query) { "word (ling" }
|
5
|
+
let(:expected_url) { "http://fast.oclc.org/searchfast/fastsuggest?&query=word%20ling&queryIndex=suggestall&queryReturn=suggestall%2Cidroot%2Cauth%2Ctype&suggest=autoSubject&rows=20&sort=usage+desc" }
|
6
|
+
|
4
7
|
# subauthority infrastructure
|
5
8
|
describe "#new" do
|
6
9
|
context "without a sub-authority" do
|
@@ -30,8 +33,7 @@ describe Qa::Authorities::AssignFast do
|
|
30
33
|
end
|
31
34
|
|
32
35
|
it "is correctly formed" do
|
33
|
-
|
34
|
-
expect(authority.build_query_url("word (ling")).to eq(url)
|
36
|
+
expect(authority.build_query_url(query)).to eq(expected_url)
|
35
37
|
end
|
36
38
|
end
|
37
39
|
|
@@ -43,27 +45,29 @@ describe Qa::Authorities::AssignFast do
|
|
43
45
|
context "when we sent a bad character" do
|
44
46
|
# server returns 200 with empty response; JSON throws a ParserError
|
45
47
|
before do
|
46
|
-
stub_request(:get,
|
48
|
+
stub_request(:get, expected_url)
|
47
49
|
.with(headers: { 'Accept' => 'application/json' })
|
48
50
|
.to_return(status: 200, body: "", headers: {})
|
49
51
|
end
|
50
52
|
it "logs an info and returns an empty array" do
|
51
|
-
expect(Rails.logger).to receive(:info).with(
|
52
|
-
msg = "Could not parse response as JSON. Request url: "
|
53
|
-
"http://fast.oclc.org/searchfast/fastsuggest?&query=word%20ling&queryIndex=suggestall&queryReturn=suggestall%2Cidroot%2Cauth%2Ctype&suggest=autoSubject&rows=20"
|
53
|
+
expect(Rails.logger).to receive(:info).with("Retrieving json for url: #{expected_url}")
|
54
|
+
msg = "Could not parse response as JSON. Request url: #{expected_url}"
|
54
55
|
expect(Rails.logger).to receive(:info).with(msg)
|
55
|
-
results = authority.search(
|
56
|
+
results = authority.search(query)
|
56
57
|
expect(results).to eq([])
|
57
58
|
end
|
58
59
|
end
|
59
60
|
|
60
61
|
context "when query is blank" do
|
62
|
+
let(:query) { "" }
|
63
|
+
let(:expected_url) { "http://fast.oclc.org/searchfast/fastsuggest?&query=&queryIndex=suggestall&queryReturn=suggestall%2Cidroot%2Cauth%2Ctype&suggest=autoSubject&rows=20&sort=usage+desc" }
|
64
|
+
|
61
65
|
# server returns results but no results header
|
62
66
|
let :results do
|
63
|
-
stub_request(:get,
|
67
|
+
stub_request(:get, expected_url)
|
64
68
|
.with(headers: { 'Accept' => 'application/json' })
|
65
69
|
.to_return(body: webmock_fixture("assign-fast-noheader.json"), status: 200, headers: {})
|
66
|
-
authority.search(
|
70
|
+
authority.search(query)
|
67
71
|
end
|
68
72
|
it "returns an empty array" do
|
69
73
|
expect(results).to eq([])
|
@@ -72,10 +76,10 @@ describe Qa::Authorities::AssignFast do
|
|
72
76
|
|
73
77
|
context "with no results" do
|
74
78
|
let :results do
|
75
|
-
stub_request(:get,
|
79
|
+
stub_request(:get, expected_url)
|
76
80
|
.with(headers: { 'Accept' => 'application/json' })
|
77
81
|
.to_return(body: webmock_fixture("assign-fast-noresults.json"), status: 200, headers: {})
|
78
|
-
authority.search(
|
82
|
+
authority.search(query)
|
79
83
|
end
|
80
84
|
it "returns an empty array" do
|
81
85
|
expect(results).to eq([])
|
@@ -84,10 +88,10 @@ describe Qa::Authorities::AssignFast do
|
|
84
88
|
|
85
89
|
context "with suggestall results" do
|
86
90
|
let :results do
|
87
|
-
stub_request(:get,
|
91
|
+
stub_request(:get, expected_url)
|
88
92
|
.with(headers: { 'Accept' => 'application/json' })
|
89
93
|
.to_return(body: webmock_fixture("assign-fast-oneresult.json"), status: 200, headers: {})
|
90
|
-
authority.search(
|
94
|
+
authority.search(query)
|
91
95
|
end
|
92
96
|
it "is correctly parsed" do
|
93
97
|
expect(results.count).to eq(1)
|
@@ -99,11 +103,14 @@ describe Qa::Authorities::AssignFast do
|
|
99
103
|
end
|
100
104
|
|
101
105
|
context "with topical results" do
|
106
|
+
let(:query) { "word" }
|
107
|
+
let(:expected_url) { "http://fast.oclc.org/searchfast/fastsuggest?query=word&queryIndex=suggest50&queryReturn=suggest50,idroot,auth,type&rows=20&suggest=autoSubject&sort=usage+desc" }
|
108
|
+
|
102
109
|
let :results do
|
103
|
-
stub_request(:get,
|
110
|
+
stub_request(:get, expected_url)
|
104
111
|
.with(headers: { 'Accept' => 'application/json' })
|
105
112
|
.to_return(body: webmock_fixture("assign-fast-topical-result.json"), status: 200, headers: {})
|
106
|
-
described_class.subauthority_for("topical").search(
|
113
|
+
described_class.subauthority_for("topical").search(query)
|
107
114
|
end
|
108
115
|
it "is correctly parsed" do
|
109
116
|
expect(results.count).to eq(20)
|
@@ -38,7 +38,7 @@ describe Qa::Authorities::Getty::AAT do
|
|
38
38
|
# Rails 3.1 actually quotes the failing code in the error message,
|
39
39
|
# so let's match this error message with a multiline regex instead of
|
40
40
|
# a string.
|
41
|
-
expect(Rails.logger).to receive(:warn).with(/ERROR fetching Getty response: .*undefined method.*for nil
|
41
|
+
expect(Rails.logger).to receive(:warn).with(/ERROR fetching Getty response: .*undefined method.*for nil.*; cause: UNKNOWN/m)
|
42
42
|
expect(subject).to be {}
|
43
43
|
end
|
44
44
|
end
|
@@ -38,7 +38,7 @@ describe Qa::Authorities::Getty::TGN do
|
|
38
38
|
# Rails 3.1 actually quotes the failing code in the error message,
|
39
39
|
# so let's match this error message with a multiline regex instead of
|
40
40
|
# a string.
|
41
|
-
expect(Rails.logger).to receive(:warn).with(/ERROR fetching Getty response: .*undefined method.*for nil
|
41
|
+
expect(Rails.logger).to receive(:warn).with(/ERROR fetching Getty response: .*undefined method.*for nil.*; cause: UNKNOWN/m)
|
42
42
|
expect(subject).to be {}
|
43
43
|
end
|
44
44
|
end
|
@@ -38,7 +38,7 @@ describe Qa::Authorities::Getty::Ulan do
|
|
38
38
|
# Rails 3.1 actually quotes the failing code in the error message,
|
39
39
|
# so let's match this error message with a multiline regex instead of
|
40
40
|
# a string.
|
41
|
-
expect(Rails.logger).to receive(:warn).with(/ERROR fetching Getty response: .*undefined method.*for nil
|
41
|
+
expect(Rails.logger).to receive(:warn).with(/ERROR fetching Getty response: .*undefined method.*for nil.*; cause: UNKNOWN/m)
|
42
42
|
expect(subject).to be {}
|
43
43
|
end
|
44
44
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.
|
4
|
+
version: 5.13.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen Anderson
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
autorequire:
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
|
-
date:
|
19
|
+
date: 2024-08-20 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: activerecord-import
|
@@ -117,7 +117,7 @@ dependencies:
|
|
117
117
|
version: '5.0'
|
118
118
|
- - "<"
|
119
119
|
- !ruby/object:Gem::Version
|
120
|
-
version: '
|
120
|
+
version: '8.0'
|
121
121
|
type: :runtime
|
122
122
|
prerelease: false
|
123
123
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -127,7 +127,7 @@ dependencies:
|
|
127
127
|
version: '5.0'
|
128
128
|
- - "<"
|
129
129
|
- !ruby/object:Gem::Version
|
130
|
-
version: '
|
130
|
+
version: '8.0'
|
131
131
|
- !ruby/object:Gem::Dependency
|
132
132
|
name: rdf
|
133
133
|
requirement: !ruby/object:Gem::Requirement
|