discourse_api 0.17.0 → 0.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/examples/disposable_invite_tokens.rb +2 -0
- data/lib/discourse_api/api/groups.rb +50 -2
- data/lib/discourse_api/api/invite.rb +2 -1
- data/lib/discourse_api/version.rb +1 -1
- data/spec/discourse_api/api/groups_spec.rb +11 -1
- data/spec/spec_helper.rb +6 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c30c8d6075c413eb4eb59d301ef84df97e09bb02
|
4
|
+
data.tar.gz: c9d564671e6b060d7c220e075f78f8459c6e1338
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fee2ef5f539d1ab91009f220dd25427dbe5e91afabb9e5b079d1bef32715a4f8f1151a11cd1ee5783e8523438a9dc3e343e9b61da5ea3495513ce379091f3e94
|
7
|
+
data.tar.gz: ae8ad784a1d21fed5e4142763e759534243567c472fbcaac325d9d6988eae24d233f965aed03580db860161b8730da25a6dcec11e9250c245460819b703172ae
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,13 @@
|
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
This project adheres to [Semantic Versioning](http://semver.org/).
|
4
4
|
|
5
|
+
## [0.18.0] - 2017-10-17
|
6
|
+
### Added
|
7
|
+
- Added update_group API call
|
8
|
+
### Fixed
|
9
|
+
- Fixed params for create groups endpoint
|
10
|
+
- Fixed invite token API endpoint
|
11
|
+
|
5
12
|
## [0.17.0] - 2017-06-29
|
6
13
|
### Added
|
7
14
|
- Add title to SSO sync
|
@@ -4,9 +4,57 @@ module DiscourseApi
|
|
4
4
|
def create_group(args)
|
5
5
|
args = API.params(args)
|
6
6
|
.required(:name)
|
7
|
-
.default(
|
7
|
+
.default(visibility_level: 0)
|
8
|
+
.optional(:mentionable_level,
|
9
|
+
:messageable_level,
|
10
|
+
:automatic_membership_email_domains,
|
11
|
+
:automatic_membership_retroactive,
|
12
|
+
:title,
|
13
|
+
:primary_group,
|
14
|
+
:grant_trust_level,
|
15
|
+
:incoming_email,
|
16
|
+
:flair_url,
|
17
|
+
:flair_bg_color,
|
18
|
+
:flair_color,
|
19
|
+
:bio_raw,
|
20
|
+
:public_admission,
|
21
|
+
:public_exit,
|
22
|
+
:allow_membership_requests,
|
23
|
+
:full_name,
|
24
|
+
:default_notification_level,
|
25
|
+
:usernames,
|
26
|
+
:owner_usernames,
|
27
|
+
:membership_request_template)
|
8
28
|
.to_h
|
9
|
-
post("/admin/groups", args)
|
29
|
+
post("/admin/groups", group: args)
|
30
|
+
end
|
31
|
+
|
32
|
+
def update_group(group_id, args)
|
33
|
+
args = API.params(args)
|
34
|
+
.default(visibility_level: 0)
|
35
|
+
.optional(:mentionable_level,
|
36
|
+
:messageable_level,
|
37
|
+
:name,
|
38
|
+
:automatic_membership_email_domains,
|
39
|
+
:automatic_membership_retroactive,
|
40
|
+
:title,
|
41
|
+
:primary_group,
|
42
|
+
:grant_trust_level,
|
43
|
+
:incoming_email,
|
44
|
+
:flair_url,
|
45
|
+
:flair_bg_color,
|
46
|
+
:flair_color,
|
47
|
+
:bio_raw,
|
48
|
+
:public_admission,
|
49
|
+
:public_exit,
|
50
|
+
:allow_membership_requests,
|
51
|
+
:full_name,
|
52
|
+
:default_notification_level,
|
53
|
+
:usernames,
|
54
|
+
:owner_usernames,
|
55
|
+
:membership_request_template)
|
56
|
+
.to_h
|
57
|
+
put("/admin/groups/#{group_id}", group: args)
|
10
58
|
end
|
11
59
|
|
12
60
|
def groups
|
@@ -9,8 +9,9 @@ module DiscourseApi
|
|
9
9
|
post("/t/#{params[:topic_id]}/invite", params)
|
10
10
|
end
|
11
11
|
|
12
|
+
# requires this plugin => https://github.com/discourse/discourse-invite-tokens
|
12
13
|
def disposable_tokens(params={})
|
13
|
-
post("/
|
14
|
+
post("/invite-token/generate", params)
|
14
15
|
end
|
15
16
|
end
|
16
17
|
end
|
@@ -22,8 +22,18 @@ describe DiscourseApi::API::Groups do
|
|
22
22
|
it "create new groups" do
|
23
23
|
stub_post("http://localhost:3000/admin/groups?api_key=test_d7fd0429940&api_username=test_user")
|
24
24
|
subject.create_group(name: "test_group")
|
25
|
+
params = escape_params("group[name]" => "test_group", "group[visibility_level]" => 0)
|
25
26
|
expect(a_post("http://localhost:3000/admin/groups?api_key=test_d7fd0429940&api_username=test_user").
|
26
|
-
with(body:
|
27
|
+
with(body: params)
|
28
|
+
).to have_been_made
|
29
|
+
end
|
30
|
+
|
31
|
+
it "update an existing group" do
|
32
|
+
stub_put("http://localhost:3000/admin/groups/42?api_key=test_d7fd0429940&api_username=test_user")
|
33
|
+
subject.update_group(42, name: "test_group")
|
34
|
+
params = escape_params("group[name]" => "test_group", "group[visibility_level]" => 0)
|
35
|
+
expect(a_put("http://localhost:3000/admin/groups/42?api_key=test_d7fd0429940&api_username=test_user").
|
36
|
+
with(body: params)
|
27
37
|
).to have_been_made
|
28
38
|
end
|
29
39
|
|
data/spec/spec_helper.rb
CHANGED
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
|
+
version: 0.18.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-10-17 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: faraday
|