timber 2.1.9 → 2.1.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/timber/contexts/custom.rb +2 -2
- data/lib/timber/contexts/organization.rb +2 -2
- data/lib/timber/contexts/runtime.rb +1 -1
- data/lib/timber/contexts/session.rb +2 -2
- data/lib/timber/contexts/system.rb +2 -3
- data/lib/timber/contexts/user.rb +2 -2
- data/lib/timber/version.rb +1 -1
- data/spec/timber/contexts/runtime_spec.rb +11 -0
- data/spec/timber/contexts/system_spec.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e83f2fd0fc9e2e55f2a81089ac80ef335255b82f
|
4
|
+
data.tar.gz: f860cc79667cc15469caf10600abfd9f4c5281a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81505965ac76980955b226ec83f5f43ba166b1ab671b5175a2a9f8f68e973bd7c320355c719f9b03792debe81ceac25c2e2832a517b1b931b31c28e8e31afb23
|
7
|
+
data.tar.gz: b2a072f8ca6c6092c3e2ecff9040ca420b1fb32a0282b728f81d5bc90688619bb06e1062c2c11834bb10f91bd182c3d7755ecebdd591850eb0dd5ce04bb5c7b8
|
@@ -24,13 +24,13 @@ module Timber
|
|
24
24
|
attr_reader :type, :data
|
25
25
|
|
26
26
|
def initialize(attributes)
|
27
|
-
@type = attributes[:type] || raise(ArgumentError.new(":type is required"))
|
27
|
+
@type = Timber::Util::Object.try(attributes[:type], :to_sym) || raise(ArgumentError.new(":type is required"))
|
28
28
|
@data = attributes[:data] || raise(ArgumentError.new(":data is required"))
|
29
29
|
end
|
30
30
|
|
31
31
|
# Builds a hash representation containing simple objects, suitable for serialization (JSON).
|
32
32
|
def as_json(options = {})
|
33
|
-
{
|
33
|
+
{type => data}
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -24,13 +24,13 @@ module Timber
|
|
24
24
|
attr_reader :id, :name
|
25
25
|
|
26
26
|
def initialize(attributes)
|
27
|
-
@id = attributes[:id]
|
27
|
+
@id = Timber::Util::Object.try(attributes[:id], :to_s)
|
28
28
|
@name = attributes[:name]
|
29
29
|
end
|
30
30
|
|
31
31
|
# Builds a hash representation containing simple objects, suitable for serialization (JSON).
|
32
32
|
def as_json(_options = {})
|
33
|
-
{id:
|
33
|
+
{id: id, name: name}
|
34
34
|
end
|
35
35
|
end
|
36
36
|
end
|
@@ -18,7 +18,7 @@ module Timber
|
|
18
18
|
@function = attributes[:function]
|
19
19
|
@line = attributes[:line]
|
20
20
|
@module_name = attributes[:module_name]
|
21
|
-
@vm_pid = attributes[:vm_pid]
|
21
|
+
@vm_pid = Timber::Util::Object.try(attributes[:vm_pid], :to_s)
|
22
22
|
end
|
23
23
|
|
24
24
|
# Builds a hash representation containing simple objects, suitable for serialization (JSON).
|
@@ -16,12 +16,12 @@ module Timber
|
|
16
16
|
attr_reader :id
|
17
17
|
|
18
18
|
def initialize(attributes)
|
19
|
-
@id = attributes[:id] || raise(ArgumentError.new(":id is required"))
|
19
|
+
@id = Timber::Util::Object.try(attributes[:id], :to_s) || raise(ArgumentError.new(":id is required"))
|
20
20
|
end
|
21
21
|
|
22
22
|
# Builds a hash representation containing simple objects, suitable for serialization (JSON).
|
23
23
|
def as_json(_options = {})
|
24
|
-
{id:
|
24
|
+
{id: id}
|
25
25
|
end
|
26
26
|
end
|
27
27
|
end
|
@@ -14,13 +14,12 @@ module Timber
|
|
14
14
|
|
15
15
|
def initialize(attributes)
|
16
16
|
@hostname = attributes[:hostname]
|
17
|
-
@pid = attributes[:pid]
|
18
|
-
@pid = Timber::Util::Object.try(@pid, :to_i)
|
17
|
+
@pid = Timber::Util::Object.try(attributes[:pid], :to_i)
|
19
18
|
end
|
20
19
|
|
21
20
|
# Builds a hash representation containing simple objects, suitable for serialization (JSON).
|
22
21
|
def as_json(_options = {})
|
23
|
-
{hostname: hostname, pid:
|
22
|
+
{hostname: hostname, pid: pid}
|
24
23
|
end
|
25
24
|
end
|
26
25
|
end
|
data/lib/timber/contexts/user.rb
CHANGED
@@ -16,7 +16,7 @@ module Timber
|
|
16
16
|
attr_reader :id, :name, :email, :type, :meta
|
17
17
|
|
18
18
|
def initialize(attributes)
|
19
|
-
@id = attributes[:id]
|
19
|
+
@id = Timber::Util::Object.try(attributes[:id], :to_s)
|
20
20
|
@name = attributes[:name]
|
21
21
|
@email = attributes[:email]
|
22
22
|
@type = attributes[:type]
|
@@ -25,7 +25,7 @@ module Timber
|
|
25
25
|
|
26
26
|
# Builds a hash representation containing simple objects, suitable for serialization (JSON).
|
27
27
|
def as_json(_options = {})
|
28
|
-
{id:
|
28
|
+
{id: id, name: name, email: email, type: type, meta: meta}
|
29
29
|
end
|
30
30
|
end
|
31
31
|
end
|
data/lib/timber/version.rb
CHANGED
@@ -0,0 +1,11 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe Timber::Contexts::Runtime, :rails_23 => true do
|
4
|
+
describe ".as_json" do
|
5
|
+
it "should coerce vm_pid into an string" do
|
6
|
+
custom_context = described_class.new(:vm_pid => 1)
|
7
|
+
json = custom_context.as_json()
|
8
|
+
expect(json[:vm_pid]).to eq("1")
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -2,7 +2,7 @@ require "spec_helper"
|
|
2
2
|
|
3
3
|
describe Timber::Contexts::System, :rails_23 => true do
|
4
4
|
describe ".as_json" do
|
5
|
-
it "should coerce pid into an
|
5
|
+
it "should coerce pid into an integer" do
|
6
6
|
custom_context = described_class.new(:pid => "1")
|
7
7
|
json = custom_context.as_json()
|
8
8
|
expect(json[:pid]).to eq(1)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: timber
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timber Technologies, Inc.
|
@@ -267,6 +267,7 @@ files:
|
|
267
267
|
- spec/timber/config_spec.rb
|
268
268
|
- spec/timber/contexts/custom_spec.rb
|
269
269
|
- spec/timber/contexts/organization_spec.rb
|
270
|
+
- spec/timber/contexts/runtime_spec.rb
|
270
271
|
- spec/timber/contexts/system_spec.rb
|
271
272
|
- spec/timber/contexts/user_spec.rb
|
272
273
|
- spec/timber/contexts_spec.rb
|
@@ -335,6 +336,7 @@ test_files:
|
|
335
336
|
- spec/timber/config_spec.rb
|
336
337
|
- spec/timber/contexts/custom_spec.rb
|
337
338
|
- spec/timber/contexts/organization_spec.rb
|
339
|
+
- spec/timber/contexts/runtime_spec.rb
|
338
340
|
- spec/timber/contexts/system_spec.rb
|
339
341
|
- spec/timber/contexts/user_spec.rb
|
340
342
|
- spec/timber/contexts_spec.rb
|