justlogging-rails 0.0.6 → 0.0.7
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.
- data/Gemfile.lock +37 -37
- data/lib/justlogging/transaction.rb +1 -1
- data/lib/justlogging/transmitter.rb +8 -3
- data/lib/justlogging/version.rb +1 -1
- data/spec/justlogging/transmitter_spec.rb +4 -4
- metadata +1 -1
    
        data/Gemfile.lock
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            PATH
         | 
| 2 2 | 
             
              remote: .
         | 
| 3 3 | 
             
              specs:
         | 
| 4 | 
            -
                justlogging-rails (0.0. | 
| 4 | 
            +
                justlogging-rails (0.0.6)
         | 
| 5 5 | 
             
                  rails
         | 
| 6 6 | 
             
                  rake
         | 
| 7 7 | 
             
                  rspec
         | 
| @@ -9,41 +9,41 @@ PATH | |
| 9 9 | 
             
            GEM
         | 
| 10 10 | 
             
              remote: https://rubygems.org/
         | 
| 11 11 | 
             
              specs:
         | 
| 12 | 
            -
                actionmailer (3.2. | 
| 13 | 
            -
                  actionpack (= 3.2. | 
| 12 | 
            +
                actionmailer (3.2.7)
         | 
| 13 | 
            +
                  actionpack (= 3.2.7)
         | 
| 14 14 | 
             
                  mail (~> 2.4.4)
         | 
| 15 | 
            -
                actionpack (3.2. | 
| 16 | 
            -
                  activemodel (= 3.2. | 
| 17 | 
            -
                  activesupport (= 3.2. | 
| 15 | 
            +
                actionpack (3.2.7)
         | 
| 16 | 
            +
                  activemodel (= 3.2.7)
         | 
| 17 | 
            +
                  activesupport (= 3.2.7)
         | 
| 18 18 | 
             
                  builder (~> 3.0.0)
         | 
| 19 19 | 
             
                  erubis (~> 2.7.0)
         | 
| 20 | 
            -
                  journey (~> 1.0. | 
| 20 | 
            +
                  journey (~> 1.0.4)
         | 
| 21 21 | 
             
                  rack (~> 1.4.0)
         | 
| 22 22 | 
             
                  rack-cache (~> 1.2)
         | 
| 23 23 | 
             
                  rack-test (~> 0.6.1)
         | 
| 24 24 | 
             
                  sprockets (~> 2.1.3)
         | 
| 25 | 
            -
                activemodel (3.2. | 
| 26 | 
            -
                  activesupport (= 3.2. | 
| 25 | 
            +
                activemodel (3.2.7)
         | 
| 26 | 
            +
                  activesupport (= 3.2.7)
         | 
| 27 27 | 
             
                  builder (~> 3.0.0)
         | 
| 28 | 
            -
                activerecord (3.2. | 
| 29 | 
            -
                  activemodel (= 3.2. | 
| 30 | 
            -
                  activesupport (= 3.2. | 
| 28 | 
            +
                activerecord (3.2.7)
         | 
| 29 | 
            +
                  activemodel (= 3.2.7)
         | 
| 30 | 
            +
                  activesupport (= 3.2.7)
         | 
| 31 31 | 
             
                  arel (~> 3.0.2)
         | 
| 32 32 | 
             
                  tzinfo (~> 0.3.29)
         | 
| 33 | 
            -
                activeresource (3.2. | 
| 34 | 
            -
                  activemodel (= 3.2. | 
| 35 | 
            -
                  activesupport (= 3.2. | 
| 36 | 
            -
                activesupport (3.2. | 
| 33 | 
            +
                activeresource (3.2.7)
         | 
| 34 | 
            +
                  activemodel (= 3.2.7)
         | 
| 35 | 
            +
                  activesupport (= 3.2.7)
         | 
| 36 | 
            +
                activesupport (3.2.7)
         | 
| 37 37 | 
             
                  i18n (~> 0.6)
         | 
| 38 38 | 
             
                  multi_json (~> 1.0)
         | 
| 39 39 | 
             
                arel (3.0.2)
         | 
| 40 | 
            -
                builder (3.0. | 
| 40 | 
            +
                builder (3.0.2)
         | 
| 41 41 | 
             
                diff-lcs (1.1.3)
         | 
| 42 42 | 
             
                erubis (2.7.0)
         | 
| 43 43 | 
             
                hike (1.2.1)
         | 
| 44 | 
            -
                i18n (0.6. | 
| 44 | 
            +
                i18n (0.6.1)
         | 
| 45 45 | 
             
                journey (1.0.4)
         | 
| 46 | 
            -
                json (1.7. | 
| 46 | 
            +
                json (1.7.5)
         | 
| 47 47 | 
             
                mail (2.4.4)
         | 
| 48 48 | 
             
                  i18n (>= 0.4.0)
         | 
| 49 49 | 
             
                  mime-types (~> 1.16)
         | 
| @@ -58,17 +58,17 @@ GEM | |
| 58 58 | 
             
                  rack
         | 
| 59 59 | 
             
                rack-test (0.6.1)
         | 
| 60 60 | 
             
                  rack (>= 1.0)
         | 
| 61 | 
            -
                rails (3.2. | 
| 62 | 
            -
                  actionmailer (= 3.2. | 
| 63 | 
            -
                  actionpack (= 3.2. | 
| 64 | 
            -
                  activerecord (= 3.2. | 
| 65 | 
            -
                  activeresource (= 3.2. | 
| 66 | 
            -
                  activesupport (= 3.2. | 
| 61 | 
            +
                rails (3.2.7)
         | 
| 62 | 
            +
                  actionmailer (= 3.2.7)
         | 
| 63 | 
            +
                  actionpack (= 3.2.7)
         | 
| 64 | 
            +
                  activerecord (= 3.2.7)
         | 
| 65 | 
            +
                  activeresource (= 3.2.7)
         | 
| 66 | 
            +
                  activesupport (= 3.2.7)
         | 
| 67 67 | 
             
                  bundler (~> 1.0)
         | 
| 68 | 
            -
                  railties (= 3.2. | 
| 69 | 
            -
                railties (3.2. | 
| 70 | 
            -
                  actionpack (= 3.2. | 
| 71 | 
            -
                  activesupport (= 3.2. | 
| 68 | 
            +
                  railties (= 3.2.7)
         | 
| 69 | 
            +
                railties (3.2.7)
         | 
| 70 | 
            +
                  actionpack (= 3.2.7)
         | 
| 71 | 
            +
                  activesupport (= 3.2.7)
         | 
| 72 72 | 
             
                  rack-ssl (~> 1.3.2)
         | 
| 73 73 | 
             
                  rake (>= 0.8.7)
         | 
| 74 74 | 
             
                  rdoc (~> 3.4)
         | 
| @@ -76,19 +76,19 @@ GEM | |
| 76 76 | 
             
                rake (0.9.2.2)
         | 
| 77 77 | 
             
                rdoc (3.12)
         | 
| 78 78 | 
             
                  json (~> 1.4)
         | 
| 79 | 
            -
                rspec (2. | 
| 80 | 
            -
                  rspec-core (~> 2. | 
| 81 | 
            -
                  rspec-expectations (~> 2. | 
| 82 | 
            -
                  rspec-mocks (~> 2. | 
| 83 | 
            -
                rspec-core (2. | 
| 84 | 
            -
                rspec-expectations (2. | 
| 79 | 
            +
                rspec (2.11.0)
         | 
| 80 | 
            +
                  rspec-core (~> 2.11.0)
         | 
| 81 | 
            +
                  rspec-expectations (~> 2.11.0)
         | 
| 82 | 
            +
                  rspec-mocks (~> 2.11.0)
         | 
| 83 | 
            +
                rspec-core (2.11.1)
         | 
| 84 | 
            +
                rspec-expectations (2.11.2)
         | 
| 85 85 | 
             
                  diff-lcs (~> 1.1.3)
         | 
| 86 | 
            -
                rspec-mocks (2. | 
| 86 | 
            +
                rspec-mocks (2.11.2)
         | 
| 87 87 | 
             
                sprockets (2.1.3)
         | 
| 88 88 | 
             
                  hike (~> 1.2)
         | 
| 89 89 | 
             
                  rack (~> 1.0)
         | 
| 90 90 | 
             
                  tilt (~> 1.1, != 1.3.0)
         | 
| 91 | 
            -
                thor (0. | 
| 91 | 
            +
                thor (0.16.0)
         | 
| 92 92 | 
             
                tilt (1.3.3)
         | 
| 93 93 | 
             
                treetop (1.4.10)
         | 
| 94 94 | 
             
                  polyglot
         | 
| @@ -91,7 +91,7 @@ module Justlogging | |
| 91 91 | 
             
                def complete!
         | 
| 92 92 | 
             
                  Thread.current[:justlogging_transaction_id] = nil
         | 
| 93 93 | 
             
                  current_transaction = Justlogging.transactions.delete(@id)
         | 
| 94 | 
            -
                  if @events.any? ||  | 
| 94 | 
            +
                  if @events.any? || exception?
         | 
| 95 95 | 
             
                    Justlogging.agent.add_to_queue(current_transaction.to_hash)
         | 
| 96 96 | 
             
                  end
         | 
| 97 97 | 
             
                end
         | 
| @@ -27,12 +27,17 @@ module Justlogging | |
| 27 27 | 
             
                end
         | 
| 28 28 |  | 
| 29 29 | 
             
                def encoded_message(payload)
         | 
| 30 | 
            -
                   | 
| 30 | 
            +
                  encoded_payload = {}.tap do |hsh|
         | 
| 31 | 
            +
                    payload.each do |key, val|
         | 
| 32 | 
            +
                      hsh[key] = ActiveSupport::JSON.encode(val)
         | 
| 33 | 
            +
                    end
         | 
| 34 | 
            +
                  end
         | 
| 35 | 
            +
                  message(encoded_payload)
         | 
| 31 36 | 
             
                end
         | 
| 32 37 |  | 
| 33 | 
            -
                def message( | 
| 38 | 
            +
                def message(encoded_hash)
         | 
| 34 39 | 
             
                  Net::HTTP::Post.new(uri.request_uri).tap do |post|
         | 
| 35 | 
            -
                    post.set_form_data( | 
| 40 | 
            +
                    post.set_form_data(encoded_hash.reverse_merge('api_key' => api_key))
         | 
| 36 41 | 
             
                  end
         | 
| 37 42 | 
             
                end
         | 
| 38 43 |  | 
    
        data/lib/justlogging/version.rb
    CHANGED
    
    
| @@ -34,16 +34,16 @@ describe Justlogging::Transmitter do | |
| 34 34 |  | 
| 35 35 | 
             
              describe "#encoded_message" do
         | 
| 36 36 | 
             
                it "calls message" do
         | 
| 37 | 
            -
                  ActiveSupport::JSON.stub(:encode => : | 
| 38 | 
            -
                  subject.should_receive(:message).with(: | 
| 37 | 
            +
                  ActiveSupport::JSON.stub(:encode => "{a:'b'}")
         | 
| 38 | 
            +
                  subject.should_receive(:message).with(:payload => "{a:'b'}")
         | 
| 39 39 | 
             
                end
         | 
| 40 40 |  | 
| 41 41 | 
             
                it "encodes the payload using json" do
         | 
| 42 42 | 
             
                  subject.stub(:message)
         | 
| 43 | 
            -
                  ActiveSupport::JSON.should_receive(:encode).with( | 
| 43 | 
            +
                  ActiveSupport::JSON.should_receive(:encode).with({"a"=>"b"})
         | 
| 44 44 | 
             
                end
         | 
| 45 45 |  | 
| 46 | 
            -
                after { subject.encoded_message(:payload) }
         | 
| 46 | 
            +
                after { subject.encoded_message(:payload => {'a' => 'b'}) }
         | 
| 47 47 | 
             
              end
         | 
| 48 48 |  | 
| 49 49 | 
             
              describe "#message" do
         |