@@ -27,7 +27,7 @@ require 'securenative'
2727# ...
2828
2929begin
30- sn = SecureNative .new (' YOUR_API_KEY' ) # Should be called before any other call to securenative
30+ SecureNative .init (' YOUR_API_KEY' ) # Should be called before any other call to securenative
3131rescue SecureNativeSDKException => e
3232 # Do some error handling
3333end
3636## Tracking events
3737Once the SDK has been initialized, you can start sending new events with the ` track ` function:
3838``` ruby
39+ require ' securenative'
40+ require ' securenative/event_type'
41+
42+
3943def login
4044 # Do some cool stuff here
4145 # ...
4246 # ...
4347
44- sn .track(Event .new (
48+ SecureNative .track(Event .new (
4549 event_type = EventTypes ::LOG_IN ,
4650 user: User .
new (
" 1" ,
" Jon Snow" ,
" [email protected] " ),
4751 ip: " 1.2.3.4" ,
5458## Verification events
5559Once the SDK has been initialized, you can start sending new events with the ` verify ` function:
5660``` ruby
61+ require ' securenative'
62+ require ' securenative/event_type'
63+
64+
5765def reset_password
5866 # Do some cool stuff here
5967 # ...
6068 # ...
6169
62- sn .verify(Event .new (
70+ SecureNative .verify(Event .new (
6371 event_type = EventTypes ::PASSWORD_RESET ,
6472 user: User .
new (
" 1" ,
" Jon Snow" ,
" [email protected] " ),
6573 ip: " 1.2.3.4" ,
@@ -75,14 +83,14 @@ You can use the SDK to verify incoming webhooks from SecureNative, just call the
7583require ' securenative'
7684
7785begin
78- sn = SecureNative .new (' YOUR_API_KEY' ) # Should be called before any other call to securenative
86+ SecureNative .init (' YOUR_API_KEY' ) # Should be called before any other call to securenative
7987rescue SecureNativeSDKException => e
8088 # Do some error handling
8189end
8290
8391def handle_some_code (headers , body )
8492 sig_header = headers[" X-SecureNative" ]
85- if sn .verify_webhook(sig_header, body)
93+ if SecureNative .verify_webhook(sig_header, body)
8694 # Handle the webhook
8795 level = body[' riskLevel' ]
8896 else
0 commit comments