sequencescape-client-api 0.8.0.pre.rcx → 2.0.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/.github/workflows/ruby.yml +2 -2
 - data/.rubocop.yml +2 -2
 - data/.ruby-version +1 -1
 - data/README.markdown +4 -3
 - data/lib/sequencescape-api/connection_factory/actions.rb +4 -4
 - data/lib/sequencescape-api/error_handling.rb +1 -0
 - data/lib/sequencescape-api/resource/attribute_groups.rb +9 -11
 - data/lib/sequencescape-api/version.rb +1 -1
 - data/sequencescape-api.gemspec +1 -1
 - data/spec/sequencescape-api/modifications_spec.rb +6 -10
 - metadata +7 -8
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 0ecebf6c962ae60d3a187a5f16ac2f4812994c99238d72d06b1d7db5ec35d602
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 9bfa9f43fe9da3c5df5dfd6184e24253812f5c615a591306d2c011b48b80a474
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b2a94ea0dd5f5d4a2fa319c614f6ef7ec659033ac156d06074f33a35a65dba3bf3bdec089328a81dea647ec168c4e26968bfb8f559e165a9294f87d2bdd3378d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 5dbea569370cf968fdc3caf93bcd68d4b380ccedaef927013ef74a67b6abea835aab4b65a4f9a3280b85790ddb33f9440182c20603e86d50c4d91c565847f4f7
         
     | 
    
        data/.github/workflows/ruby.yml
    CHANGED
    
    | 
         @@ -9,7 +9,7 @@ jobs: 
     | 
|
| 
       9 
9 
     | 
    
         
             
                runs-on: ubuntu-latest
         
     | 
| 
       10 
10 
     | 
    
         
             
                strategy:
         
     | 
| 
       11 
11 
     | 
    
         
             
                  matrix:
         
     | 
