unimatrix 3.3.0 → 3.3.1
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/VERSION +1 -1
 - data/lib/unimatrix.rb +1 -0
 - data/lib/unimatrix/operation.rb +10 -6
 - data/lib/unimatrix/request.rb +25 -4
 - data/lib/unimatrix/timeout_error.rb +6 -0
 - metadata +4 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 855794135ee5becfbca9f3a05a06c2161d162f5f
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c993f1bf6e5ec5e5f349acf426aedfbf054abd32
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b9ccc0ca311d3db7ddf1fb99f943fe0e2e26cfe5efc82f6552592385bd1504bed67474bdc35bf501a4bf5805c50f4b8a640b4440869cc7acbc5a200b15bd3e4d
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: b83ffd34ed213f719a7bbad2235d75a547b877186f7c111e0852df1431584bf642e448326dc2d649fbf40f33e0f92e4d6fbec828fe2859a6be3c2a7ac9e43312
         
     | 
    
        data/VERSION
    CHANGED
    
    | 
         @@ -1 +1 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            3.3. 
     | 
| 
      
 1 
     | 
    
         
            +
            3.3.1
         
     | 
    
        data/lib/unimatrix.rb
    CHANGED
    
    
    
        data/lib/unimatrix/operation.rb
    CHANGED
    
    | 
         @@ -55,12 +55,16 @@ module Unimatrix 
     | 
|
| 
       55 
55 
     | 
    
         
             
                  response = nil
         
     | 
| 
       56 
56 
     | 
    
         
             
                  Request.new.tap do | request |
         
     | 
| 
       57 
57 
     | 
    
         
             
                    request.get( @path, @parameters ).tap do | response |
         
     | 
| 
       58 
     | 
    
         
            -
                       
     | 
| 
       59 
     | 
    
         
            -
             
     | 
| 
       60 
     | 
    
         
            -
             
     | 
| 
       61 
     | 
    
         
            -
             
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
                           
     | 
| 
      
 58 
     | 
    
         
            +
                      if response.is_a?( Error )
         
     | 
| 
      
 59 
     | 
    
         
            +
                        result = response
         
     | 
| 
      
 60 
     | 
    
         
            +
                      else
         
     | 
| 
      
 61 
     | 
    
         
            +
                        result = response.resources
         
     | 
| 
      
 62 
     | 
    
         
            +
                        if block_given?
         
     | 
| 
      
 63 
     | 
    
         
            +
                          case block.arity
         
     | 
| 
      
 64 
     | 
    
         
            +
                            when 0; yield
         
     | 
| 
      
 65 
     | 
    
         
            +
                            when 1; yield result
         
     | 
| 
      
 66 
     | 
    
         
            +
                            when 2; yield result, response
         
     | 
| 
      
 67 
     | 
    
         
            +
                          end
         
     | 
| 
       64 
68 
     | 
    
         
             
                        end
         
     | 
| 
       65 
69 
     | 
    
         
             
                      end
         
     | 
| 
       66 
70 
     | 
    
         
             
                    end
         
     | 
    
        data/lib/unimatrix/request.rb
    CHANGED
    
    | 
         @@ -8,6 +8,11 @@ module Unimatrix 
     | 
|
| 
       8 
8 
     | 
    
         
             
                def initialize( default_parameters = {} )
         
     | 
| 
       9 
9 
     | 
    
         
             
                  uri   = URI( Unimatrix.configuration.url )
         
     | 
| 
       10 
10 
     | 
    
         
             
                  @http = Net::HTTP.new( uri.host, uri.port )
         
     | 
| 
      
 11 
     | 
    
         
            +
                  
         
     | 
| 
      
 12 
     | 
    
         
            +
                  timeout_limit = ( ENV[ 'TIMEOUT_LIMIT' ] || 60 ).to_i
         
     | 
| 
      
 13 
     | 
    
         
            +
                  
         
     | 
| 
      
 14 
     | 
    
         
            +
                  @http.open_timeout = timeout_limit
         
     | 
| 
      
 15 
     | 
    
         
            +
                  @http.read_timeout = timeout_limit
         
     | 
| 
       11 
16 
     | 
    
         | 
| 
       12 
17 
     | 
    
         
             
                  @http.use_ssl = ( uri.scheme == 'https' )
         
     | 
| 
       13 
18 
     | 
    
         
             
                  @http.verify_mode = OpenSSL::SSL::VERIFY_NONE
         
     | 
| 
         @@ -55,16 +60,24 @@ module Unimatrix 
     | 
|
| 
       55 
60 
     | 
    
         
             
                      begin
         
     | 
| 
       56 
61 
     | 
    
         
             
                        yield
         
     | 
| 
       57 
