dhs 1.5.0 → 1.6.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/dhs.gemspec +1 -0
 - data/lib/dhs/concerns/option_blocks.rb +2 -5
 - data/lib/dhs/interceptors/auto_oauth/thread_registry.rb +2 -5
 - data/lib/dhs/interceptors/extended_rollbar/thread_registry.rb +2 -5
 - data/lib/dhs/interceptors/request_cycle_cache/thread_registry.rb +2 -6
 - data/lib/dhs/pagination/next_parameter.rb +2 -2
 - data/lib/dhs/version.rb +1 -1
 - data/spec/pagination/next_parameter_spec.rb +2 -4
 - metadata +17 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 79388bf9da2d5952b1df95513287bbd412dcb5196c99889ea91e28f302cbc64d
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e18e9e03e4130cbc2e4dadddb63603170ffee5c2791eb2e64418f39b33f664c8
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 3ccb5289a230ea385574091368925d293106fae4fb5874ead856fb85a68bfa726a531a7adf9ad5b9499c82f24a8a355cf9ac5eb8741b1eb30c862762b3ed6b08
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 42edbdaadbf8adc52e7a8a05a979d7b498aa0c8aa084718e29e0237282164482d37cb4b5d499e19633245f8a72e81a67f0fc167a9e8ce87bdf0efad20899932d
         
     | 
    
        data/dhs.gemspec
    CHANGED
    
    
| 
         @@ -1,17 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'active_support'
         
     | 
| 
       4 
     | 
    
         
            -
            require 'active_support/ 
     | 
| 
      
 4 
     | 
    
         
            +
            require 'active_support/core_ext/module/attribute_accessors_per_thread'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            module DHS
         
     | 
| 
       7 
7 
     | 
    
         
             
              module OptionBlocks
         
     | 
| 
       8 
8 
     | 
    
         
             
                extend ActiveSupport::Concern
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
10 
     | 
    
         
             
                class CurrentOptionBlock
         
     | 
| 
       11 
     | 
    
         
            -
                   
     | 
| 
       12 
     | 
    
         
            -
                  # Will switch to thread_mattr_accessor (which comes with Activesupport) when we dropping support for Active Support v4.
         
     | 
| 
       13 
     | 
    
         
            -
                  extend ActiveSupport::PerThreadRegistry
         
     | 
| 
       14 
     | 
    
         
            -
                  attr_accessor :options
         
     | 
| 
      
 11 
     | 
    
         
            +
                  thread_mattr_accessor :options
         
     | 
| 
       15 
12 
     | 
    
         
             
                end
         
     | 
| 
       16 
13 
     | 
    
         | 
| 
       17 
14 
     | 
    
         
             
                module ClassMethods
         
     | 
| 
         @@ -1,17 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'active_support'
         
     | 
| 
       4 
     | 
    
         
            -
            require 'active_support/ 
     | 
| 
      
 4 
     | 
    
         
            +
            require 'active_support/core_ext/module/attribute_accessors_per_thread'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            module DHS
         
     | 
| 
       7 
7 
     | 
    
         
             
              module Interceptors
         
     | 
| 
       8 
8 
     | 
    
         
             
                module AutoOauth
         
     | 
| 
       9 
9 
     | 
    
         
             
                  extend ActiveSupport::Concern
         
     | 
| 
       10 
10 
     | 
    
         
             
                  class ThreadRegistry
         
     | 
| 
       11 
     | 
    
         
            -
                     
     | 
| 
       12 
     | 
    
         
            -
                    # Will switch to thread_mattr_accessor (which comes with Activesupport) when we dropping support for Active Support v4.
         
     | 
| 
       13 
     | 
    
         
            -
                    extend ActiveSupport::PerThreadRegistry
         
     | 
| 
       14 
     | 
    
         
            -
                    attr_accessor :access_token
         
     | 
| 
      
 11 
     | 
    
         
            +
                    thread_mattr_accessor :access_token
         
     | 
| 
       15 
12 
     | 
    
         
             
                  end
         
     | 
| 
       16 
13 
     | 
    
         
             
                end
         
     | 
| 
       17 
14 
     | 
    
         
             
              end
         
     | 
| 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'active_support'
         
     | 
| 
       4 
     | 
    
         
            -
            require 'active_support/ 
     | 
