Skip to content

Commit aaa85da

Browse files
author
Inbal Tako
committed
Update readme
1 parent 28b5b36 commit aaa85da

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ require 'securenative'
2727
# ...
2828

2929
begin
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
3131
rescue SecureNativeSDKException => e
3232
# Do some error handling
3333
end
@@ -36,12 +36,16 @@ end
3636
## Tracking events
3737
Once 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+
3943
def 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",
@@ -54,12 +58,16 @@ end
5458
## Verification events
5559
Once 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+
5765
def 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
7583
require 'securenative'
7684

7785
begin
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
7987
rescue SecureNativeSDKException => e
8088
# Do some error handling
8189
end
8290

8391
def 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

Comments
 (0)