moesif_rack 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +3 -11
- data/lib/moesif_rack/moesif_middleware.rb +12 -4
- 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: f51cfc0456d2c898d431068cd68005dc755fcca2
|
4
|
+
data.tar.gz: 43fb1009abcf3c9a9f505cc6278a974c6c5c0a17
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 61d38475fcfa488153cab0726cdfc776d459cfc67709b66f12644d279db370abe124f2157e4d687e8512a1c03ffaf76d5854ff0752632b09b318937d81d2f1cb
|
7
|
+
data.tar.gz: 30111231d1298b6e99ed2cdd07c44d77c0727f381b42b5fe9eabd678f3f3a4cbe4986a3dfe26d2bb83ec6a34b3138636261c307f2b3bbb4474d5afbe45c659d9
|
data/README.md
CHANGED
@@ -1,14 +1,12 @@
|
|
1
1
|
Moesif Middleware for Ruby on Rails and Rack
|
2
|
-
|
2
|
+
=============================================
|
3
3
|
|
4
4
|
Middleware that logs APIs built on Ruby on Rails and Rack.
|
5
5
|
|
6
6
|
[Source Code on GitHub](https://github.com/moesif/moesif-rack)
|
7
7
|
|
8
8
|
__Check out Moesif's
|
9
|
-
[Ruby developer documentation](https://www.moesif.com/developer-documentation) to learn more__
|
10
|
-
|
11
|
-
|
9
|
+
[Ruby developer documentation](https://www.moesif.com/developer-documentation/?ruby) to learn more__
|
12
10
|
|
13
11
|
Install from RubyGems
|
14
12
|
=====================
|
@@ -65,7 +63,7 @@ Optional. String. Tag requests with the version of your API.
|
|
65
63
|
#### identify_user
|
66
64
|
|
67
65
|
Optional.
|
68
|
-
identify_user is a
|
66
|
+
identify_user is a Proc that takes env, headers, and body as arguments and returns a user_id string. This helps us attribute requests to unique users. Even though Moesif can automatically retrieve the user_id without this, this is highly recommended to ensure accurate attribution.
|
69
67
|
|
70
68
|
```ruby
|
71
69
|
|
@@ -78,12 +76,6 @@ moesif_options['identify_user'] = Proc.new { |env, headers, body|
|
|
78
76
|
|
79
77
|
```
|
80
78
|
|
81
|
-
@api_version = options['api_version']
|
82
|
-
@identify_user = options['identify_user']
|
83
|
-
@identify_session = options['identify_session']
|
84
|
-
@mask_data = options['mask_data']
|
85
|
-
@debug = options['debug']
|
86
|
-
|
87
79
|
#### identify_session
|
88
80
|
|
89
81
|
Optional. A Proc that takes env, headers, body and returns a string.
|
@@ -48,8 +48,12 @@ module MoesifRack
|
|
48
48
|
req_body = JSON.parse(req_body_string)
|
49
49
|
rescue
|
50
50
|
req_body = {
|
51
|
-
'
|
52
|
-
|
51
|
+
'moesif_error' => {
|
52
|
+
'code': 'json_parse_error',
|
53
|
+
'src': 'moesif-rack',
|
54
|
+
'msg' => ['Body is not a JSON Object or JSON Array'],
|
55
|
+
'args' => [req_body_string]
|
56
|
+
}
|
53
57
|
}
|
54
58
|
end
|
55
59
|
end
|
@@ -64,8 +68,12 @@ module MoesifRack
|
|
64
68
|
rescue
|
65
69
|
if content_type && (content_type.include? "json")
|
66
70
|
rsp_body = {
|
67
|
-
'
|
68
|
-
|
71
|
+
'moesif_error' => {
|
72
|
+
'code': 'json_parse_error',
|
73
|
+
'src': 'moesif-rack',
|
74
|
+
'msg' => ['Body is not a JSON Object or JSON Array'],
|
75
|
+
'args' => [body.body]
|
76
|
+
}
|
69
77
|
}
|
70
78
|
end
|
71
79
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: moesif_rack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Moesif, Inc
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-01-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|