| 
      
 4 
     | 
    
         
            +
            require 'active_support/core_ext/module/attribute_accessors_per_thread'
         
     | 
| 
       5 
5 
     | 
    
         | 
| 
       6 
6 
     | 
    
         
             
            module DHS
         
     | 
| 
       7 
7 
     | 
    
         
             
              module Interceptors
         
     | 
| 
         @@ -9,10 +9,7 @@ module DHS 
     | 
|
| 
       9 
9 
     | 
    
         
             
                  extend ActiveSupport::Concern
         
     | 
| 
       10 
10 
     | 
    
         | 
| 
       11 
11 
     | 
    
         
             
                  class ThreadRegistry
         
     | 
| 
       12 
     | 
    
         
            -
                     
     | 
| 
       13 
     | 
    
         
            -
                    # Will switch to thread_mattr_accessor (which comes with Activesupport) when we dropping support for Active Support v4.
         
     | 
| 
       14 
     | 
    
         
            -
                    extend ActiveSupport::PerThreadRegistry
         
     | 
| 
       15 
     | 
    
         
            -
                    attr_accessor :log
         
     | 
| 
      
 12 
     | 
    
         
            +
                    thread_mattr_accessor :log
         
     | 
| 
       16 
13 
     | 
    
         
             
                  end
         
     | 
| 
       17 
14 
     | 
    
         
             
                end
         
     | 
| 
       18 
15 
     | 
    
         
             
              end
         
     | 
| 
         @@ -1,17 +1,13 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            # frozen_string_literal: true
         
     | 
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            require 'active_support'
         
     | 
| 
       4 
     | 
    
         
            -
            require 'active_support/ 
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
            require 'active_support/core_ext/module/attribute_accessors_per_thread'
         
     | 
| 
       6 
5 
     | 
    
         
             
            module DHS
         
     | 
| 
       7 
6 
     | 
    
         
             
              module Interceptors
         
     | 
| 
       8 
7 
     | 
    
         
             
                module RequestCycleCache
         
     | 
| 
       9 
8 
     | 
    
         
             
                  extend ActiveSupport::Concern
         
     | 
| 
       10 
9 
     | 
    
         
             
                  class ThreadRegistry
         
     | 
| 
       11 
     | 
    
         
            -
                     
     | 
| 
       12 
     | 
    
         
            -
                    # Will switch to thread_mattr_accessor (which comes with Activesupport) when we dropping support for Active Support v4.
         
     | 
| 
       13 
     | 
    
         
            -
                    extend ActiveSupport::PerThreadRegistry
         
     | 
| 
       14 
     | 
    
         
            -
                    attr_accessor :request_id
         
     | 
| 
      
 10 
     | 
    
         
            +
                    thread_mattr_accessor :request_id
         
     | 
| 
       15 
11 
     | 
    
         
             
                  end
         
     | 
| 
       16 
12 
     | 
    
         
             
                end
         
     | 
| 
       17 
13 
     | 
    
         
             
              end
         
     | 
| 
         @@ -9,7 +9,7 @@ class DHS::Pagination::NextParameter < DHS::Pagination::Base 
     | 
|
| 
       9 
9 
     | 
    
         
             
              end
         
     | 
| 
       10 
