Skip to content

Commit 213e6c3

Browse files
authored
Updates package versions in gemfiles, readmes and directory sync app (#87)
* updates package versions in gemfiles, readmes and directory sync app * runs bundle update on all apps
1 parent e6f4810 commit 213e6c3

File tree

20 files changed

+424
-415
lines changed

20 files changed

+424
-415
lines changed

ruby-admin-portal-example/Gemfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ source 'https://rubygems.org'
44

55
gem 'dotenv', '2.7.6'
66
gem 'sinatra', '2.2.0'
7-
gem 'workos', '2.5.0'
7+
gem 'workos', '2.12.0'

ruby-audit-logs-example/README.md

+15-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ruby-audit-logs-example
22

3-
An example Ruby application demonstrating how to use the [WorkOS Ruby SDK](https://github.com/workos/workos-ruby) to send and retrieve Audit Log events. This example is not meant to show a real-world example of an Audit Logs implementation, but rather to show concrete examples of how events can be sent using the Python SDK.
3+
An example Ruby application demonstrating how to use the [WorkOS Ruby SDK](https://github.com/workos/workos-ruby) to send and retrieve Audit Log events. This example is not meant to show a real-world example of an Audit Logs implementation, but rather to show concrete examples of how events can be sent using the Ruby SDK.
44

55
## Clone and Install
66

@@ -10,7 +10,6 @@ An example Ruby application demonstrating how to use the [WorkOS Ruby SDK](https
1010
# HTTPS
1111
$ git clone https://github.com/workos/ruby-example-applications.git
1212
```
13-
1413

1514
2. Navigate to the Audit Logs example app within the cloned repo and install dependencies:
1615

@@ -40,10 +39,24 @@ Action title: "user.connection_deleted" | Target type: "team"
4039
4. To obtain a CSV of the Audit Log events that were sent for the last 30 days, click the "Export Events" button. This will bring you to a new page where you can download the events. Downloading the events is a 2 step process. First you need to create the report by clicking the "Generate CSV" button. Then click the "Access CSV" button to download a CSV of the Audit Log events for the selected Organization for the past 30 days.
4140

4241
## Run the app
42+
4343
```sh
4444
ruby app.rb
4545
```
4646

47+
## Audit Logs Setup with WorkOS
48+
49+
5. Follow the [Audit Logs configuration steps](https://workos.com/docs/audit-logs/emit-an-audit-log-event/sign-in-to-your-workos-dashboard-account-and-configure-audit-log-event-schemas) to set up the following 2 events that are sent with this example:
50+
51+
Action title: "user.organization_set" | Target type: "team"
52+
Action title: "user.organization_deleted" | Target type: "team"
53+
54+
6. Configure the Admin Portal Redirect URI.
55+
56+
Navigate to the Configuration tab in your WorkOS Dshboard. From there click the Admin Portal tab. Click the Edit Admin Portal Redirect Links button and add "http://localhost:8000" to the "When clicking the back navigation, return users to:" input, then click Save Redirect Links.
57+
58+
7. To obtain a CSV of the Audit Log events that were sent for the last 30 days, click the "Export Events" tab. This will bring you to a new page where you can download the events. Downloading the events is a 2 step process. First you need to create the report by clicking the "Generate CSV" button. Then click the "Access CSV" button to download a CSV of the Audit Log events for the selected Organization for the past 30 days. You may also adjust the time range using the form inputs.
59+
4760
## Need help?
4861

4962
If you get stuck and aren't able to resolve the issue by reading our API reference or tutorials, you can reach out to us at [email protected] and we'll lend a hand.

ruby-audit-logs-example/app.rb

-2
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
require 'sinatra'
55
require 'workos'
66
require 'date'
7-
require_relative 'audit_log_events.rb'
8-
require 'pry'
97

108
# Pull API key and Client ID from ENV variable
119
WorkOS.key = ENV['WORKOS_API_KEY']

ruby-audit-logs-example/audit_log_events.rb

-96
This file was deleted.

ruby-audit-logs-example/views/login.erb

-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
<html>
2-
3-
<head>
4-
<link rel="stylesheet" href="{{ url_for('static', filename='login.css')}}">
5-
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Inter">
6-
</head>
7-
81
<body class="container_success">
92

103
<div class="logged_in_div_left flex_column">

ruby-directory-sync-example/Gemfile.lock

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
addressable (2.8.0)
5-
public_suffix (>= 2.0.2, < 5.0)
4+
addressable (2.8.1)
5+
public_suffix (>= 2.0.2, < 6.0)
66
daemons (1.4.1)
77
dotenv (2.7.6)
88
em-websocket (0.3.8)
@@ -11,8 +11,8 @@ GEM
1111
eventmachine (1.2.7)
1212
mustermann (1.1.2)
1313
ruby2_keywords (~> 0.0.1)
14-
public_suffix (4.0.7)
15-
rack (2.2.4)
14+
public_suffix (5.0.1)
15+
rack (2.2.6.4)
1616
rack-protection (2.2.0)
1717
rack
1818
ruby2_keywords (0.0.5)
@@ -25,12 +25,12 @@ GEM
2525
em-websocket (~> 0.3.6)
2626
eventmachine
2727
thin (>= 1.3.1, < 2.0.0)
28-
sorbet-runtime (0.5.10274)
28+
sorbet-runtime (0.5.10741)
2929
thin (1.8.1)
3030
daemons (~> 1.0, >= 1.0.9)
3131
eventmachine (~> 1.0, >= 1.0.4)
3232
rack (>= 1, < 3)
33-
tilt (2.0.11)
33+
tilt (2.1.0)
3434
workos (2.5.0)
3535
sorbet-runtime (~> 0.5)
3636

ruby-directory-sync-example/app.rb

+30-5
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,46 @@
66
require 'workos'
77
require 'json'
88
require 'sinatra-websocket'
9-
require 'pry'
109

1110
set :server, 'thin'
1211
set :sockets, []
1312

1413
# Pull API key from ENV variable
1514
WorkOS.key = ENV['WORKOS_API_KEY']
1615

17-
get '/' do
18-
@directories_list = WorkOS::DirectorySync.list_directories
19-
@directories = @directories_list.data
16+
enable :sessions
17+
18+
use(
19+
Rack::Session::Cookie,
20+
key: 'rack.session',
21+
domain: 'localhost',
22+
path: '/',
23+
expire_after: 2_592_000,
24+
secret: SecureRandom.hex(16)
25+
)
2026

27+
get '/' do
28+
before = params[:before]
29+
after = params[:after]
30+
puts before
31+
puts after
32+
if !before
33+
@directories = WorkOS::DirectorySync.list_directories(
34+
limit: 5
35+
)
36+
else
37+
@directories = WorkOS::DirectorySync.list_directories(
38+
limit: 5,
39+
before: before,
40+
after: after
41+
)
42+
end
43+
@before = @directories.list_metadata["before"]
44+
@after = @directories.list_metadata["after"]
2145
erb :index, :layout => false
2246
end
2347

48+
2449
get '/directories/:id' do
2550
@groups_list = WorkOS::DirectorySync.list_groups(directory: params[:id])
2651
@groups = @groups_list.data
@@ -32,7 +57,7 @@
3257

3358
get '/users/:id' do
3459
@user = WorkOS::DirectorySync.get_user(params[:id])
35-
@user_groups_list = WorkOS::DirectorySync.list_groups(user: params[:id])
60+
@user_groups_list = WorkOS::DirectorySync.list_groups(user: params[:id], limit: 5)
3661
@user_groups = @user_groups_list.data
3762

3863
erb :user
Loading
Loading

0 commit comments

Comments
 (0)