Skip to content

Commit cf32960

Browse files
committed
Add OSS usage section to README
1 parent 899c16f commit cf32960

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

README.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,29 @@ You can also build the gem from source:
4444
require 'warrant'
4545
Warrant.api_key = 'api_test_f5dsKVeYnVSLHGje44zAygqgqXiLJBICbFzCiAg1E='
4646

47-
# create a user
47+
# Create a user
4848
Warrant::User.create(user_id: "user123")
4949

50-
# check whether user slp951 has view access to report 7asm24
50+
# Check whether user slp951 has view access to report 7asm24
5151
Warrant::Warrant.is_authorized?(object_type: "report", object_id: "7asm24", relation: "viewer", subject: { object_id: "user", object_id: "slp951" })
5252
```
5353

54+
## Use with Warrant OSS
55+
---
56+
```ruby
57+
require 'warrant'
58+
59+
# Set api base and authorize endpoint
60+
Warrant.api_base = 'http://localhost:8000'
61+
Warrant.authorize_endpoint = 'http://localhost:8000'
62+
63+
# Disable ssl if running locally
64+
Warrant.use_ssl = false
65+
66+
# Create user
67+
Warrant::User.create(user_id: "user123")
68+
```
69+
5470

5571
We’ve used a random API key in these code examples. Replace it with your [actual publishable API keys](https://app.warrant.dev) to
5672
test this code through your own Warrant account.

0 commit comments

Comments
 (0)