pliny 0.26.1 → 0.26.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pliny.rb +1 -0
- data/lib/pliny/error_reporters/rollbar.rb +1 -0
- data/lib/pliny/helpers/zulu_time.rb +7 -0
- data/lib/pliny/templates/serializer.erb +2 -2
- data/lib/pliny/version.rb +1 -1
- data/lib/template/lib/serializers/base.rb +2 -0
- data/spec/error_reporters/rollbar_spec.rb +18 -0
- data/spec/helpers/zulu_time_spec.rb +24 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0674c9e51c614274d0723faf5909baaf3bd30ae0
|
4
|
+
data.tar.gz: cc4c3a90ffec075c45faec036c20e7c2952c8841
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 96e3f87b327e5f1dde9d38ac1c650c97c2444e150d7e517f7fc8ff3969f8809f129608441b7ba4f0b7eba68e157cc3dc13699edf8a56fe10dd24d27a8d350c42
|
7
|
+
data.tar.gz: c715b6fd2f04af1869549d7999c1f2f0f79990a9f9e0eeb6de1b47b73f6895d7ebea913f5277f67988ab5c8b5a2bd58273feb6bd4fe5f919eef38854aeb98393
|
data/lib/pliny.rb
CHANGED
@@ -8,6 +8,7 @@ require_relative "pliny/errors"
|
|
8
8
|
require_relative "pliny/helpers/encode"
|
9
9
|
require_relative "pliny/helpers/params"
|
10
10
|
require_relative "pliny/helpers/serialize"
|
11
|
+
require_relative "pliny/helpers/zulu_time"
|
11
12
|
require_relative "pliny/log"
|
12
13
|
require_relative "pliny/metrics/backends/logger"
|
13
14
|
require_relative "pliny/metrics"
|
@@ -10,9 +10,9 @@
|
|
10
10
|
<%= ident %>class <%= modules.last %> < Serializers::Base
|
11
11
|
<%= ident %> structure(:default) do |arg|
|
12
12
|
<%= ident %> {
|
13
|
-
<%= ident %> created_at: arg.created_at
|
13
|
+
<%= ident %> created_at: zulu_time(arg.created_at),
|
14
14
|
<%= ident %> id: arg.id,
|
15
|
-
<%= ident %> updated_at: arg.updated_at
|
15
|
+
<%= ident %> updated_at: zulu_time(arg.updated_at)
|
16
16
|
<%= ident %> }
|
17
17
|
<%= ident %> end
|
18
18
|
<%= ident %>end
|
data/lib/pliny/version.rb
CHANGED
@@ -33,6 +33,24 @@ describe Pliny::ErrorReporters::Rollbar do
|
|
33
33
|
))
|
34
34
|
end
|
35
35
|
|
36
|
+
context "given a rack_env with person data" do
|
37
|
+
let(:rack_env) do
|
38
|
+
{ "rollbar.person_data" => {
|
39
|
+
id: SecureRandom.uuid,
|
40
|
+
email: "foo@bar.com",
|
41
|
+
username: "foo"
|
42
|
+
}}
|
43
|
+
end
|
44
|
+
|
45
|
+
it "adds person to the rollbar notification" do
|
46
|
+
scope = nil
|
47
|
+
allow(::Rollbar).to receive(:scoped) { |arg| scope = arg }
|
48
|
+
notify
|
49
|
+
assert_kind_of(Proc, scope[:person])
|
50
|
+
assert_equal(rack_env["rollbar.person_data"], scope[:person].call)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
36
54
|
it "delegates to #report_exception_to_rollbar" do
|
37
55
|
notify
|
38
56
|
expect(reporter).to have_received(:report_exception_to_rollbar)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
require "active_support/core_ext/numeric/time"
|
3
|
+
|
4
|
+
describe Pliny::Helpers::ZuluTime do
|
5
|
+
context "zulu_time" do
|
6
|
+
class ZuluTimeTest
|
7
|
+
extend Pliny::Helpers::ZuluTime
|
8
|
+
end
|
9
|
+
|
10
|
+
it "it formats Time instances" do
|
11
|
+
formatted = ZuluTimeTest.zulu_time(Time.parse("2017-11-28T21:49:52.123+00:00"))
|
12
|
+
assert_equal "2017-11-28T21:49:52Z", formatted
|
13
|
+
end
|
14
|
+
|
15
|
+
it "it formats DateTime instances" do
|
16
|
+
formatted = ZuluTimeTest.zulu_time(DateTime.parse("2017-11-28T21:49:52.123+00:00"))
|
17
|
+
assert_equal "2017-11-28T21:49:52Z", formatted
|
18
|
+
end
|
19
|
+
|
20
|
+
it "when called with nil" do
|
21
|
+
assert_nil ZuluTimeTest.zulu_time(nil)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pliny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.26.
|
4
|
+
version: 0.26.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandur Leach
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-12-
|
12
|
+
date: 2017-12-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -395,6 +395,7 @@ files:
|
|
395
395
|
- lib/pliny/helpers/encode.rb
|
396
396
|
- lib/pliny/helpers/params.rb
|
397
397
|
- lib/pliny/helpers/serialize.rb
|
398
|
+
- lib/pliny/helpers/zulu_time.rb
|
398
399
|
- lib/pliny/log.rb
|
399
400
|
- lib/pliny/metrics.rb
|
400
401
|
- lib/pliny/metrics/backends/logger.rb
|
@@ -490,6 +491,7 @@ files:
|
|
490
491
|
- spec/helpers/encode_spec.rb
|
491
492
|
- spec/helpers/params_spec.rb
|
492
493
|
- spec/helpers/serialize_spec.rb
|
494
|
+
- spec/helpers/zulu_time_spec.rb
|
493
495
|
- spec/integration_spec.rb
|
494
496
|
- spec/log_spec.rb
|
495
497
|
- spec/metrics/backends/logger_spec.rb
|