62 
     | 
    
         
             
                      rescue Timeout::Error => error
         
     | 
| 
      
 63 
     | 
    
         
            +
                        log_error( error.inspect )
         
     | 
| 
      
 64 
     | 
    
         
            +
                        
         
     | 
| 
       58 
65 
     | 
    
         
             
                        error
         
     | 
| 
       59 
66 
     | 
    
         
             
                      end
         
     | 
| 
       60 
67 
     | 
    
         | 
| 
       61 
     | 
    
         
            -
                    unless response.nil? ||  
     | 
| 
       62 
     | 
    
         
            -
             
     | 
| 
       63 
     | 
    
         
            -
             
     | 
| 
       64 
     | 
    
         
            -
             
     | 
| 
      
 68 
     | 
    
         
            +
                    unless response.nil? || 
         
     | 
| 
      
 69 
     | 
    
         
            +
                           ( response.is_a?( Response ) && retry_codes.include?( response.code ) ) || 
         
     | 
| 
      
 70 
     | 
    
         
            +
                           response.is_a?( Timeout::Error )
         
     | 
| 
      
 71 
     | 
    
         
            +
                           
         
     | 
| 
       65 
72 
     | 
    
         
             
                      break
         
     | 
| 
       66 
73 
     | 
    
         
             
                    end
         
     | 
| 
       67 
74 
     | 
    
         
             
                  end
         
     | 
| 
      
 75 
     | 
    
         
            +
                  
         
     | 
| 
      
 76 
     | 
    
         
            +
                  if response.is_a?( Timeout::Error )
         
     | 
| 
      
 77 
     | 
    
         
            +
                    response = Unimatrix::TimeoutError.new(
         
     | 
| 
      
 78 
     | 
    
         
            +
                      message: response.message
         
     | 
| 
      
 79 
     | 
    
         
            +
                    )
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
       68 
81 
     | 
    
         | 
| 
       69 
82 
     | 
    
         
             
                  response
         
     | 
| 
       70 
83 
     | 
    
         
             
                end
         
     | 
| 
         @@ -78,6 +91,14 @@ module Unimatrix 
     | 
|
| 
       78 
91 
     | 
    
         | 
| 
       79 
92 
     | 
    
         
             
                  addressable.to_s
         
     | 
| 
       80 
93 
     | 
    
         
             
                end
         
     | 
| 
      
 94 
     | 
    
         
            +
                
         
     | 
| 
      
 95 
     | 
    
         
            +
                protected; def log_error( message )
         
     | 
| 
      
 96 
     | 
    
         
            +
                  if defined?( logger.error )
         
     | 
| 
      
 97 
     | 
    
         
            +
                    logger.error( message )
         
     | 
| 
      
 98 
     | 
    
         
            +
                  else
         
     | 
| 
      
 99 
     | 
    
         
            +
                    puts "Error: #{ message }"
         
     | 
| 
      
 100 
     | 
    
         
            +
                  end
         
     | 
| 
      
 101 
     | 
    
         
            +
                end
         
     | 
| 
       81 
102 
     | 
    
         | 
| 
       82 
103 
     | 
    
         
             
              end
         
     | 
| 
       83 
104 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: unimatrix
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 3.3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.3.1
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Jackson Souza
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2018-09- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2018-09-26 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: activesupport
         
     | 
| 
         @@ -180,6 +180,7 @@ files: 
     | 
|
| 
       180 
180 
     | 
    
         
             
            - lib/unimatrix/resource.rb
         
     | 
| 
       181 
181 
     | 
    
         
             
            - lib/unimatrix/response.rb
         
     | 
| 
       182 
182 
     | 
    
         
             
            - lib/unimatrix/serializer.rb
         
     | 
| 
      
 183 
     | 
    
         
            +
            - lib/unimatrix/timeout_error.rb
         
     | 
| 
       183 
184 
     | 
    
         
             
            - lib/unimatrix/version.rb
         
     | 
| 
       184 
185 
     | 
    
         
             
            - lib/unimatrix/zephyrus/conversion_output.rb
         
     | 
| 
       185 
186 
     | 
    
         
             
            - lib/unimatrix/zephyrus/input.rb
         
     | 
| 
         @@ -213,7 +214,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       213 
214 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       214 
215 
     | 
    
         
             
            requirements: []
         
     | 
| 
       215 
216 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       216 
     | 
    
         
            -
            rubygems_version: 2. 
     | 
| 
      
 217 
     | 
    
         
            +
            rubygems_version: 2.4.8
         
     | 
| 
       217 
218 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       218 
219 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       219 
220 
     | 
    
         
             
            summary: Unimatrix is used to communicate with Unimatrix APIs.
         
     |