ribbon-intercom 0.4.1 → 0.4.2
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
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 96dc8a2e193fee5620575e5282637b2b2d393f98
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 0068e7e6615cf7de4ccbd6a88b1389c39959b09e
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: fa6ffc59e607e277eba4e251fb5406837ec8c99f3f3664ccf6474371608b1ac3170e8b9207d7a9e74e60450a134bcfb2090bfb5a8453dd698887f73604258e88
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 1c187c30b29c6a57deb6f1ec0d332337ade1ef873d81f929eb8991989248201dce052a9e56f8fc9024c93fc234dfe424500a3ba5bfdc896d992b3b1c1e8c1a96
         
     | 
| 
         @@ -107,18 +107,23 @@ module Ribbon::Intercom 
     | 
|
| 
       107 
107 
     | 
    
         | 
| 
       108 
108 
     | 
    
         
             
                def _process_request
         
     | 
| 
       109 
109 
     | 
    
         
             
                  _init_request
         
     | 
| 
       110 
     | 
    
         
            -
             
     | 
| 
       111 
     | 
    
         
            -
                   
     | 
| 
       112 
     | 
    
         
            -
             
     | 
| 
       113 
     | 
    
         
            -
             
     | 
| 
       114 
     | 
    
         
            -
             
     | 
| 
      
 110 
     | 
    
         
            +
             
     | 
| 
      
 111 
     | 
    
         
            +
                  if request.put?
         
     | 
| 
      
 112 
     | 
    
         
            +
                    _authenticate_request!
         
     | 
| 
      
 113 
     | 
    
         
            +
                    _load_request_packet
         
     | 
| 
      
 114 
     | 
    
         
            +
                    _load_subject
         
     | 
| 
      
 115 
     | 
    
         
            +
                    response_packet = _process_methods
         
     | 
| 
      
 116 
     | 
    
         
            +
                    _respond_with_packet(response_packet)
         
     | 
| 
      
 117 
     | 
    
         
            +
                  elsif request.get?
         
     | 
| 
      
 118 
     | 
    
         
            +
                    _perform_health_check
         
     | 
| 
      
 119 
     | 
    
         
            +
                  end
         
     | 
| 
       115 
120 
     | 
    
         
             
                end
         
     | 
| 
       116 
121 
     | 
    
         | 
| 
       117 
122 
     | 
    
         
             
                def _init_request
         
     | 
| 
       118 
123 
     | 
    
         
             
                  @request = Rack::Request.new(env)
         
     | 
| 
       119 
124 
     | 
    
         | 
| 
       120 
     | 
    
         
            -
                  unless request.put?
         
     | 
| 
       121 
     | 
    
         
            -
                    _error!(Errors::MethodNotAllowedError, 'only PUT allowed')
         
     | 
| 
      
 125 
     | 
    
         
            +
                  unless request.put? || request.get?
         
     | 
| 
      
 126 
     | 
    
         
            +
                    _error!(Errors::MethodNotAllowedError, 'only PUT or GET allowed')
         
     | 
| 
       122 
127 
     | 
    
         
             
                  end
         
     | 
| 
       123 
128 
     | 
    
         
             
                end
         
     | 
| 
       124 
129 
     | 
    
         | 
| 
         @@ -200,6 +205,14 @@ module Ribbon::Intercom 
     | 
|
| 
       200 
205 
     | 
    
         
             
                  _respond!(status, {}, packet.encode)
         
     | 
| 
       201 
206 
     | 
    
         
             
                end
         
     | 
| 
       202 
207 
     | 
    
         | 
| 
      
 208 
     | 
    
         
            +
                def _perform_health_check
         
     | 
| 
      
 209 
     | 
    
         
            +
                  if store.healthy?
         
     | 
| 
      
 210 
     | 
    
         
            +
                    _respond!(200)
         
     | 
| 
      
 211 
     | 
    
         
            +
                  else
         
     | 
| 
      
 212 
     | 
    
         
            +
                    _respond!(503)
         
     | 
| 
      
 213 
     | 
    
         
            +
                  end
         
     | 
| 
      
 214 
     | 
    
         
            +
                end
         
     | 
| 
      
 215 
     | 
    
         
            +
             
     | 
| 
       203 
216 
     | 
    
         
             
                def _request_authenticated?
         
     | 
| 
       204 
217 
     | 
    
         
             
                  auth = Rack::Auth::Basic::Request.new(env)
         
     | 
| 
       205 
218 
     | 
    
         | 
| 
         @@ -270,4 +283,4 @@ module Ribbon::Intercom 
     | 
|
| 
       270 
283 
     | 
    
         
             
                  }
         
     | 
| 
       271 
284 
     | 
    
         
             
                end
         
     | 
| 
       272 
285 
     | 
    
         
             
              end # Service
         
     | 
| 
       273 
     | 
    
         
            -
            end # Ribbon::Intercom
         
     | 
| 
      
 286 
     | 
    
         
            +
            end # Ribbon::Intercom
         
     | 
| 
         @@ -6,6 +6,13 @@ module Ribbon::Intercom 
     | 
|
| 
       6 
6 
     | 
    
         
             
                      Channel.new(self, params)
         
     | 
| 
       7 
7 
     | 
    
         
             
                    end
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
      
 9 
     | 
    
         
            +
                    def healthy?
         
     | 
| 
      
 10 
     | 
    
         
            +
                      token_exists?('healthcheck')
         
     | 
| 
      
 11 
     | 
    
         
            +
                      true
         
     | 
| 
      
 12 
     | 
    
         
            +
                    rescue
         
     | 
| 
      
 13 
     | 
    
         
            +
                      false
         
     | 
| 
      
 14 
     | 
    
         
            +
                    end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       9 
16 
     | 
    
         
             
                    def token_exists?(token)
         
     | 
| 
       10 
17 
     | 
    
         
             
                      raise NotImplementedError
         
     | 
| 
       11 
18 
     | 
    
         
             
                    end
         
     | 
| 
         @@ -28,4 +35,4 @@ module Ribbon::Intercom 
     | 
|
| 
       28 
35 
     | 
    
         
             
                  end # Store
         
     | 
| 
       29 
36 
     | 
    
         
             
                end # Channel::Stores
         
     | 
| 
       30 
37 
     | 
    
         
             
              end # Service
         
     | 
| 
       31 
     | 
    
         
            -
            end # Ribbon::Intercom
         
     | 
| 
      
 38 
     | 
    
         
            +
            end # Ribbon::Intercom
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: ribbon-intercom
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Robert Honer
         
     | 
| 
         @@ -9,7 +9,7 @@ authors: 
     | 
|
| 
       9 
9 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       10 
10 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       11 
11 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       12 
     | 
    
         
            -
            date: 2015- 
     | 
| 
      
 12 
     | 
    
         
            +
            date: 2015-07-11 00:00:00.000000000 Z
         
     | 
| 
       13 
13 
     | 
    
         
             
            dependencies:
         
     | 
| 
       14 
14 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       15 
15 
     | 
    
         
             
              name: rack
         
     |