| 
       12 
     | 
    
         
            -
                    ruby: ["2. 
     | 
| 
      
 12 
     | 
    
         
            +
                    ruby: ["2.7", "3.0", "3.1"]
         
     | 
| 
       13 
13 
     | 
    
         
             
                name: Ruby Test ${{ matrix.ruby }}
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
                steps:
         
     | 
| 
         @@ -31,7 +31,7 @@ jobs: 
     | 
|
| 
       31 
31 
     | 
    
         
             
                  - name: Set up Ruby
         
     | 
| 
       32 
32 
     | 
    
         
             
                    uses: ruby/setup-ruby@v1
         
     | 
| 
       33 
33 
     | 
    
         
             
                    with:
         
     | 
| 
       34 
     | 
    
         
            -
                      ruby-version: 3.0
         
     | 
| 
      
 34 
     | 
    
         
            +
                      ruby-version: "3.0"
         
     | 
| 
       35 
35 
     | 
    
         
             
                      bundler-cache:
         
     | 
| 
       36 
36 
     | 
    
         
             
                        true # Runs bundle install and caches gems. See the ruby_test.yml
         
     | 
| 
       37 
37 
     | 
    
         
             
                        # example if you need more control over bundler.
         
     | 
    
        data/.rubocop.yml
    CHANGED
    
    | 
         @@ -11,7 +11,7 @@ inherit_from: .rubocop_todo.yml 
     | 
|
| 
       11 
11 
     | 
    
         
             
            #
         
     | 
| 
       12 
12 
     | 
    
         
             
            # See https://github.com/rubocop-hq/rubocop/blob/master/manual/configuration.md
         
     | 
| 
       13 
13 
     | 
    
         
             
            AllCops:
         
     | 
| 
       14 
     | 
    
         
            -
              TargetRubyVersion: 2. 
     | 
| 
      
 14 
     | 
    
         
            +
              TargetRubyVersion: "2.7"
         
     | 
| 
       15 
15 
     | 
    
         
             
            Style/ClassAndModuleChildren:
         
     | 
| 
       16 
16 
     | 
    
         
             
              Enabled: false
         
     | 
| 
       17 
17 
     | 
    
         
             
            Layout/LineLength:
         
     | 
| 
         @@ -19,7 +19,7 @@ Layout/LineLength: 
     | 
|
| 
       19 
19 
     | 
    
         
             
              AutoCorrect: true
         
     | 
| 
       20 
20 
     | 
    
         
             
            Naming/FileName:
         
     | 
| 
       21 
21 
     | 
    
         
             
              Exclude:
         
     | 
| 
       22 
     | 
    
         
            -
                -  
     | 
| 
      
 22 
     | 
    
         
            +
                - "lib/sequencescape-api.rb"
         
     | 
| 
       23 
23 
     | 
    
         | 
| 
       24 
24 
     | 
    
         
             
            # Pending Cops
         
     | 
| 
       25 
25 
     | 
    
         
             
            Lint/DuplicateBranch: # (new in 1.3)
         
     | 
    
        data/.ruby-version
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            2.7.4
         
     | 
    
        data/README.markdown
    CHANGED
    
    | 
         @@ -12,9 +12,10 @@ Documentation can be found [on the wiki](https://github.com/sanger/sequencescape 
     | 
|
| 
       12 
12 
     | 
    
         
             
            - 0.6.x Removes usage of WTSISignOn cookie. Replaces with user specific api key,
         
     | 
| 
       13 
13 
     | 
    
         
             
              can be provided to Sequencescape::Api.new as user_api_key: or via
         
     | 
| 
       14 
14 
     | 
    
         
             
              `api_connection_options` in the controller.
         
     | 
| 
       15 
     | 
    
         
            -
            - 0. 
     | 
| 
      
 15 
     | 
    
         
            +
            - 1.0.x Enables HTTPS
         
     | 
| 
      
 16 
     | 
    
         
            +
            - 2.0.x Drops support for versions less than Ruby 2.7
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
            - master currently corresponds to  
     | 
| 
      
 18 
     | 
    
         
            +
            - master currently corresponds to 2.x
         
     | 
| 
       18 
19 
     | 
    
         | 
| 
       19 
20 
     | 
    
         
             
            Rails 6 appears to be supported judging by Specs, but haven't used it in anger
         
     | 
| 
       20 
21 
     | 
    
         
             
            yet.
         
     | 
| 
         @@ -23,7 +24,7 @@ yet. 
     | 
|
| 
       23 
24 
     | 
    
         | 
| 
       24 
25 
     | 
    
         
             
            1. Update the version number in `lib/sequencescape-api/version.rb`
         
     | 
| 
       25 
26 
     | 
    
         
             
            2. For pre-releases the version number should be in the format:
         
     | 
| 
       26 
     | 
    
         
            -
               major.minor.point-rcx
         
     | 
| 
      
 27 
     | 
    
         
            +
               major.minor.point-rcx (increment x to prevent burning though version numbers when testing release candidates)
         
     | 
| 
       27 
28 
     | 
    
         
             
            3. For release version the version number should be in the format:
         
     | 
| 
       28 
29 
     | 
    
         
             
               major.minor.point
         
     | 
| 
       29 
30 
     | 
    
         
             
            4. Ensure everything is committed, and for non-pre-releases, make sure you are
         
     | 
| 
         @@ -8,8 +8,8 @@ BEGIN { 
     | 
|
| 
       8 
8 
     | 
    
         
             
              Net::HTTP.module_eval do
         
     | 
| 
       9 
9 
     | 
    
         
             
                alias_method '__initialize__', 'initialize'
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
     | 
    
         
            -
                def initialize( 
     | 
| 
       12 
     | 
    
         
            -
                  __initialize__( 
     | 
| 
      
 11 
     | 
    
         
            +
                def initialize(...)
         
     | 
| 
      
 12 
     | 
    
         
            +
                  __initialize__(...)
         
     | 
| 
       13 
13 
     | 
    
         
             
                ensure
         
     | 
| 
       14 
14 
     | 
    
         
             
                  @debug_output = $stderr if ENV['HTTP_DEBUG']
         
     | 
| 
       15 
15 
     | 
    
         
             
                end
         
     | 
| 
         @@ -105,7 +105,7 @@ module Sequencescape::Api::ConnectionFactory::Actions 
     | 
|
| 
       105 
105 
     | 
    
         
             
                rescue URI::InvalidURIError => e
         
     | 
| 
       106 
106 
     | 
    
         
             
                  raise URI::InvalidURIError, "#{http_verb} failed: #{url.inspect} is not a valid uri"
         
     | 
| 
       107 
107 
     | 
    
         
             
                end
         
     | 
| 
       108 
     | 
    
         
            -
                Net::HTTP.start(uri.host, uri.port, use_ssl:  
     | 
| 
      
 108 
     | 
    
         
            +
                Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |connection|
         
     | 
| 
       109 
109 
     | 
    
         
             
                  connection.read_timeout = read_timeout
         
     | 
| 
       110 
110 
     | 
    
         
             
                  request_headers = headers
         
     | 
| 
       111 
111 
     | 
    
         
             
                  request_headers.merge!('Accept' => accepts) unless accepts.nil?
         
     | 
| 
         @@ -122,7 +122,7 @@ module Sequencescape::Api::ConnectionFactory::Actions 
     | 
|
| 
       122 
122 
     | 
    
         | 
| 
       123 
123 
     | 
    
         
             
              def perform_for_file(http_verb, url, file, filename, content_type)
         
     | 
| 
       124 
124 
     | 
    
         
             
                uri = URI.parse(url)
         
     | 
| 
       125 
     | 
    
         
            -
                Net::HTTP.start(uri.host, uri.port, use_ssl:  
     | 
| 
      
 125 
     | 
    
         
            +
                Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |connection|
         
     | 
| 
       126 
126 
     | 
    
         
             
                  connection.read_timeout = read_timeout
         
     | 
| 
       127 
127 
     | 
    
         
             
                  file_headers = headers.merge!({ 'Content-Disposition' => "form-data; filename=\"#{filename}\"" })
         
     | 
| 
       128 
128 
     | 
    
         
             
                  request = Net::HTTP.const_get(http_verb.to_s.classify).new(uri.request_uri, file_headers)
         
     | 
| 
         @@ -5,6 +5,7 @@ require 'active_model/translation' 
     | 
|
| 
       5 
5 
     | 
    
         
             
            require 'active_model/errors'
         
     | 
| 
       6 
6 
     | 
    
         | 
| 
       7 
7 
     | 
    
         
             
            # Uh, ok, so why do I have to include these when I've kind of said I want everything!?!!
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'active_support/core_ext/module/deprecation'
         
     | 
| 
       8 
9 
     | 
    
         
             
            require 'active_model/validator'
         
     | 
| 
       9 
10 
     | 
    
         
             
            require 'active_model/validations'
         
     | 
| 
       10 
11 
     | 
    
         
             
            require 'active_model/callbacks'
         
     | 
| 
         @@ -28,19 +28,17 @@ module Sequencescape::Api::Resource::Groups 
     | 
|
| 
       28 
28 
     | 
    
         
             
              end
         
     | 
| 
       29 
29 
     | 
    
         | 
| 
       30 
30 
     | 
    
         
             
              module Json
         
     | 
| 
       31 
     | 
    
         
            -
                def as_json_for_update(options) 
     | 
| 
      
 31 
     | 
    
         
            +
                def as_json_for_update(options)
         
     | 
| 
       32 
32 
     | 
    
         
             
                  super.tap do |json|
         
     | 
| 
       33 
     | 
    
         
            -
                     
     | 
| 
       34 
     | 
    
         
            -
                       
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
       36 
     | 
    
         
            -
                       
     | 
| 
       37 
     | 
    
         
            -
                        json.merge!(attribute_group_json(options))
         
     | 
| 
       38 
     | 
    
         
            -
                      end
         
     | 
| 
       39 
     | 
    
         
            -
                    rescue KeyError => e
         
     | 
| 
       40 
     | 
    
         
            -
                      # If we get a key error, append the json to out exception to assist diagnosing issues
         
     | 
| 
       41 
     | 
    
         
            -
                      e.message << " in #{json.to_json}"
         
     | 
| 
       42 
     | 
    
         
            -
                      raise e
         
     | 
| 
      
 33 
     | 
    
         
            +
                    if options[:root]
         
     | 
| 
      
 34 
     | 
    
         
            +
                      json.fetch(json_root).merge!(attribute_group_json(options))
         
     | 
| 
      
 35 
     | 
    
         
            +
                    else
         
     | 
| 
      
 36 
     | 
    
         
            +
                      json.merge!(attribute_group_json(options))
         
     | 
| 
       43 
37 
     | 
    
         
             
                    end
         
     | 
| 
      
 38 
     | 
    
         
            +
                  rescue KeyError => e
         
     | 
| 
      
 39 
     | 
    
         
            +
                    # If we get a key error, append the json to out exception to assist diagnosing issues
         
     | 
| 
      
 40 
     | 
    
         
            +
                    e.message << " in #{json.to_json}"
         
     | 
| 
      
 41 
     | 
    
         
            +
                    raise e
         
     | 
| 
       44 
42 
     | 
    
         
             
                  end
         
     | 
| 
       45 
43 
     | 
    
         
             
                end
         
     | 
| 
       46 
44 
     | 
    
         
             
                private :as_json_for_update
         
     | 
    
        data/sequencescape-api.gemspec
    CHANGED
    
    | 
         @@ -10,7 +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 = ' 
     | 
| 
      
 13 
     | 
    
         
            +
              s.required_ruby_version = '>= 2.7'
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
15 
     | 
    
         
             
              s.rubyforge_project = 'sequencescape-client-api'
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
         @@ -11,11 +11,9 @@ shared_examples_for 'errors on both client and server' do |action, request_contr 
     | 
|
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
13 
     | 
    
         
             
                it 'includes the error on the field' do
         
     | 
| 
       14 
     | 
    
         
            -
                   
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
       16 
     | 
    
         
            -
                   
     | 
| 
       17 
     | 
    
         
            -
                    e.resource.errors[:attribute_validated_at_client].should == ['cannot be set']
         
     | 
| 
       18 
     | 
    
         
            -
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  target.__send__(action, attribute_validated_at_client: 'please error')
         
     | 
| 
      
 15 
     | 
    
         
            +
                rescue Sequencescape::Api::ResourceInvalid => e
         
     | 
| 
      
 16 
     | 
    
         
            +
                  e.resource.errors[:attribute_validated_at_client].should == ['cannot be set']
         
     | 
| 
       19 
17 
     | 
    
         
             
                end
         
     | 
| 
       20 
18 
     | 
    
         
             
              end
         
     | 
| 
       21 
19 
     | 
    
         | 
| 
         @@ -29,11 +27,9 @@ shared_examples_for 'errors on both client and server' do |action, request_contr 
     | 
|
| 
       29 
27 
     | 
    
         
             
                end
         
     | 
| 
       30 
28 
     | 
    
         | 
| 
       31 
29 
     | 
    
         
             
                it 'includes the error on the field' do
         
     | 
| 
       32 
     | 
    
         
            -
                   
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
       34 
     | 
    
         
            -
                   
     | 
| 
       35 
     | 
    
         
            -
                    e.resource.errors[:attribute_validated_at_server].should == ['cannot be set']
         
     | 
| 
       36 
     | 
    
         
            -
                  end
         
     | 
| 
      
 30 
     | 
    
         
            +
                  target.__send__(action, attribute_validated_at_server: 'please error')
         
     | 
| 
      
 31 
     | 
    
         
            +
                rescue Sequencescape::Api::ResourceInvalid => e
         
     | 
| 
      
 32 
     | 
    
         
            +
                  e.resource.errors[:attribute_validated_at_server].should == ['cannot be set']
         
     | 
| 
       37 
33 
     | 
    
         
             
                end
         
     | 
| 
       38 
34 
     | 
    
         
             
              end
         
     | 
| 
       39 
35 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: sequencescape-client-api
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 2.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Matthew Denner
         
     | 
| 
         @@ -10,7 +10,7 @@ authors: 
     | 
|
| 
       10 
10 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       11 
11 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       12 
12 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       13 
     | 
    
         
            -
            date: 2022-01- 
     | 
| 
      
 13 
     | 
    
         
            +
            date: 2022-01-25 00:00:00.000000000 Z
         
     | 
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: activemodel
         
     | 
| 
         @@ -520,17 +520,16 @@ require_paths: 
     | 
|
| 
       520 
520 
     | 
    
         
             
            - lib
         
     | 
| 
       521 
521 
     | 
    
         
             
            required_ruby_version: !ruby/object:Gem::Requirement
         
     | 
| 
       522 
522 
     | 
    
         
             
              requirements:
         
     | 
| 
       523 
     | 
    
         
            -
              - - " 
     | 
| 
      
 523 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       524 
524 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       525 
     | 
    
         
            -
                  version: '2. 
     | 
| 
      
 525 
     | 
    
         
            +
                  version: '2.7'
         
     | 
| 
       526 
526 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       527 
527 
     | 
    
         
             
              requirements:
         
     | 
| 
       528 
     | 
    
         
            -
              - - " 
     | 
| 
      
 528 
     | 
    
         
            +
              - - ">="
         
     | 
| 
       529 
529 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       530 
     | 
    
         
            -
                  version:  
     | 
| 
      
 530 
     | 
    
         
            +
                  version: '0'
         
     | 
| 
       531 
531 
     | 
    
         
             
            requirements: []
         
     | 
| 
       532 
     | 
    
         
            -
             
     | 
| 
       533 
     | 
    
         
            -
            rubygems_version: 2.7.6.2
         
     | 
| 
      
 532 
     | 
    
         
            +
            rubygems_version: 3.1.6
         
     | 
| 
       534 
533 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       535 
534 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       536 
535 
     | 
    
         
             
            summary: Gem for the client side of the Sequencescape API
         
     |