discourse_api 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/discourse_api/api/sso.rb +5 -1
- data/lib/discourse_api/api/users.rb +5 -0
- data/lib/discourse_api/version.rb +1 -1
- data/routes.txt +1 -1
- data/spec/discourse_api/api/sso_spec.rb +16 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: de86c959cd3684d4a57978d3023333a50ef06346
|
4
|
+
data.tar.gz: 6b45438b44e767e41a6e2588291fd8630a4ad821
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a529fe5b5b23fb05b75ec05da3d8b6abd470e6361dd8c284a80218c10963b4150a51906d9d77995dd4aafa42e45d8d633582808c0e72e5c1878bd7547637cb1d
|
7
|
+
data.tar.gz: f08590e96b69f74d0df212ff02335a92dd4bcec863586f8ff850de2d98265549232cb7cff449c54f97dddf6871e28a672af822a081758a6873bc9e0d8b32fef9
|
@@ -11,7 +11,11 @@ module DiscourseApi
|
|
11
11
|
sso.suppress_welcome_message = params[:suppress_welcome_message] === true
|
12
12
|
sso.avatar_url = params[:avatar_url]
|
13
13
|
sso.avatar_force_update = params[:avatar_force_update] === true
|
14
|
-
|
14
|
+
params.keys.select{|key| key.to_s.start_with?("custom") }.each do |custom_key|
|
15
|
+
sso.custom_fields[custom_key] = params[custom_key]
|
16
|
+
end
|
17
|
+
|
18
|
+
post("/admin/users/sync_sso", sso.payload)
|
15
19
|
end
|
16
20
|
end
|
17
21
|
end
|
@@ -10,6 +10,11 @@ module DiscourseApi
|
|
10
10
|
response[:body]['user']
|
11
11
|
end
|
12
12
|
|
13
|
+
def user_sso(username)
|
14
|
+
response = get("/admin/users/#{username.downcase}")
|
15
|
+
response[:body]['single_sign_on_record']
|
16
|
+
end
|
17
|
+
|
13
18
|
def update_avatar(args)
|
14
19
|
args = API.params(args)
|
15
20
|
.required(:username, :file)
|
data/routes.txt
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
PUT /forums/:id(.:format) forums#update
|
7
7
|
DELETE /forums/:id(.:format) forums#destroy
|
8
8
|
srv_status GET /srv/status(.:format) forums#status
|
9
|
+
admin_users_sync_sso POST /admin/users/sync_sso(.:format) admin/users#sync_sso
|
9
10
|
generate_key_admin_api_index POST /admin/api/generate_key(.:format) admin/api#generate_key
|
10
11
|
admin_api_index GET /admin/api(.:format) admin/api#index
|
11
12
|
email_preferences_redirect GET /email_preferences(.:format) email#preferences_redirect
|
@@ -200,4 +201,3 @@
|
|
200
201
|
list_read / list#read
|
201
202
|
list_posted / list#posted
|
202
203
|
categories_index / categories#index
|
203
|
-
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DiscourseApi::API::SSO do
|
4
|
+
subject { DiscourseApi::Client.new("http://localhost:3000", "test_d7fd0429940", "test_user" )}
|
5
|
+
|
6
|
+
describe "#sync_sso" do
|
7
|
+
before do
|
8
|
+
stub_post(/.*sync_sso.*/).to_return(body: fixture("user.json"), headers: { content_type: "application/json" })
|
9
|
+
end
|
10
|
+
|
11
|
+
it "requests the correct resource" do
|
12
|
+
subject.sync_sso({sso_secret: "test_d7fd0429940", "custom.riffle_url" => "test"})
|
13
|
+
expect(a_post(/.*sync_sso.*/)).to have_been_made
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: discourse_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2015-05-
|
13
|
+
date: 2015-05-30 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -247,6 +247,7 @@ files:
|
|
247
247
|
- spec/discourse_api/api/posts_spec.rb
|
248
248
|
- spec/discourse_api/api/private_messages_spec.rb
|
249
249
|
- spec/discourse_api/api/search_spec.rb
|
250
|
+
- spec/discourse_api/api/sso_spec.rb
|
250
251
|
- spec/discourse_api/api/topics_spec.rb
|
251
252
|
- spec/discourse_api/api/users_spec.rb
|
252
253
|
- spec/discourse_api/client_spec.rb
|
@@ -320,6 +321,7 @@ test_files:
|
|
320
321
|
- spec/discourse_api/api/posts_spec.rb
|
321
322
|
- spec/discourse_api/api/private_messages_spec.rb
|
322
323
|
- spec/discourse_api/api/search_spec.rb
|
324
|
+
- spec/discourse_api/api/sso_spec.rb
|
323
325
|
- spec/discourse_api/api/topics_spec.rb
|
324
326
|
- spec/discourse_api/api/users_spec.rb
|
325
327
|
- spec/discourse_api/client_spec.rb
|