Skip to content
This repository was archived by the owner on Jun 18, 2025. It is now read-only.

Commit 5f4c483

Browse files
authored
Merge pull request #292 from sanger/develop
Develop -> Master
2 parents 18086a0 + 09fbb40 commit 5f4c483

File tree

3 files changed

+131
-78
lines changed

3 files changed

+131
-78
lines changed

Gemfile.lock

Lines changed: 80 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -17,52 +17,52 @@ GEM
1717
aasm (5.4.0)
1818
concurrent-ruby (~> 1.0)
1919
ace-rails-ap (4.5)
20-
actioncable (6.1.7.2)
21-
actionpack (= 6.1.7.2)
22-
activesupport (= 6.1.7.2)
20+
actioncable (6.1.7.6)
21+
actionpack (= 6.1.7.6)
22+
activesupport (= 6.1.7.6)
2323
nio4r (~> 2.0)
2424
websocket-driver (>= 0.6.1)
25-
actionmailbox (6.1.7.2)
26-
actionpack (= 6.1.7.2)
27-
activejob (= 6.1.7.2)
28-
activerecord (= 6.1.7.2)
29-
activestorage (= 6.1.7.2)
30-
activesupport (= 6.1.7.2)
25+
actionmailbox (6.1.7.6)
26+
actionpack (= 6.1.7.6)
27+
activejob (= 6.1.7.6)
28+
activerecord (= 6.1.7.6)
29+
activestorage (= 6.1.7.6)
30+
activesupport (= 6.1.7.6)
3131
mail (>= 2.7.1)
32-
actionmailer (6.1.7.2)
33-
actionpack (= 6.1.7.2)
34-
actionview (= 6.1.7.2)
35-
activejob (= 6.1.7.2)
36-
activesupport (= 6.1.7.2)
32+
actionmailer (6.1.7.6)
33+
actionpack (= 6.1.7.6)
34+
actionview (= 6.1.7.6)
35+
activejob (= 6.1.7.6)
36+
activesupport (= 6.1.7.6)
3737
mail (~> 2.5, >= 2.5.4)
3838
rails-dom-testing (~> 2.0)
39-
actionpack (6.1.7.2)
40-
actionview (= 6.1.7.2)
41-
activesupport (= 6.1.7.2)
39+
actionpack (6.1.7.6)
40+
actionview (= 6.1.7.6)
41+
activesupport (= 6.1.7.6)
4242
rack (~> 2.0, >= 2.0.9)
4343
rack-test (>= 0.6.3)
4444
rails-dom-testing (~> 2.0)
4545
rails-html-sanitizer (~> 1.0, >= 1.2.0)
46-
actiontext (6.1.7.2)
47-
actionpack (= 6.1.7.2)
48-
activerecord (= 6.1.7.2)
49-
activestorage (= 6.1.7.2)
50-
activesupport (= 6.1.7.2)
46+
actiontext (6.1.7.6)
47+
actionpack (= 6.1.7.6)
48+
activerecord (= 6.1.7.6)
49+
activestorage (= 6.1.7.6)
50+
activesupport (= 6.1.7.6)
5151
nokogiri (>= 1.8.5)
52-
actionview (6.1.7.2)
53-
activesupport (= 6.1.7.2)
52+
actionview (6.1.7.6)
53+
activesupport (= 6.1.7.6)
5454
builder (~> 3.1)
5555
erubi (~> 1.4)
5656
rails-dom-testing (~> 2.0)
5757
rails-html-sanitizer (~> 1.1, >= 1.2.0)
58-
activejob (6.1.7.2)
59-
activesupport (= 6.1.7.2)
58+
activejob (6.1.7.6)
59+
activesupport (= 6.1.7.6)
6060
globalid (>= 0.3.6)
61-
activemodel (6.1.7.2)
62-
activesupport (= 6.1.7.2)
63-
activerecord (6.1.7.2)
64-
activemodel (= 6.1.7.2)
65-
activesupport (= 6.1.7.2)
61+
activemodel (6.1.7.6)
62+
activesupport (= 6.1.7.6)
63+
activerecord (6.1.7.6)
64+
activemodel (= 6.1.7.6)
65+
activesupport (= 6.1.7.6)
6666
activerecord-import (1.4.1)
6767
activerecord (>= 4.2)
6868
activerecord-session_store (2.0.0)
@@ -71,14 +71,14 @@ GEM
7171
multi_json (~> 1.11, >= 1.11.2)
7272
rack (>= 2.0.8, < 3)
7373
railties (>= 5.2.4.1)
74-
activestorage (6.1.7.2)
75-
actionpack (= 6.1.7.2)
76-
activejob (= 6.1.7.2)
77-
activerecord (= 6.1.7.2)
78-
activesupport (= 6.1.7.2)
74+
activestorage (6.1.7.6)
75+
actionpack (= 6.1.7.6)
76+
activejob (= 6.1.7.6)
77+
activerecord (= 6.1.7.6)
78+
activesupport (= 6.1.7.6)
7979
marcel (~> 1.0)
8080
mini_mime (>= 1.1.0)
81-
activesupport (6.1.7.2)
81+
activesupport (6.1.7.6)
8282
concurrent-ruby (~> 1.0, >= 1.0.2)
8383
i18n (>= 1.6, < 2)
8484
minitest (>= 5.1)
@@ -110,7 +110,7 @@ GEM
110110
sorted_set (~> 1, >= 1.0.2)
111111
byebug (11.1.3)
112112
coderay (1.1.3)
113-
concurrent-ruby (1.2.0)
113+
concurrent-ruby (1.2.2)
114114
connection_pool (2.3.0)
115115
crack (0.4.5)
116116
rexml
@@ -198,7 +198,7 @@ GEM
198198
http-accept (1.7.0)
199199
http-cookie (1.0.5)
200200
domain_name (~> 0.5)
201-
i18n (1.12.0)
201+
i18n (1.14.1)
202202
concurrent-ruby (~> 1.0)
203203
jbuilder (2.11.5)
204204
actionview (>= 5.0.0)
@@ -227,12 +227,12 @@ GEM
227227
addressable (~> 2.8)
228228
link_header (0.0.8)
229229
logger (1.5.3)
230-
loofah (2.19.1)
230+
loofah (2.21.3)
231231
crass (~> 1.0.2)
232-
nokogiri (>= 1.5.9)
232+
nokogiri (>= 1.12.0)
233233
macaddr (1.7.2)
234234
systemu (~> 2.6.5)
235-
mail (2.8.0.1)
235+
mail (2.8.1)
236236
mini_mime (>= 0.1.1)
237237
net-imap
238238
net-pop
@@ -244,16 +244,16 @@ GEM
244244
mime-types (3.4.1)
245245
mime-types-data (~> 3.2015)
246246
mime-types-data (3.2022.0105)
247-
mini_mime (1.1.2)
248-
mini_portile2 (2.8.1)
249-
minitest (5.17.0)
247+
mini_mime (1.1.5)
248+
mini_portile2 (2.8.5)
249+
minitest (5.19.0)
250250
msgpack (1.6.0)
251251
multi_json (1.15.0)
252252
multipart-post (2.3.0)
253253
mysql2 (0.5.5)
254254
net-http-persistent (4.0.1)
255255
connection_pool (~> 2.2)
256-
net-imap (0.3.4)
256+
net-imap (0.3.7)
257257
date
258258
net-protocol
259259
net-pop (0.1.2)
@@ -263,9 +263,9 @@ GEM
263263
net-smtp (0.3.3)
264264
net-protocol
265265
netrc (0.11.0)
266-
nio4r (2.5.8)
267-
nokogiri (1.14.1)
268-
mini_portile2 (~> 2.8.0)
266+
nio4r (2.7.0)
267+
nokogiri (1.15.5)
268+
mini_portile2 (~> 2.8.2)
269269
racc (~> 1.4)
270270
oj (3.14.0)
271271
parallel (1.22.1)
@@ -280,47 +280,49 @@ GEM
280280
pry-rails (0.3.9)
281281
pry (>= 0.10.4)
282282
public_suffix (5.0.1)
283-
puma (6.0.2)
283+
puma (6.3.1)
284284
nio4r (~> 2.0)
285-
racc (1.6.2)
286-
rack (2.2.6.2)
285+
racc (1.7.3)
286+
rack (2.2.8)
287287
rack-protection (3.0.5)
288288
rack
289289
rack-proxy (0.7.6)
290290
rack
291-
rack-test (2.0.2)
291+
rack-test (2.1.0)
292292
rack (>= 1.3)
293293
rack_session_access (0.2.0)
294294
builder (>= 2.0.0)
295295
rack (>= 1.0.0)
296-
rails (6.1.7.2)
297-
actioncable (= 6.1.7.2)
298-
actionmailbox (= 6.1.7.2)
299-
actionmailer (= 6.1.7.2)
300-
actionpack (= 6.1.7.2)
301-
actiontext (= 6.1.7.2)
302-
actionview (= 6.1.7.2)
303-
activejob (= 6.1.7.2)
304-
activemodel (= 6.1.7.2)
305-
activerecord (= 6.1.7.2)
306-
activestorage (= 6.1.7.2)
307-
activesupport (= 6.1.7.2)
296+
rails (6.1.7.6)
297+
actioncable (= 6.1.7.6)
298+
actionmailbox (= 6.1.7.6)
299+
actionmailer (= 6.1.7.6)
300+
actionpack (= 6.1.7.6)
301+
actiontext (= 6.1.7.6)
302+
actionview (= 6.1.7.6)
303+
activejob (= 6.1.7.6)
304+
activemodel (= 6.1.7.6)
305+
activerecord (= 6.1.7.6)
306+
activestorage (= 6.1.7.6)
307+
activesupport (= 6.1.7.6)
308308
bundler (>= 1.15.0)
309-
railties (= 6.1.7.2)
309+
railties (= 6.1.7.6)
310310
sprockets-rails (>= 2.0.0)
311311
rails-assets-tether (1.1.1)
312312
rails-controller-testing (1.0.5)
313313
actionpack (>= 5.0.1.rc1)
314314
actionview (>= 5.0.1.rc1)
315315
activesupport (>= 5.0.1.rc1)
316-
rails-dom-testing (2.0.3)
317-
activesupport (>= 4.2.0)
316+
rails-dom-testing (2.2.0)
317+
activesupport (>= 5.0.0)
318+
minitest
318319
nokogiri (>= 1.6)
319-
rails-html-sanitizer (1.5.0)
320-
loofah (~> 2.19, >= 2.19.1)
321-
railties (6.1.7.2)
322-
actionpack (= 6.1.7.2)
323-
activesupport (= 6.1.7.2)
320+
rails-html-sanitizer (1.6.0)
321+
loofah (~> 2.21)
322+
nokogiri (~> 1.14)
323+
railties (6.1.7.6)
324+
actionpack (= 6.1.7.6)
325+
activesupport (= 6.1.7.6)
324326
method_source
325327
rake (>= 12.2)
326328
thor (~> 1.0)
@@ -399,7 +401,7 @@ GEM
399401
connection_pool (~> 2.2)
400402
multi_json (~> 1.0)
401403
thor (~> 1.1)
402-
sanitize (6.0.1)
404+
sanitize (6.0.2)
403405
crass (~> 1.0.2)
404406
nokogiri (>= 1.12.0)
405407
sass-rails (6.0.0)
@@ -455,9 +457,9 @@ GEM
455457
matrix (~> 0.4)
456458
rdf (~> 3.2)
457459
systemu (2.6.5)
458-
thor (1.2.1)
460+
thor (1.2.2)
459461
tilt (2.0.11)
460-
timeout (0.3.1)
462+
timeout (0.4.0)
461463
turbolinks (5.2.1)
462464
turbolinks-source (~> 5.2)
463465
turbolinks-source (5.2.0)
@@ -489,15 +491,15 @@ GEM
489491
webpacker-react (0.3.2)
490492
webpacker
491493
webrick (1.7.0)
492-
websocket-driver (0.7.5)
494+
websocket-driver (0.7.6)
493495
websocket-extensions (>= 0.1.0)
494496
websocket-extensions (0.1.5)
495497
will_paginate (3.3.1)
496498
will_paginate-bootstrap (1.0.2)
497499
will_paginate (>= 3.0.3)
498500
yard (0.9.28)
499501
webrick (~> 1.7.0)
500-
zeitwerk (2.6.6)
502+
zeitwerk (2.6.11)
501503

