moesif_rack 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45a13b3f4b85664a0147ef4abe30bd73f1b11d21a96ce30b21d32f15185217e6
4
- data.tar.gz: 02c92b07b397124108dd0eba645b830b9da5b222a4058e9048c8b7bc380b6dd9
3
+ metadata.gz: 801271db795a8ee81089fbb747ce564424c4800e37713851945bdf37d815b524
4
+ data.tar.gz: 5f5b553d5a1c3a2e98958fd057e57621d2ef6ec56153641858a696821f9ae5ca
5
5
  SHA512:
6
- metadata.gz: ccf6066387ea409cc74f7910bae06a33f2419442ddeba773b29329888e78ca61cd5ee8934168f2e38ea4ebc43fe58dbea8680716de3517d8d2a555ac52a690f7
7
- data.tar.gz: a53a8a807d6f4e2c244e9466743e9fbe2d8949d462a50cc9d82d85fbff6c1b89c852ddb088c4ca74042e3f3775ddbdfdf9955762341943821053aabe95e094af
6
+ metadata.gz: b353c6b9999f0308b89ecc937be15b8e7b3a2e96f343db5c24bc1e409445678c9f1172be56c5f5158a173a75c8e09f75892aba138d06c6ad762e03d5e809c502
7
+ data.tar.gz: e8832751ed589e0848d45adc2cba1fdb34874e2730d78de5abd5a4e32c0d6e74cb070da004ba59da10f7366e0310405ac36b7af4b393153f9768367f04c8627e
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.2.6'
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
@@ -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
- 'outgoing_user'
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.0
4
+ version: 1.3.2
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-05-22 00:00:00.000000000 Z
12
+ date: 2019-06-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: test-unit