saddle 0.0.17 → 0.0.18
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 +8 -8
- data/Gemfile +3 -0
- data/Gemfile.lock +9 -0
- data/lib/saddle/middleware/logging/statsd.rb +2 -1
- data/lib/saddle/version.rb +1 -1
- data/spec/middleware_spec.rb +48 -0
- data/spec/{requester/multiple_spec.rb → multiple_spec.rb} +0 -0
- metadata +5 -3
    
        checksums.yaml
    CHANGED
    
    | @@ -1,15 +1,15 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            !binary "U0hBMQ==":
         | 
| 3 3 | 
             
              metadata.gz: !binary |-
         | 
| 4 | 
            -
                 | 
| 4 | 
            +
                NmNmNGZiMGJmYjkxMWYwZTRiYTJkODczNjA0ODcxYmU0ZjE1ZDQwYw==
         | 
| 5 5 | 
             
              data.tar.gz: !binary |-
         | 
| 6 | 
            -
                 | 
| 6 | 
            +
                ZjIxYmIyZDExYjc0NjMxMDk3N2UyOTRlNjY0MDdhODE4M2QxOWU4Nw==
         | 
| 7 7 | 
             
            !binary "U0hBNTEy":
         | 
| 8 8 | 
             
              metadata.gz: !binary |-
         | 
| 9 | 
            -
                 | 
| 10 | 
            -
                 | 
| 11 | 
            -
                 | 
| 9 | 
            +
                MGFiM2QyY2E3NTllMjA5ZDMyMGUzOTFlYzZjN2FiNGYxM2Q4Yzg4ZTkyYzFl
         | 
| 10 | 
            +
                ZjZkMjJhYjRkNjhmNDM0MWIyZTZhZmVkODJjMTYxNTk2MmIwODFhMWZkZWJl
         | 
| 11 | 
            +
                NmMyMmFmNzQ2YWVhNDYxODdmOTJkMTI0OTJlODUwNzQ2MTg3ZDI=
         | 
| 12 12 | 
             
              data.tar.gz: !binary |-
         | 
| 13 | 
            -
                 | 
| 14 | 
            -
                 | 
| 15 | 
            -
                 | 
| 13 | 
            +
                ZDk5MGQ5MTU4ZDA1OTUxNmZkNDFkZWUxNDdlNjdmMzMxOTJmNmQzNWViZWVk
         | 
| 14 | 
            +
                YjBlMDNiMWE5N2I2OTYyNTU2NDgyY2EwNjQxNDQ4OWY3ZTZmNzgzOGEwNGVh
         | 
| 15 | 
            +
                ODdiMzU3ZGJhOTdhMWFiMmI5ZWNlYmUwZjU3MjllZjNkZGI1ZjE=
         | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -4,12 +4,18 @@ GEM | |
| 4 4 | 
             
                activesupport (3.2.13)
         | 
| 5 5 | 
             
                  i18n (= 0.6.1)
         | 
| 6 6 | 
             
                  multi_json (~> 1.0)
         | 
| 7 | 
            +
                airbrake (3.1.12)
         | 
| 8 | 
            +
                  activesupport
         | 
| 9 | 
            +
                  builder
         | 
| 10 | 
            +
                  json
         | 
| 11 | 
            +
                builder (3.2.0)
         | 
| 7 12 | 
             
                diff-lcs (1.2.4)
         | 
| 8 13 | 
             
                faraday (0.8.7)
         | 
| 9 14 | 
             
                  multipart-post (~> 1.1)
         | 
| 10 15 | 
             
                faraday_middleware (0.9.0)
         | 
| 11 16 | 
             
                  faraday (>= 0.7.4, < 0.9)
         | 
| 12 17 | 
             
                i18n (0.6.1)
         | 
| 18 | 
            +
                json (1.7.7)
         | 
| 13 19 | 
             
                multi_json (1.7.3)
         | 
| 14 20 | 
             
                multipart-post (1.2.0)
         | 
| 15 21 | 
             
                rspec (2.13.0)
         | 
| @@ -21,13 +27,16 @@ GEM | |
| 21 27 | 
             
                  diff-lcs (>= 1.1.3, < 2.0)
         | 
| 22 28 | 
             
                rspec-instafail (0.2.4)
         | 
| 23 29 | 
             
                rspec-mocks (2.13.1)
         | 
| 30 | 
            +
                statsd-ruby (1.2.0)
         | 
| 24 31 |  | 
| 25 32 | 
             
            PLATFORMS
         | 
| 26 33 | 
             
              ruby
         | 
| 27 34 |  | 
| 28 35 | 
             
            DEPENDENCIES
         | 
| 29 36 | 
             
              activesupport (>= 3.0)
         | 
| 37 | 
            +
              airbrake
         | 
| 30 38 | 
             
              faraday (~> 0.8.7)
         | 
| 31 39 | 
             
              faraday_middleware (~> 0.9.0)
         | 
| 32 40 | 
             
              rspec (~> 2.13.0)
         | 
| 33 41 | 
             
              rspec-instafail (~> 0.2)
         | 
| 42 | 
            +
              statsd-ruby
         | 
| @@ -31,7 +31,6 @@ module Saddle | |
| 31 31 |  | 
| 32 32 | 
             
                    def call(env)
         | 