502504
PLATFORMS
503505
ruby

lib/sequencescape_client_v2.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ class SequencescapeClientV2::Model < JsonApiClient::Resource # rubocop:todo Styl
88
# set the api base url in an abstract base class
99
self.site = "#{Rails.configuration.ss_api_v2_uri}/api/v2/"
1010
self.sync = false
11+
12+
# set the api key in the header for all requests
13+
connection_options[:headers] = { 'X-Sequencescape-Client-Id' => Rails.configuration.ss_authorisation }
1114
end
1215

1316
class SequencescapeClientV2::Asset < SequencescapeClientV2::Model
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# frozen_string_literal: true
2+
3+
require 'rails_helper'
4+
require './lib/sequencescape_client_v2'
5+
6+
RSpec.describe SequencescapeClientV2 do
7+
describe 'SequencescapeClientV2::Model' do
8+
it 'sets the api base url in an abstract base class' do
9+
expect(SequencescapeClientV2::Model.site).to eq("#{Rails.configuration.ss_api_v2_uri}/api/v2/")
10+
end
11+
12+
it 'sets the sync attribute to false' do
13+
expect(SequencescapeClientV2::Model.sync).to be_falsey
14+
end
15+
16+
it 'sets the api key in the connection options headers' do
17+
headers = SequencescapeClientV2::Model.connection_options[:headers]
18+
expect(headers['X-Sequencescape-Client-Id']).to eq(Rails.configuration.ss_authorisation)
19+
end
20+
end
21+
22+
# Checks a class using the SequencescapeClientV2::Model class has the correct data
23+
describe 'SequencescapeClientV2::Plate' do
24+
it 'sets the api base url in an abstract base class' do
25+
expect(SequencescapeClientV2::Plate.site).to eq("#{Rails.configuration.ss_api_v2_uri}/api/v2/")
26+
end
27+
28+
it 'sets the sync attribute to true' do
29+
expect(SequencescapeClientV2::Plate.sync).to be_truthy
30+
end
31+
32+
it 'sets the api key in the connection options headers' do
33+
headers = SequencescapeClientV2::Plate.connection_options[:headers]
34+
expect(headers['X-Sequencescape-Client-Id']).to eq(Rails.configuration.ss_authorisation)
35+
end
36+
37+
it 'has the api key header set correctly in the requests' do
38+
# We can assert that the resource has the correct api key in the headers by the fact it is
39+
# being successfully stubbed
40+
stub_request(:get, %r{api/v2/plates})
41+
# If you changed this header key or value it would fail as it would not reflect reality
42+
.with(headers: { 'X-Sequencescape-Client-Id' => Rails.configuration.ss_authorisation })
43+
.to_return(File.new('./spec/support/responses/sequencescape/v2/plate_uuid_response.txt'))
44+
plate = SequencescapeClientV2::Plate.first
45+
expect(plate.type).to eq('plates')
46+
end
47+
end
48+
end

0 commit comments

Comments
 (0)