10 
     | 
    
         
             
              alias count total
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
       12 
     | 
    
         
            -
              def self.next_offset( 
     | 
| 
      
 12 
     | 
    
         
            +
              def self.next_offset(_offset, _limit)
         
     | 
| 
       13 
13 
     | 
    
         
             
                nil
         
     | 
| 
       14 
14 
     | 
    
         
             
              end
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
         @@ -24,7 +24,7 @@ class DHS::Pagination::NextParameter < DHS::Pagination::Base 
     | 
|
| 
       24 
24 
     | 
    
         | 
| 
       25 
25 
     | 
    
         
             
              def next(current)
         
     | 
| 
       26 
26 
     | 
    
         
             
                next_value = current.dig(*_record.pagination_key(:body))
         
     | 
| 
       27 
     | 
    
         
            -
                return if next_value.blank? 
     | 
| 
      
 27 
     | 
    
         
            +
                return if next_value.blank?
         
     | 
| 
       28 
28 
     | 
    
         
             
                {
         
     | 
| 
       29 
29 
     | 
    
         
             
                  _record.pagination_key(:parameter) => current.dig(*_record.pagination_key(:body))
         
     | 
| 
       30 
30 
     | 
    
         
             
                }
         
     | 
    
        data/lib/dhs/version.rb
    CHANGED
    
    
| 
         @@ -4,9 +4,8 @@ require 'rails_helper' 
     | 
|
| 
       4 
4 
     | 
    
         | 
| 
       5 
5 
     | 
    
         
             
            describe DHS::Record do
         
     | 
| 
       6 
6 
     | 
    
         
             
              context 'next parameter pagination' do
         
     | 
| 
       7 
     | 
    
         
            -
                
         
     | 
| 
       8 
7 
     | 
    
         
             
                def stub_api_request(this_parameter:, next_parameter:, items: [])
         
     | 
| 
       9 
     | 
    
         
            -
                  stub_request(:get, [ 
     | 
| 
      
 8 
     | 
    
         
            +
                  stub_request(:get, ['http://depay.fi/v2/transactions?limit=100', this_parameter ? "next=#{this_parameter}" : nil].compact.join('&'))
         
     | 
| 
       10 
9 
     | 
    
         
             
                    .to_return(body: { items: items, next: next_parameter }.to_json)
         
     | 
| 
       11 
10 
     | 
    
         
             
                end
         
     | 
| 
       12 
11 
     | 
    
         | 
| 
         @@ -31,9 +30,8 @@ describe DHS::Record do 
     | 
|
| 
       31 
30 
     | 
    
         
             
              end
         
     | 
| 
       32 
31 
     | 
    
         | 
| 
       33 
32 
     | 
    
         
             
              context 'next parameter pagination with items configuration and nil response' do
         
     | 
| 
       34 
     | 
    
         
            -
             
     | 
| 
       35 
33 
     | 
    
         
             
                def stub_api_request(this_parameter:, next_parameter:, items: [])
         
     | 
| 
       36 
     | 
    
         
            -
                  stub_request(:get, [ 
     | 
| 
      
 34 
     | 
    
         
            +
                  stub_request(:get, ['http://depay.fi/v2/transactions?limit=100', this_parameter ? "next=#{this_parameter}" : nil].compact.join('&'))
         
     | 
| 
       37 
35 
     | 
    
         
             
                    .to_return(body: { assets: items, next: next_parameter }.to_json)
         
     | 
| 
       38 
36 
     | 
    
         
             
                end
         
     | 
| 
       39 
37 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: dhs
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.6.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - https://github.com/DePayFi/dhs/graphs/contributors
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-04-30 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activemodel
         
     | 
| 
         @@ -38,6 +38,20 @@ dependencies: 
     | 
|
| 
       38 
38 
     | 
    
         
             
                - - ">="
         
     | 
| 
       39 
39 
     | 
    
         
             
                  - !ruby/object:Gem::Version
         
     | 
| 
       40 
40 
     | 
    
         
             
                    version: '6'
         
     | 
| 
      
 41 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 42 
     | 
    
         
            +
              name: nio4r
         
     | 
| 
      
 43 
     | 
    
         
            +
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
      
 44 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 45 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 46 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 47 
     | 
    
         
            +
                    version: 2.7.1
         
     | 
| 
      
 48 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 49 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 50 
     | 
    
         
            +
              version_requirements: !ruby/object:Gem::Requirement
         
     | 
| 
      
 51 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 52 
     | 
    
         
            +
                - - ">="
         
     | 
| 
      
 53 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 54 
     | 
    
         
            +
                    version: 2.7.1
         
     | 
| 
       41 
55 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       42 
56 
     | 
    
         
             
              name: dhc
         
     | 
| 
       43 
57 
     | 
    
         
             
              requirement: !ruby/object:Gem::Requirement
         
     | 
| 
         @@ -582,7 +596,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       582 
596 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       583 
597 
     | 
    
         
             
            requirements:
         
     | 
| 
       584 
598 
     | 
    
         
             
            - Ruby >= 2.7.2
         
     | 
| 
       585 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 599 
     | 
    
         
            +
            rubygems_version: 3.3.26
         
     | 
| 
       586 
600 
     | 
    
         
             
            signing_key:
         
     | 
| 
       587 
601 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       588 
602 
     | 
    
         
             
            summary: 'REST services accelerator: Rails gem providing an easy, active-record-like
         
     |