| 33 33 | 
             
                      # Try to build up a path for the STATSD logging
         | 
| 34 | 
            -
                      statsd_path = nil
         | 
| 35 34 | 
             
                      if env[:request][:statsd_path]
         | 
| 36 35 | 
             
                        statsd_path = env[:request][:statsd_path]
         | 
| 37 36 | 
             
                      elsif env[:request][:saddle]
         | 
| @@ -41,6 +40,8 @@ module Saddle | |
| 41 40 | 
             
                          env[:request][:saddle][:call_chain] +
         | 
| 42 41 | 
             
                          [env[:request][:saddle][:action]]
         | 
| 43 42 | 
             
                        ).join('.')
         | 
| 43 | 
            +
                      else
         | 
| 44 | 
            +
                        statsd_path = "saddle.raw.#{env[:host].to_s}.#{env[:path].to_s}"
         | 
| 44 45 | 
             
                      end
         | 
| 45 46 |  | 
| 46 47 | 
             
                      # If we have a path, wrap the ensuing app call in STATSD timing
         | 
    
        data/lib/saddle/version.rb
    CHANGED
    
    
| @@ -0,0 +1,48 @@ | |
| 1 | 
            +
            require 'saddle'
         | 
| 2 | 
            +
            require 'saddle/middleware/logging/airbrake'
         | 
| 3 | 
            +
            require 'saddle/middleware/logging/statsd'
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            describe Saddle::Client do
         | 
| 6 | 
            +
             | 
| 7 | 
            +
              context "Test middlewares" do
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                before :each do
         | 
| 10 | 
            +
                  @stubs = Faraday::Adapter::Test::Stubs.new do |stub|
         | 
| 11 | 
            +
                    stub.get('/test') {
         | 
| 12 | 
            +
                      [
         | 
| 13 | 
            +
                        200,
         | 
| 14 | 
            +
                        {},
         | 
| 15 | 
            +
                        'Party on!',
         | 
| 16 | 
            +
                      ]
         | 
| 17 | 
            +
                    }
         | 
| 18 | 
            +
                  end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
                  @default_client = Saddle::Client.create(:stubs => @stubs)
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
             | 
| 24 | 
            +
                it "test logging/airbrake" do
         | 
| 25 | 
            +
                  class AirbrakeClient < Saddle::Client
         | 
| 26 | 
            +
                    add_middleware({
         | 
| 27 | 
            +
                      :klass => Saddle::Middleware::Logging::AirbrakeLogger,
         | 
| 28 | 
            +
                    })
         | 
| 29 | 
            +
                  end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                  client = AirbrakeClient.create(:stubs => @stubs)
         | 
| 32 | 
            +
                  client.requester.get('/test').should == 'Party on!'
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                it "test logging/statsd" do
         | 
| 36 | 
            +
                  class StatsdClient < Saddle::Client
         | 
| 37 | 
            +
                    add_middleware({
         | 
| 38 | 
            +
                      :klass => Saddle::Middleware::Logging::StatsdLogger,
         | 
| 39 | 
            +
                      :args => ['127.0.0.1'],
         | 
| 40 | 
            +
                    })
         | 
| 41 | 
            +
                  end
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                  client = StatsdClient.create(:stubs => @stubs)
         | 
| 44 | 
            +
                  client.requester.get('/test').should == 'Party on!'
         | 
| 45 | 
            +
                end
         | 
| 46 | 
            +
             | 
| 47 | 
            +
              end
         | 
| 48 | 
            +
            end
         | 
| 
            File without changes
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: saddle
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.0. | 
| 4 | 
            +
              version: 0.0.18
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Mike Lewis
         | 
| @@ -81,8 +81,9 @@ files: | |
| 81 81 | 
             
            - lib/saddle/requester.rb
         | 
| 82 82 | 
             
            - lib/saddle/version.rb
         | 
| 83 83 | 
             
            - saddle.gemspec
         | 
| 84 | 
            +
            - spec/middleware_spec.rb
         | 
| 85 | 
            +
            - spec/multiple_spec.rb
         | 
| 84 86 | 
             
            - spec/requester/get_spec.rb
         | 
| 85 | 
            -
            - spec/requester/multiple_spec.rb
         | 
| 86 87 | 
             
            - spec/requester/post_spec.rb
         | 
| 87 88 | 
             
            - spec/requester/retry_spec.rb
         | 
| 88 89 | 
             
            homepage: https://github.com/mLewisLogic/saddle
         | 
| @@ -111,7 +112,8 @@ specification_version: 4 | |
| 111 112 | 
             
            summary: A full-featured, generic consumer layer for you to build API client implementations
         | 
| 112 113 | 
             
              with.
         | 
| 113 114 | 
             
            test_files:
         | 
| 115 | 
            +
            - spec/middleware_spec.rb
         | 
| 116 | 
            +
            - spec/multiple_spec.rb
         | 
| 114 117 | 
             
            - spec/requester/get_spec.rb
         | 
| 115 | 
            -
            - spec/requester/multiple_spec.rb
         | 
| 116 118 | 
             
            - spec/requester/post_spec.rb
         | 
| 117 119 | 
             
            - spec/requester/retry_spec.rb
         |