sequencescape-client-api 0.4.3 → 0.5.0.pre.rc1
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/.rubocop.yml +16 -10
- data/.rubocop_todo.yml +58 -18
- data/README.markdown +2 -1
- data/lib/sequencescape-api/connection_factory/actions.rb +5 -5
- data/lib/sequencescape-api/finder_methods.rb +1 -3
- data/lib/sequencescape-api/version.rb +1 -1
- data/lib/sequencescape/order.rb +2 -1
- data/sequencescape-api.gemspec +14 -2
- data/spec/sequencescape-api/root_spec.rb +1 -1
- data/spec/support/contract_helper.rb +1 -1
- metadata +35 -15
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca6bcf02a9824bf838a8f170a749c0772de14eacb3a8dc909c95ba1fb4ada5be
|
4
|
+
data.tar.gz: fe09bb2f3e35c9257717cf6dafbc8c1e69cc95bbc9742e5e4862f5fa480130db
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c847b9a8b44eca0ce5efe11aa177ef7c08de6b7751f234d004dc16a4464dab98887b9f7cb28ee0b4ebcf67b121d9bccce67cd0a2d95c43fdd10473a56a44fe47
|
7
|
+
data.tar.gz: 3fe0065e18af4e98165966868c3a7790b87c50afdfb6e174ec0d43d74e5ed72a5ac24b9edeadb6b4c5d5eb4e406253c189b695c7b3c3b6cd46f19271a7fef17a
|
data/.rubocop.yml
CHANGED
@@ -22,23 +22,29 @@ Naming/FileName:
|
|
22
22
|
- 'lib/sequencescape-api.rb'
|
23
23
|
|
24
24
|
# Pending Cops
|
25
|
-
|
25
|
+
Lint/DuplicateBranch: # (new in 1.3)
|
26
26
|
Enabled: true
|
27
|
-
|
27
|
+
Lint/DuplicateRegexpCharacterClassElement: # (new in 1.1)
|
28
28
|
Enabled: true
|
29
|
-
Lint/
|
29
|
+
Lint/EmptyBlock: # (new in 1.1)
|
30
30
|
Enabled: true
|
31
|
-
Lint/
|
31
|
+
Lint/EmptyClass: # (new in 1.3)
|
32
32
|
Enabled: true
|
33
|
-
Lint/
|
33
|
+
Lint/NoReturnInBeginEndBlocks: # (new in 1.2)
|
34
34
|
Enabled: true
|
35
|
-
|
35
|
+
Lint/ToEnumArguments: # (new in 1.1)
|
36
36
|
Enabled: true
|
37
|
-
|
37
|
+
Lint/UnmodifiedReduceAccumulator: # (new in 1.1)
|
38
38
|
Enabled: true
|
39
|
-
Style/
|
39
|
+
Style/ArgumentsForwarding: # (new in 1.1)
|
40
40
|
Enabled: true
|
41
|
-
Style/
|
41
|
+
Style/CollectionCompact: # (new in 1.2)
|
42
42
|
Enabled: true
|
43
|
-
Style/
|
43
|
+
Style/DocumentDynamicEvalDefinition: # (new in 1.1)
|
44
|
+
Enabled: true
|
45
|
+
Style/NegatedIfElseCondition: # (new in 1.2)
|
46
|
+
Enabled: true
|
47
|
+
Style/NilLambda: # (new in 1.3)
|
48
|
+
Enabled: true
|
49
|
+
Style/SwapValues: # (new in 1.1)
|
44
50
|
Enabled: true
|
data/.rubocop_todo.yml
CHANGED
@@ -1,11 +1,29 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config --exclude-limit 15000`
|
3
|
-
# on 2020-
|
3
|
+
# on 2020-11-20 12:14:23 UTC using RuboCop version 1.3.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
+
# Offense count: 4
|
10
|
+
Lint/DuplicateBranch:
|
11
|
+
Exclude:
|
12
|
+
- 'lib/sequencescape-api/associations/belongs_to.rb'
|
13
|
+
- 'lib/sequencescape-api/connection_factory/actions.rb'
|
14
|
+
|
15
|
+
# Offense count: 3
|
16
|
+
Lint/MissingSuper:
|
17
|
+
Exclude:
|
18
|
+
- 'lib/sequencescape-api/associations/belongs_to.rb'
|
19
|
+
- 'lib/sequencescape-api/resource_model_proxy.rb'
|
20
|
+
- 'lib/sequencescape/search.rb'
|
21
|
+
|
22
|
+
# Offense count: 1
|
23
|
+
Lint/MixedRegexpCaptureTypes:
|
24
|
+
Exclude:
|
25
|
+
- 'spec/support/contract_helper.rb'
|
26
|
+
|
9
27
|
# Offense count: 2
|
10
28
|
Lint/ShadowingOuterLocalVariable:
|
11
29
|
Exclude:
|
@@ -28,28 +46,34 @@ Lint/Void:
|
|
28
46
|
Exclude:
|
29
47
|
- 'spec/sequencescape-api/associations_spec.rb'
|
30
48
|
|
31
|
-
# Offense count:
|
49
|
+
# Offense count: 7
|
32
50
|
# Configuration parameters: IgnoredMethods.
|
33
51
|
Metrics/AbcSize:
|
34
|
-
Max:
|
52
|
+
Max: 26
|
35
53
|
|
36
54
|
# Offense count: 8
|
37
|
-
# Configuration parameters: CountComments, ExcludedMethods.
|
55
|
+
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods.
|
38
56
|
# ExcludedMethods: refine
|
39
57
|
Metrics/BlockLength:
|
40
58
|
Max: 65
|
41
59
|
|
42
60
|
# Offense count: 1
|
43
|
-
# Configuration parameters:
|
61
|
+
# Configuration parameters: IgnoredMethods.
|
62
|
+
Metrics/CyclomaticComplexity:
|
63
|
+
Max: 8
|
64
|
+
|
65
|
+
# Offense count: 1
|
66
|
+
# Configuration parameters: CountComments, CountAsOne.
|
44
67
|
Metrics/ModuleLength:
|
45
68
|
Max: 120
|
46
69
|
|
47
|
-
# Offense count:
|
70
|
+
# Offense count: 2
|
48
71
|
# Configuration parameters: IgnoredMethods.
|
49
72
|
Metrics/PerceivedComplexity:
|
50
|
-
Max:
|
73
|
+
Max: 10
|
51
74
|
|
52
75
|
# Offense count: 1
|
76
|
+
# Cop supports --auto-correct.
|
53
77
|
Naming/BinaryOperatorParameterName:
|
54
78
|
Exclude:
|
55
79
|
- 'lib/sequencescape-api/resource/instance_methods.rb'
|
@@ -71,18 +95,23 @@ Naming/PredicateName:
|
|
71
95
|
- 'lib/sequencescape-api/resource/attributes.rb'
|
72
96
|
- 'lib/sequencescape-api/resource_model_proxy.rb'
|
73
97
|
|
74
|
-
# Offense count: 1
|
75
|
-
# Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols.
|
76
|
-
# SupportedStyles: inline, group
|
77
|
-
Style/AccessModifierDeclarations:
|
78
|
-
Exclude:
|
79
|
-
- 'lib/sequencescape-api/resource/attributes.rb'
|
80
|
-
|
81
98
|
# Offense count: 1
|
82
99
|
Style/BeginBlock:
|
83
100
|
Exclude:
|
84
101
|
- 'lib/sequencescape-api/connection_factory/actions.rb'
|
85
102
|
|
103
|
+
# Offense count: 11
|
104
|
+
Style/DocumentDynamicEvalDefinition:
|
105
|
+
Exclude:
|
106
|
+
- 'lib/sequencescape-api/actions.rb'
|
107
|
+
- 'lib/sequencescape-api/associations.rb'
|
108
|
+
- 'lib/sequencescape-api/composition.rb'
|
109
|
+
- 'lib/sequencescape-api/finder_methods.rb'
|
110
|
+
- 'lib/sequencescape-api/resource/attributes.rb'
|
111
|
+
- 'lib/sequencescape/batch.rb'
|
112
|
+
- 'lib/sequencescape/behaviour/state_driven.rb'
|
113
|
+
- 'lib/sequencescape/search.rb'
|
114
|
+
|
86
115
|
# Offense count: 138
|
87
116
|
Style/Documentation:
|
88
117
|
Exclude:
|
@@ -214,6 +243,12 @@ Style/EvalWithLocation:
|
|
214
243
|
- 'lib/sequencescape/behaviour/state_driven.rb'
|
215
244
|
- 'lib/sequencescape/search.rb'
|
216
245
|
|
246
|
+
# Offense count: 1
|
247
|
+
# Cop supports --auto-correct.
|
248
|
+
Style/ExplicitBlockArgument:
|
249
|
+
Exclude:
|
250
|
+
- 'spec/support/contract_helper.rb'
|
251
|
+
|
217
252
|
# Offense count: 104
|
218
253
|
# Cop supports --auto-correct.
|
219
254
|
# Configuration parameters: EnforcedStyle.
|
@@ -326,13 +361,18 @@ Style/FrozenStringLiteralComment:
|
|
326
361
|
- 'sequencescape-api.gemspec'
|
327
362
|
|
328
363
|
# Offense count: 2
|
329
|
-
Style/
|
364
|
+
Style/MissingRespondToMissing:
|
330
365
|
Exclude:
|
331
366
|
- 'lib/sequencescape-api/associations/belongs_to.rb'
|
332
|
-
- 'lib/sequencescape-api/
|
367
|
+
- 'lib/sequencescape-api/core.rb'
|
333
368
|
|
334
|
-
# Offense count:
|
335
|
-
|
369
|
+
# Offense count: 6
|
370
|
+
# Configuration parameters: AllowedMethods.
|
371
|
+
# AllowedMethods: respond_to_missing?
|
372
|
+
Style/OptionalBooleanParameter:
|
336
373
|
Exclude:
|
337
374
|
- 'lib/sequencescape-api/associations/belongs_to.rb'
|
338
375
|
- 'lib/sequencescape-api/core.rb'
|
376
|
+
- 'lib/sequencescape-api/finder_methods.rb'
|
377
|
+
- 'lib/sequencescape-api/resource/instance_methods.rb'
|
378
|
+
- 'lib/sequencescape-api/resource/modifications.rb'
|
data/README.markdown
CHANGED
@@ -10,8 +10,9 @@ Version Guides
|
|
10
10
|
- 0.2.x Supports older versions of Rails.
|
11
11
|
- 0.3.x Supports Rails 3.2.x to 5.1.x
|
12
12
|
- 0.4.x Supports Rails 5.0 and up
|
13
|
+
- 0.5.x Supports Rails 5.0 and up, drops yajl in favour of multi-json
|
13
14
|
|
14
|
-
- master currently corresponds to 0.
|
15
|
+
- master currently corresponds to 0.5.x
|
15
16
|
|
16
17
|
Rails 6 appears to be supported judging by Specs, but haven't used it in anger
|
17
18
|
yet.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'net/http'
|
2
|
-
require '
|
2
|
+
require 'multi_json'
|
3
3
|
|
4
4
|
# PINCHED FROM https://gist.github.com/736721
|
5
5
|
BEGIN {
|
@@ -48,7 +48,7 @@ module Sequencescape::Api::ConnectionFactory::Actions
|
|
48
48
|
end
|
49
49
|
|
50
50
|
# rubocop:todo Metrics/MethodLength
|
51
|
-
def create(url, body, handler)
|
51
|
+
def create(url, body, handler)
|
52
52
|
perform(:post, url, jsonify(body, action: :create)) do |response|
|
53
53
|
case response
|
54
54
|
when Net::HTTPCreated then handler.success(parse_json_from(response))
|
@@ -64,7 +64,7 @@ module Sequencescape::Api::ConnectionFactory::Actions
|
|
64
64
|
# rubocop:enable Metrics/MethodLength
|
65
65
|
|
66
66
|
# rubocop:todo Metrics/MethodLength
|
67
|
-
def create_from_file(url, file, filename, content_type, handler)
|
67
|
+
def create_from_file(url, file, filename, content_type, handler)
|
68
68
|
perform_for_file(:post, url, file, filename, content_type) do |response|
|
69
69
|
case response
|
70
70
|
when Net::HTTPCreated then handler.success(parse_json_from(response))
|
@@ -113,7 +113,7 @@ module Sequencescape::Api::ConnectionFactory::Actions
|
|
113
113
|
unless body.nil?
|
114
114
|
request.content_type = 'application/json'
|
115
115
|
# request.body = body.to_json
|
116
|
-
request.body =
|
116
|
+
request.body = MultiJson.dump(body)
|
117
117
|
end
|
118
118
|
yield(connection.request(request))
|
119
119
|
end
|
@@ -146,7 +146,7 @@ module Sequencescape::Api::ConnectionFactory::Actions
|
|
146
146
|
def parse_json_from(response)
|
147
147
|
raise ServerError, 'server returned non-JSON content' unless response.content_type == 'application/json'
|
148
148
|
|
149
|
-
|
149
|
+
MultiJson.load(StringIO.new(response.body))
|
150
150
|
end
|
151
151
|
private :parse_json_from
|
152
152
|
|
@@ -82,11 +82,9 @@ end
|
|
82
82
|
class Sequencescape::Api::PageOfResults
|
83
83
|
include Enumerable
|
84
84
|
|
85
|
-
attr_reader :api, :actions
|
85
|
+
attr_reader :api, :actions, :size
|
86
86
|
private :api, :actions
|
87
87
|
|
88
|
-
attr_reader :size
|
89
|
-
|
90
88
|
def initialize(api, json, &block)
|
91
89
|
@api = api
|
92
90
|
@ctor = block
|
data/lib/sequencescape/order.rb
CHANGED
data/sequencescape-api.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.homepage = ''
|
11
11
|
s.summary = 'Gem for the client side of the Sequencescape API'
|
12
12
|
s.description = 'Provides all of the necessary code for interacting with the Sequencescape API'
|
13
|
+
s.required_ruby_version = '> 2.4'
|
13
14
|
|
14
15
|
s.rubyforge_project = 'sequencescape-client-api'
|
15
16
|
|
@@ -18,16 +19,27 @@ Gem::Specification.new do |s|
|
|
18
19
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
19
20
|
s.require_paths = ['lib']
|
20
21
|
|
22
|
+
s.post_install_message = <<~POST_INSTALL
|
23
|
+
sequencescape-client-api has dropped 'yajl-ruby' in favour of 'multi_json',
|
24
|
+
https://rubygems.org/gems/multi_json. This will automatically pick the
|
25
|
+
fastest json encoder in your Gemfile, falling back to the default encoder.
|
26
|
+
|
27
|
+
For best performance you are strongly encouraged to add a custom json
|
28
|
+
encoder to your project. eg. bundle install oj.
|
29
|
+
POST_INSTALL
|
30
|
+
|
21
31
|
s.add_dependency('activemodel', '>= 5.0.0')
|
22
32
|
s.add_dependency('activesupport', '>= 5.0.0')
|
23
33
|
s.add_dependency('i18n')
|
24
|
-
s.add_dependency('
|
34
|
+
s.add_dependency('multi_json')
|
25
35
|
|
26
36
|
s.add_development_dependency('pry')
|
27
37
|
s.add_development_dependency('rake')
|
28
38
|
s.add_development_dependency('redcarpet')
|
29
39
|
s.add_development_dependency('rspec', '~> 2.11.0')
|
30
|
-
s.add_development_dependency('rubocop', '~>
|
40
|
+
s.add_development_dependency('rubocop', '~> 1.3.1')
|
31
41
|
s.add_development_dependency('webmock')
|
32
42
|
s.add_development_dependency('yard')
|
43
|
+
# Add a json encoder for development
|
44
|
+
s.add_development_dependency('oj')
|
33
45
|
end
|
@@ -25,7 +25,7 @@ describe 'Retrieving the root URL' do
|
|
25
25
|
end
|
26
26
|
|
27
27
|
it "errors because Sequencescape::#{model.to_s.classify} is not defined" do
|
28
|
-
#
|
28
|
+
# NOTE: Using a regex as > Ruby 2.3 'DidYouMean' changes the error message slightly.
|
29
29
|
lambda {
|
30
30
|
subject.send(model.to_sym)
|
31
31
|
}.should raise_error(NameError,
|
@@ -35,7 +35,7 @@ module ContractHelper
|
|
35
35
|
@url = "http://localhost:3000#{match[:path]}"
|
36
36
|
@conditions = {}
|
37
37
|
@conditions[:headers] = Hash[*match[:headers].split(/\r?\n/).map { |l| l.split(':') }.flatten.map(&:strip)]
|
38
|
-
@conditions[:body] =
|
38
|
+
@conditions[:body] = MultiJson.dump(MultiJson.load(match[:body])) unless match[:body].blank?
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
metadata
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sequencescape-client-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0.pre.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matthew Denner
|
8
8
|
- James Glover
|
9
9
|
- Eduardo Martin Rojo
|
10
|
-
autorequire:
|
10
|
+
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-11-
|
13
|
+
date: 2020-11-20 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activemodel
|
@@ -55,19 +55,19 @@ dependencies:
|
|
55
55
|
- !ruby/object:Gem::Version
|
56
56
|
version: '0'
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
|
-
name:
|
58
|
+
name: multi_json
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
60
60
|
requirements:
|
61
61
|
- - ">="
|
62
62
|
- !ruby/object:Gem::Version
|
63
|
-
version:
|
63
|
+
version: '0'
|
64
64
|
type: :runtime
|
65
65
|
prerelease: false
|
66
66
|
version_requirements: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
|
-
version:
|
70
|
+
version: '0'
|
71
71
|
- !ruby/object:Gem::Dependency
|
72
72
|
name: pry
|
73
73
|
requirement: !ruby/object:Gem::Requirement
|
@@ -130,14 +130,14 @@ dependencies:
|
|
130
130
|
requirements:
|
131
131
|
- - "~>"
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version:
|
133
|
+
version: 1.3.1
|
134
134
|
type: :development
|
135
135
|
prerelease: false
|
136
136
|
version_requirements: !ruby/object:Gem::Requirement
|
137
137
|
requirements:
|
138
138
|
- - "~>"
|
139
139
|
- !ruby/object:Gem::Version
|
140
|
-
version:
|
140
|
+
version: 1.3.1
|
141
141
|
- !ruby/object:Gem::Dependency
|
142
142
|
name: webmock
|
143
143
|
requirement: !ruby/object:Gem::Requirement
|
@@ -166,6 +166,20 @@ dependencies:
|
|
166
166
|
- - ">="
|
167
167
|
- !ruby/object:Gem::Version
|
168
168
|
version: '0'
|
169
|
+
- !ruby/object:Gem::Dependency
|
170
|
+
name: oj
|
171
|
+
requirement: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
type: :development
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: !ruby/object:Gem::Requirement
|
179
|
+
requirements:
|
180
|
+
- - ">="
|
181
|
+
- !ruby/object:Gem::Version
|
182
|
+
version: '0'
|
169
183
|
description: Provides all of the necessary code for interacting with the Sequencescape
|
170
184
|
API
|
171
185
|
email:
|
@@ -493,23 +507,29 @@ files:
|
|
493
507
|
homepage: ''
|
494
508
|
licenses: []
|
495
509
|
metadata: {}
|
496
|
-
post_install_message:
|
510
|
+
post_install_message: |
|
511
|
+
sequencescape-client-api has dropped 'yajl-ruby' in favour of 'multi_json',
|
512
|
+
https://rubygems.org/gems/multi_json. This will automatically pick the
|
513
|
+
fastest json encoder in your Gemfile, falling back to the default encoder.
|
514
|
+
|
515
|
+
For best performance you are strongly encouraged to add a custom json
|
516
|
+
encoder to your project. eg. bundle install oj.
|
497
517
|
rdoc_options: []
|
498
518
|
require_paths:
|
499
519
|
- lib
|
500
520
|
required_ruby_version: !ruby/object:Gem::Requirement
|
501
521
|
requirements:
|
502
|
-
- - "
|
522
|
+
- - ">"
|
503
523
|
- !ruby/object:Gem::Version
|
504
|
-
version: '
|
524
|
+
version: '2.4'
|
505
525
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
506
526
|
requirements:
|
507
|
-
- - "
|
527
|
+
- - ">"
|
508
528
|
- !ruby/object:Gem::Version
|
509
|
-
version:
|
529
|
+
version: 1.3.1
|
510
530
|
requirements: []
|
511
|
-
rubygems_version: 3.
|
512
|
-
signing_key:
|
531
|
+
rubygems_version: 3.1.4
|
532
|
+
signing_key:
|
513
533
|
specification_version: 4
|
514
534
|
summary: Gem for the client side of the Sequencescape API
|
515
535
|
test_files:
|