moesif_rack 1.3.0 → 1.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +33 -1
- data/lib/moesif_rack/moesif_middleware.rb +8 -0
- data/moesif_capture_outgoing/httplog/http_log.rb +9 -0
- data/test/moesif_rack_test.rb +16 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 749b3ca7c00415572f4eaa9825c3391d7faaddf99a483e10592ea63e4cfc972f
|
4
|
+
data.tar.gz: 156236fb68da7d7bc5341d137ef9a1484ee8d1eb3fc3d56d7e292800c2899a76
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8b7dbff0a88412024be53585c8205d5e14df0316aa0fb5ea6d8884e470cfa3a5349720a25e684db93eec1f0ec2f90c89c99de662856b887704c40a6d2364f3b
|
7
|
+
data.tar.gz: 2071190182afc290ff0be0bd73bac2add9fbf712e9e7736a369dc7eb546b4a744332f1de0b5b460f71b183677de518cd1ec383dc4e9746c189a8c8d79685bfa6
|
data/README.md
CHANGED
@@ -20,7 +20,7 @@ gem install moesif_rack
|
|
20
20
|
and if you have a `Gemfile` in your project, please add this line to
|
21
21
|
|
22
22
|
```
|
23
|
-
gem 'moesif_rack', '~> 1.
|
23
|
+
gem 'moesif_rack', '~> 1.3.1'
|
24
24
|
|
25
25
|
```
|
26
26
|
|
@@ -111,6 +111,22 @@ moesif_options['identify_user'] = Proc.new { |env, headers, body|
|
|
111
111
|
|
112
112
|
```
|
113
113
|
|
114
|
+
#### __`identify_company`__
|
115
|
+
|
116
|
+
Optional.
|
117
|
+
identify_company is a Proc that takes env, headers, and body as arguments and returns a company_id string. This helps us attribute requests to unique company.
|
118
|
+
|
119
|
+
```ruby
|
120
|
+
|
121
|
+
moesif_options['identify_company'] = Proc.new { |env, headers, body|
|
122
|
+
|
123
|
+
#snip
|
124
|
+
|
125
|
+
'the_company_id'
|
126
|
+
}
|
127
|
+
|
128
|
+
```
|
129
|
+
|
114
130
|
#### __`get_metadata`__
|
115
131
|
|
116
132
|
Optional.
|
@@ -207,6 +223,22 @@ moesif_options['identify_user_outgoing'] = Proc.new { |request, response|
|
|
207
223
|
|
208
224
|
```
|
209
225
|
|
226
|
+
##### __`identify_company_outgoing`__
|
227
|
+
|
228
|
+
Optional.
|
229
|
+
identify_company_outgoing is a Proc that takes request and response as arguments and returns a company_id string. This helps us attribute requests to unique company.
|
230
|
+
|
231
|
+
```ruby
|
232
|
+
|
233
|
+
moesif_options['identify_company_outgoing'] = Proc.new { |request, response|
|
234
|
+
|
235
|
+
#snip
|
236
|
+
|
237
|
+
'the_company_id'
|
238
|
+
}
|
239
|
+
|
240
|
+
```
|
241
|
+
|
210
242
|
##### __`get_metadata_outgoing`__
|
211
243
|
|
212
244
|
Optional.
|
@@ -19,6 +19,7 @@ module MoesifRack
|
|
19
19
|
|
20
20
|
@api_version = options['api_version']
|
21
21
|
@identify_user = options['identify_user']
|
22
|
+
@identify_company = options['identify_company']
|
22
23
|
@get_metadata = options['get_metadata']
|
23
24
|
@identify_session = options['identify_session']
|
24
25
|
@mask_data = options['mask_data']
|
@@ -194,6 +195,13 @@ module MoesifRack
|
|
194
195
|
event_model.user_id = @identify_user.call(env, headers, body)
|
195
196
|
end
|
196
197
|
|
198
|
+
if @identify_company
|
199
|
+
if @debug
|
200
|
+
puts "calling identify company proc"
|
201
|
+
end
|
202
|
+
event_model.company_id = @identify_company.call(env, headers, body)
|
203
|
+
end
|
204
|
+
|
197
205
|
if @get_metadata
|
198
206
|
if @debug
|
199
207
|
puts "calling get_metadata proc"
|
@@ -18,6 +18,7 @@ module MoesifCaptureOutgoing
|
|
18
18
|
@debug = @moesif_options['debug']
|
19
19
|
@get_metadata_outgoing = @moesif_options['get_metadata_outgoing']
|
20
20
|
@identify_user_outgoing = @moesif_options['identify_user_outgoing']
|
21
|
+
@identify_company_outgoing = @moesif_options['identify_company_outgoing']
|
21
22
|
@identify_session_outgoing = @moesif_options['identify_session_outgoing']
|
22
23
|
@skip_outgoing = options['skip_outgoing']
|
23
24
|
@mask_data_outgoing = options['mask_data_outgoing']
|
@@ -110,6 +111,14 @@ module MoesifCaptureOutgoing
|
|
110
111
|
event_model.user_id = @identify_user_outgoing.call(request, response)
|
111
112
|
end
|
112
113
|
|
114
|
+
# Identify Company
|
115
|
+
if @identify_company_outgoing
|
116
|
+
if @debug
|
117
|
+
puts "calling identify_company_outgoing proc"
|
118
|
+
end
|
119
|
+
event_model.company_id = @identify_company_outgoing.call(request, response)
|
120
|
+
end
|
121
|
+
|
113
122
|
# Session Token
|
114
123
|
if @identify_session_outgoing
|
115
124
|
if @debug
|
data/test/moesif_rack_test.rb
CHANGED
@@ -10,14 +10,29 @@ class MoesifRackTest < Test::Unit::TestCase
|
|
10
10
|
'debug' => true,
|
11
11
|
'disable_transaction_id' => true,
|
12
12
|
'capture_outoing_requests' => true,
|
13
|
+
'get_metadata' => Proc.new {|request, response|
|
14
|
+
{
|
15
|
+
'foo' => 'abc',
|
16
|
+
'bar' => '123'
|
17
|
+
}
|
18
|
+
},
|
13
19
|
'get_metadata_outgoing' => Proc.new {|request, response|
|
14
20
|
{
|
15
21
|
'foo' => 'abc',
|
16
22
|
'bar' => '123'
|
17
23
|
}
|
18
24
|
},
|
25
|
+
'identify_user' => Proc.new{|request, response|
|
26
|
+
'my_user_id'
|
27
|
+
},
|
28
|
+
'identify_company' => Proc.new{|request, response|
|
29
|
+
'12345'
|
30
|
+
},
|
19
31
|
'identify_user_outgoing' => Proc.new{|request, response|
|
20
|
-
'
|
32
|
+
'outgoing_user_id'
|
33
|
+
},
|
34
|
+
'identify_company_outgoing' => Proc.new{|request, response|
|
35
|
+
'outgoing_company_id'
|
21
36
|
},
|
22
37
|
'identify_session_outgoing' => Proc.new{|request, response|
|
23
38
|
'outgoing_session'
|
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.3.
|
4
|
+
version: 1.3.1
|
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: 2019-
|
12
|
+
date: 2019-06-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: test-unit
|