sapience 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +19 -0
- data/lib/sapience/extensions/grape/middleware/logging.rb +5 -7
- data/lib/sapience/grape.rb +0 -3
- data/lib/sapience/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 712bcdf7d21dacd21c564c2026a0fffafda3330d
|
4
|
+
data.tar.gz: 7d0750dea5d0aa3a4c806aec4840149afe98d585
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bed0ad7909f79a32193073372f1f41807bb2ede3c8f0069893b1124239e83349d0518d2c5585c16429ff2814fe24fe411ad3116db04f88307007bf3b3ccd12b
|
7
|
+
data.tar.gz: b9e635cf195f309a22db4f3a092d2119a9f70f98e61b1329eb9900b44890db771b9e2079757e5f0e5e7669bbdc6a24fa88b375d253129cd465bfd1c50165e2b1
|
data/README.md
CHANGED
@@ -28,6 +28,25 @@ gem "sapience-rb", require: "sapience/rails"
|
|
28
28
|
gem "sapience-rb", require: "sapience/grape"
|
29
29
|
```
|
30
30
|
|
31
|
+
In your Base API class
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
require "sapience/grape"
|
35
|
+
|
36
|
+
module Aslan
|
37
|
+
module API
|
38
|
+
class Base < Grape::API
|
39
|
+
use Sapience::Extensions::Grape::Middleware::Logging, logger: Sapience[self]
|
40
|
+
|
41
|
+
# To log all requests even when no route was found try the following:
|
42
|
+
route :any, "*path" do
|
43
|
+
error!({ error: "No route found" }, 404)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
```
|
31
50
|
|
32
51
|
### Configuration
|
33
52
|
|
@@ -41,11 +41,9 @@ module Sapience
|
|
41
41
|
def parameters # rubocop:disable AbcSize
|
42
42
|
{
|
43
43
|
status: (response.nil? ? "fail" : response.status),
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
view: view_runtime,
|
48
|
-
},
|
44
|
+
db_runtime: db_runtime,
|
45
|
+
view_runtime: view_runtime,
|
46
|
+
total_runtime: total_runtime,
|
49
47
|
method: request.request_method,
|
50
48
|
path: request.path,
|
51
49
|
params: request.params,
|
@@ -62,7 +60,7 @@ module Sapience
|
|
62
60
|
end
|
63
61
|
|
64
62
|
def total_runtime
|
65
|
-
((stop_time - start_time) * 1000).round(
|
63
|
+
((stop_time - start_time) * 1000).round(3)
|
66
64
|
end
|
67
65
|
|
68
66
|
def view_runtime
|
@@ -70,7 +68,7 @@ module Sapience
|
|
70
68
|
end
|
71
69
|
|
72
70
|
def db_runtime
|
73
|
-
Grape::Timings.db_runtime.round(
|
71
|
+
Grape::Timings.db_runtime.round(3)
|
74
72
|
end
|
75
73
|
|
76
74
|
def reset_db_runtime
|
data/lib/sapience/grape.rb
CHANGED
data/lib/sapience/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sapience
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mikael Henriksson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-
|
12
|
+
date: 2016-09-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: concurrent-ruby
|