discourse_api 0.42.0 → 0.45.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +13 -17
- data/.gitignore +0 -19
- data/CHANGELOG.md +32 -7
- data/README.md +0 -1
- data/discourse_api.gemspec +6 -6
- data/examples/category.rb +3 -0
- data/examples/change_topic_status.rb +3 -4
- data/examples/manage_api_keys.rb +42 -0
- data/examples/notifications.rb +15 -0
- data/examples/topic_lists.rb +3 -0
- data/lib/discourse_api/api/api_key.rb +15 -9
- data/lib/discourse_api/api/categories.rb +41 -13
- data/lib/discourse_api/api/groups.rb +10 -2
- data/lib/discourse_api/api/search.rb +1 -1
- data/lib/discourse_api/api/tags.rb +1 -1
- data/lib/discourse_api/api/topics.rb +25 -1
- data/lib/discourse_api/api/users.rb +1 -1
- data/lib/discourse_api/client.rb +4 -0
- data/lib/discourse_api/version.rb +1 -1
- data/spec/discourse_api/api/api_key_spec.rb +59 -35
- data/spec/discourse_api/api/categories_spec.rb +90 -0
- data/spec/discourse_api/api/search_spec.rb +2 -2
- data/spec/discourse_api/api/topics_spec.rb +35 -1
- data/spec/fixtures/api_key.json +12 -0
- data/spec/fixtures/list_api_keys.json +14 -0
- data/spec/fixtures/notification_success.json +3 -0
- data/spec/fixtures/top.json +108 -0
- metadata +20 -14
- data/spec/fixtures/api.json +0 -12
- data/spec/fixtures/generate_master_key.json +0 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10c80ce6388205a855042bd1093627508e4929c6bf79902487549568af7304b0
|
4
|
+
data.tar.gz: 4aab3d70ba9343f6717a4e4ffce233b015565904129fd4b1244e7bdac64ef565
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b37002fd695ca45872ba4b2ca09161173050f70692c8f051df737dd87370cb06c5103b51d5691807041ffbac9a0a9a1713fd74f406da192eeb8e29b41460c90a
|
7
|
+
data.tar.gz: 13163d2718c324780cb081aaca1e63f865e9b503bc008f4d1fbcb1145b6f3175e6621f6dbbaff14a30f8d730d9800ab6af8e3e1caee93b8baed8682d275f4b68
|
data/.github/workflows/ci.yml
CHANGED
@@ -5,8 +5,7 @@ on:
|
|
5
5
|
push:
|
6
6
|
branches:
|
7
7
|
- master
|
8
|
-
|
9
|
-
- v*
|
8
|
+
- main
|
10
9
|
|
11
10
|
jobs:
|
12
11
|
build:
|
@@ -18,30 +17,25 @@ jobs:
|
|
18
17
|
- 2.5
|
19
18
|
- 2.6
|
20
19
|
- 2.7
|
20
|
+
- 3.0
|
21
21
|
|
22
22
|
steps:
|
23
|
-
- uses: actions/checkout@
|
23
|
+
- uses: actions/checkout@v2
|
24
24
|
|
25
25
|
- name: Setup ruby
|
26
|
-
uses:
|
26
|
+
uses: ruby/setup-ruby@v1
|
27
27
|
with:
|
28
28
|
ruby-version: ${{ matrix.ruby }}
|
29
|
-
|
30
|
-
|
31
|
-
- name: Setup bundler
|
32
|
-
run: gem install bundler
|
33
|
-
|
34
|
-
- name: Setup gems
|
35
|
-
run: bundle install
|
29
|
+
bundler-cache: true
|
36
30
|
|
37
|
-
- name:
|
31
|
+
- name: Lint
|
38
32
|
run: bundle exec rubocop
|
39
33
|
|
40
|
-
- name:
|
41
|
-
run: bundle exec
|
34
|
+
- name: Tests
|
35
|
+
run: bundle exec rake test
|
42
36
|
|
43
37
|
publish:
|
44
|
-
if:
|
38
|
+
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
|
45
39
|
needs: build
|
46
40
|
runs-on: ubuntu-latest
|
47
41
|
|
@@ -49,6 +43,8 @@ jobs:
|
|
49
43
|
- uses: actions/checkout@v2
|
50
44
|
|
51
45
|
- name: Release Gem
|
52
|
-
uses:
|
46
|
+
uses: discourse/publish-rubygems-action@v2-beta
|
53
47
|
env:
|
54
|
-
RUBYGEMS_API_KEY: ${{secrets.RUBYGEMS_API_KEY}}
|
48
|
+
RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
|
49
|
+
GIT_EMAIL: team@discourse.org
|
50
|
+
GIT_NAME: discoursebot
|
data/.gitignore
CHANGED
@@ -1,22 +1,3 @@
|
|
1
|
-
*.gem
|
2
|
-
*.rbc
|
3
|
-
.bundle
|
4
|
-
.config
|
5
|
-
.yardoc
|
6
1
|
Gemfile.lock
|
7
|
-
InstalledFiles
|
8
|
-
_yardoc
|
9
2
|
coverage
|
10
|
-
doc/
|
11
|
-
lib/bundler/man
|
12
|
-
pkg
|
13
|
-
rdoc
|
14
|
-
spec/reports
|
15
|
-
test/tmp
|
16
|
-
test/version_tmp
|
17
|
-
tmp
|
18
|
-
bin/
|
19
|
-
.ruby-gemset
|
20
|
-
.ruby-version
|
21
|
-
.env
|
22
3
|
/config.yml
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,36 @@
|
|
1
|
-
#
|
1
|
+
# Changelog
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
|
-
|
3
|
+
|
4
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
5
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
6
|
+
|
7
|
+
## [Unreleased]
|
8
|
+
|
9
|
+
## [0.45.0] - 2021-01-15
|
10
|
+
### Added
|
11
|
+
- Tag configuration in create_category/update_category
|
12
|
+
- Topic#change_owner
|
13
|
+
- Support passing approved to #create_user
|
14
|
+
### Changed
|
15
|
+
- API key methods use the latest endpoints
|
16
|
+
|
17
|
+
## [0.44.0] - 2020-11-13
|
18
|
+
### Fixed
|
19
|
+
- Updated `show_tag` method to use new route
|
20
|
+
### Removed
|
21
|
+
- Support for Ruby 2.3 and 2.4
|
22
|
+
|
23
|
+
## [0.43.1] - 2020-11-04
|
24
|
+
### Fixed
|
25
|
+
- Tagged version 0.43.0 got pushed without commmit due to new master branch
|
26
|
+
protections in github. No, code changes here just making sure tags align with
|
27
|
+
commits.
|
28
|
+
|
29
|
+
## [0.43.0] - 2020-11-04
|
30
|
+
### Added
|
31
|
+
- Add pagination to list groups endpoint
|
32
|
+
### Deprecated
|
33
|
+
- `change_topic_status` has been deprecated, use `update_topic_status` instead.
|
4
34
|
|
5
35
|
## [0.42.0] - 2020-07-09
|
6
36
|
### Added
|
@@ -9,17 +39,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
9
39
|
## [0.41.0] - 2020-06-17
|
10
40
|
### Added
|
11
41
|
- Add basic auth support
|
12
|
-
|
13
42
|
### Fixed
|
14
43
|
- Fix SSO custom field prefixes
|
15
|
-
|
16
44
|
### Removed
|
17
45
|
- Obsolete api key endpoints
|
18
46
|
|
19
47
|
## [0.40.0] - 2020-05-07
|
20
48
|
### Fixed
|
21
49
|
- Add missing attributes to `sync_sso`
|
22
|
-
|
23
50
|
### Added
|
24
51
|
- Add delete category method
|
25
52
|
|
@@ -41,7 +68,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
41
68
|
- Allow more options parameters when creating a category
|
42
69
|
- Don't require topic slug when updating topic status
|
43
70
|
- Example files now read config.yml file when present for client settings
|
44
|
-
|
45
71
|
### Fixed
|
46
72
|
- Issue with `topic_posts` and frozen strings
|
47
73
|
- Fixed some topic and category methods
|
@@ -293,5 +319,4 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
293
319
|
- `client.category_latest_posts("category-slug")` endpoint
|
294
320
|
|
295
321
|
## [0.1.2] - 2014-05-11
|
296
|
-
|
297
322
|
- Release
|
data/README.md
CHANGED
@@ -34,7 +34,6 @@ client.ssl(...) #=> specify SSL connection setti
|
|
34
34
|
|
35
35
|
# Topic endpoints
|
36
36
|
client.latest_topics #=> Gets a list of the latest topics
|
37
|
-
client.hot_topics #=> Gets a list of hot topics
|
38
37
|
client.new_topics #=> Gets a list of new topics
|
39
38
|
client.topics_by("sam") #=> Gets a list of topics created by user "sam"
|
40
39
|
client.topic(57) #=> Gets the topic with id 57
|
data/discourse_api.gemspec
CHANGED
@@ -18,9 +18,9 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.
|
22
|
-
spec.
|
23
|
-
spec.
|
21
|
+
spec.add_runtime_dependency 'faraday', '~> 1.0'
|
22
|
+
spec.add_runtime_dependency 'faraday_middleware', '~> 1.0'
|
23
|
+
spec.add_runtime_dependency 'rack', '>= 1.6'
|
24
24
|
|
25
25
|
spec.add_development_dependency 'bundler', '~> 2.0'
|
26
26
|
spec.add_development_dependency 'guard', '~> 2.14'
|
@@ -29,8 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency 'rb-inotify', '~> 0.9'
|
30
30
|
spec.add_development_dependency 'rspec', '~> 3.4'
|
31
31
|
spec.add_development_dependency 'simplecov', '~> 0.11'
|
32
|
-
spec.add_development_dependency 'webmock', '~>
|
33
|
-
spec.add_development_dependency 'rubocop-discourse'
|
32
|
+
spec.add_development_dependency 'webmock', '~> 3.0'
|
33
|
+
spec.add_development_dependency 'rubocop-discourse', '~> 2.4.1'
|
34
34
|
|
35
|
-
spec.required_ruby_version = '>= 2.
|
35
|
+
spec.required_ruby_version = '>= 2.5.0'
|
36
36
|
end
|
data/examples/category.rb
CHANGED
@@ -14,6 +14,9 @@ puts client.categories()
|
|
14
14
|
# get sub categories for parent category with id 2
|
15
15
|
puts client.categories(parent_category_id: 2)
|
16
16
|
|
17
|
+
# get the full categories response
|
18
|
+
puts client.categories_full()
|
19
|
+
|
17
20
|
# List topics in a category
|
18
21
|
category_topics = client.category_latest_topics(category_slug: "test-category")
|
19
22
|
puts category_topics
|
@@ -16,9 +16,8 @@ response = client.create_topic(
|
|
16
16
|
raw: "This is the raw markdown for my post"
|
17
17
|
)
|
18
18
|
|
19
|
-
# get topic_id
|
19
|
+
# get topic_id from response
|
20
20
|
topic_id = response['topic_id']
|
21
|
-
topic_slug = response['topic_slug']
|
22
21
|
|
23
22
|
##
|
24
23
|
# available options (guessing from reading discourse source)
|
@@ -28,8 +27,8 @@ topic_slug = response['topic_slug']
|
|
28
27
|
|
29
28
|
# lock topic (note: api_username determines user that is performing action)
|
30
29
|
params = { status: 'closed', enabled: true, api_username: "YOUR USERNAME/USERS USERNAME" }
|
31
|
-
client.change_topic_status(
|
30
|
+
client.change_topic_status(topic_id, params)
|
32
31
|
|
33
32
|
# unlock topic (note: api_username determines user that is performing action)
|
34
33
|
params = { status: 'closed', enabled: false, api_username: "YOUR USERNAME/USERS USERNAME" }
|
35
|
-
client.change_topic_status(
|
34
|
+
client.change_topic_status(topic_id, params)
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require File.expand_path('../../lib/discourse_api', __FILE__)
|
4
|
+
|
5
|
+
config = DiscourseApi::ExampleHelper.load_yml
|
6
|
+
|
7
|
+
client = DiscourseApi::Client.new(config['host'] || 'http://localhost:3000')
|
8
|
+
client.api_key = config['api_key'] || "YOUR_API_KEY"
|
9
|
+
client.api_username = config['api_username'] || "YOUR_USERNAME"
|
10
|
+
|
11
|
+
# generate user api key
|
12
|
+
response = client.create_api_key(
|
13
|
+
key: {
|
14
|
+
description: "Key to The Batmobile",
|
15
|
+
username: "batman"
|
16
|
+
}
|
17
|
+
)
|
18
|
+
|
19
|
+
api_key_id = response["key"]["id"]
|
20
|
+
|
21
|
+
puts response
|
22
|
+
# sample output: {"key"=>{"id"=>13, "key"=>"abc", "description"=>"Key to the Batmobile"}}
|
23
|
+
|
24
|
+
response = client.revoke_api_key(api_key_id)
|
25
|
+
|
26
|
+
puts response
|
27
|
+
# sample output: {"key"=>{"id"=>13, "key"=>"abc", "description"=>"Key to the Batmobile", "revoked_at"=>"2021-01-01T00:00:00.000Z"}}
|
28
|
+
|
29
|
+
response = client.undo_revoke_api_key(api_key_id)
|
30
|
+
|
31
|
+
puts response
|
32
|
+
# sample output: {"key"=>{"id"=>13, "key"=>"abc", "description"=>"Key to the Batmobile", "revoked_at"=>nil}}
|
33
|
+
|
34
|
+
response = client.list_api_keys
|
35
|
+
|
36
|
+
puts response
|
37
|
+
# sample output: {"keys"=>[{"id"=>13, "key"=>"abc", "description"=>"Key to the Batmobile"}]}
|
38
|
+
|
39
|
+
response = client.delete_api_key(api_key_id)
|
40
|
+
|
41
|
+
puts response
|
42
|
+
# sample output: {"success"=>"OK"}
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
3
|
+
require File.expand_path('../../lib/discourse_api', __FILE__)
|
4
|
+
|
5
|
+
config = DiscourseApi::ExampleHelper.load_yml
|
6
|
+
|
7
|
+
client = DiscourseApi::Client.new(config['host'] || 'http://localhost:3000')
|
8
|
+
client.api_key = config['api_key'] || "YOUR_API_KEY"
|
9
|
+
client.api_username = config['api_username'] || "YOUR_USERNAME"
|
10
|
+
|
11
|
+
# watch an entire category
|
12
|
+
client.category_set_user_notification_level(1, notification_level: 3)
|
13
|
+
|
14
|
+
# mute a topic
|
15
|
+
client.topic_set_user_notification_level(1, notification_level: 0)
|
data/examples/topic_lists.rb
CHANGED
@@ -11,6 +11,9 @@ client.api_username = config['api_username'] || "YOUR_USERNAME"
|
|
11
11
|
# get latest topics
|
12
12
|
puts client.latest_topics({})
|
13
13
|
|
14
|
+
# get top topics
|
15
|
+
puts client.top_topics
|
16
|
+
|
14
17
|
# recategorize topic
|
15
18
|
puts client.recategorize_topic(topic_id: 108, category_id: 5)
|
16
19
|
|
@@ -2,22 +2,28 @@
|
|
2
2
|
module DiscourseApi
|
3
3
|
module API
|
4
4
|
module ApiKey
|
5
|
-
def
|
6
|
-
response = get("/admin/api
|
7
|
-
response
|
5
|
+
def list_api_keys
|
6
|
+
response = get("/admin/api/keys")
|
7
|
+
response[:body]
|
8
8
|
end
|
9
9
|
|
10
|
-
def
|
11
|
-
|
10
|
+
def create_api_key(args)
|
11
|
+
args = API.params(args)
|
12
|
+
.required(:key)
|
13
|
+
.to_h
|
14
|
+
post("/admin/api/keys", args)
|
12
15
|
end
|
13
16
|
|
14
17
|
def revoke_api_key(id)
|
15
|
-
|
18
|
+
post("/admin/api/keys/#{id}/revoke")
|
16
19
|
end
|
17
20
|
|
18
|
-
def
|
19
|
-
|
20
|
-
|
21
|
+
def undo_revoke_api_key(id)
|
22
|
+
post("/admin/api/keys/#{id}/undo-revoke")
|
23
|
+
end
|
24
|
+
|
25
|
+
def delete_api_key(id)
|
26
|
+
delete("/admin/api/keys/#{id}")
|
21
27
|
end
|
22
28
|
end
|
23
29
|
end
|
@@ -10,7 +10,8 @@ module DiscourseApi
|
|
10
10
|
.required(:name, :color, :text_color)
|
11
11
|
.optional(:slug, :permissions, :auto_close_hours, :auto_close_based_on_last_post, :position, :email_in,
|
12
12
|
:email_in_allow_strangers, :logo_url, :background_url, :allow_badges, :topic_template, :custom_fields, :description,
|
13
|
-
:reviewable_by_group_name, :show_subcategory_list, :subcategory_list_style
|
13
|
+
:reviewable_by_group_name, :show_subcategory_list, :subcategory_list_style,
|
14
|
+
:allowed_tags, :allowed_tag_groups, :required_tag_group_name)
|
14
15
|
.default(parent_category_id: nil)
|
15
16
|
response = post("/categories", args)
|
16
17
|
response['category']
|
@@ -22,7 +23,8 @@ module DiscourseApi
|
|
22
23
|
.required(:id, :name, :color, :text_color)
|
23
24
|
.optional(:slug, :permissions, :auto_close_hours, :auto_close_based_on_last_post, :position, :email_in,
|
24
25
|
:email_in_allow_strangers, :logo_url, :background_url, :allow_badges, :topic_template, :custom_fields, :description,
|
25
|
-
:reviewable_by_group_name, :show_subcategory_list, :subcategory_list_style
|
26
|
+
:reviewable_by_group_name, :show_subcategory_list, :subcategory_list_style,
|
27
|
+
:allowed_tags, :allowed_tag_groups, :required_tag_group_name)
|
26
28
|
.default(parent_category_id: nil)
|
27
29
|
response = put("/categories/#{category_id}", args)
|
28
30
|
response['body']['category'] if response['body']
|
@@ -34,11 +36,24 @@ module DiscourseApi
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def categories(params = {})
|
39
|
+
categories_full(params)['category_list']['categories']
|
40
|
+
end
|
41
|
+
|
42
|
+
def categories_full(params = {})
|
37
43
|
response = get('/categories.json', params)
|
38
|
-
response[:body]
|
44
|
+
response[:body]
|
39
45
|
end
|
40
46
|
|
41
47
|
def category_latest_topics(args = {})
|
48
|
+
response = category_latest_topics_full(args)
|
49
|
+
if response['errors']
|
50
|
+
response['errors']
|
51
|
+
else
|
52
|
+
response['topic_list']['topics']
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def category_latest_topics_full(args = {})
|
42
57
|
params = API.params(args)
|
43
58
|
.required(:category_slug)
|
44
59
|
.optional(:page).to_h
|
@@ -47,25 +62,31 @@ module DiscourseApi
|
|
47
62
|
url = "#{url}?page=#{params[:page]}"
|
48
63
|
end
|
49
64
|
response = get(url)
|
50
|
-
|
51
|
-
response[:body]['errors']
|
52
|
-
else
|
53
|
-
response[:body]['topic_list']['topics']
|
54
|
-
end
|
65
|
+
response[:body]
|
55
66
|
end
|
56
67
|
|
57
68
|
def category_top_topics(category_slug)
|
58
|
-
response =
|
59
|
-
if response[
|
60
|
-
response[
|
69
|
+
response = category_top_topics_full(category_slug)
|
70
|
+
if response['errors']
|
71
|
+
response['errors']
|
61
72
|
else
|
62
|
-
response[
|
73
|
+
response['topic_list']['topics']
|
63
74
|
end
|
64
75
|
end
|
65
76
|
|
77
|
+
def category_top_topics_full(category_slug)
|
78
|
+
response = get("/c/#{category_slug}/l/top.json")
|
79
|
+
response[:body]
|
80
|
+
end
|
81
|
+
|
66
82
|
def category_new_topics(category_slug)
|
83
|
+
response = category_new_topics_full(category_slug)
|
84
|
+
response['topic_list']['topics']
|
85
|
+
end
|
86
|
+
|
87
|
+
def category_new_topics_full(category_slug)
|
67
88
|
response = get("/c/#{category_slug}/l/new.json")
|
68
|
-
response[:body]
|
89
|
+
response[:body]
|
69
90
|
end
|
70
91
|
|
71
92
|
def category(id)
|
@@ -73,12 +94,19 @@ module DiscourseApi
|
|
73
94
|
response[:body]['category']
|
74
95
|
end
|
75
96
|
|
97
|
+
# TODO: Deprecated. Remove after 20210727
|
76
98
|
def category_set_user_notification(args = {})
|
77
99
|
category_id = args[:id]
|
78
100
|
args = API.params(args)
|
79
101
|
.required(:notification_level)
|
80
102
|
post("/category/#{category_id}/notifications", args)
|
81
103
|
end
|
104
|
+
|
105
|
+
def category_set_user_notification_level(category_id, params)
|
106
|
+
params = API.params(params)
|
107
|
+
.required(:notification_level)
|
108
|
+
post("/category/#{category_id}/notifications", params)
|
109
|
+
end
|
82
110
|
end
|
83
111
|
end
|
84
112
|
end
|
@@ -60,8 +60,16 @@ module DiscourseApi
|
|
60
60
|
put("/groups/#{group_id}", group: args)
|
61
61
|
end
|
62
62
|
|
63
|
-
def groups
|
64
|
-
|
63
|
+
def groups(args = {})
|
64
|
+
params = API.params(args)
|
65
|
+
.optional(:page)
|
66
|
+
.to_h
|
67
|
+
|
68
|
+
url = "/groups.json"
|
69
|
+
if params.include?(:page)
|
70
|
+
url += "?page=#{params[:page]}"
|
71
|
+
end
|
72
|
+
response = get(url)
|
65
73
|
response.body
|
66
74
|
end
|
67
75
|
|
@@ -12,7 +12,7 @@ module DiscourseApi
|
|
12
12
|
raise ArgumentError.new("#{term} is required but not specified") unless term
|
13
13
|
raise ArgumentError.new("#{term} is required but not specified") unless !term.empty?
|
14
14
|
|
15
|
-
response = get('/search
|
15
|
+
response = get('/search', options.merge(q: term))
|
16
16
|
response[:body]
|
17
17
|
end
|
18
18
|
end
|
@@ -29,6 +29,11 @@ module DiscourseApi
|
|
29
29
|
response[:body]['topic_list']['topics']
|
30
30
|
end
|
31
31
|
|
32
|
+
def top_topics(params = {})
|
33
|
+
response = get("/top.json", params)
|
34
|
+
response[:body]['topic_list']['topics']
|
35
|
+
end
|
36
|
+
|
32
37
|
def new_topics(params = {})
|
33
38
|
response = get("/new.json", params)
|
34
39
|
response[:body]['topic_list']['topics']
|
@@ -42,11 +47,17 @@ module DiscourseApi
|
|
42
47
|
put("/t/#{topic_id}.json", topic_id: topic_id, category_id: category_id)
|
43
48
|
end
|
44
49
|
|
50
|
+
# TODO: Deprecated. Remove after 20201231
|
45
51
|
def change_topic_status(topic_slug, topic_id, params = {})
|
52
|
+
deprecated(__method__, 'update_topic_status')
|
53
|
+
update_topic_status(topic_id, params)
|
54
|
+
end
|
55
|
+
|
56
|
+
def update_topic_status(topic_id, params = {})
|
46
57
|
params = API.params(params)
|
47
58
|
.required(:status, :enabled)
|
48
59
|
.optional(:api_username)
|
49
|
-
put("/t/#{topic_id}/status", params
|
60
|
+
put("/t/#{topic_id}/status", params)
|
50
61
|
end
|
51
62
|
|
52
63
|
def topic(id, params = {})
|
@@ -72,6 +83,19 @@ module DiscourseApi
|
|
72
83
|
response = get(url.join)
|
73
84
|
response[:body]
|
74
85
|
end
|
86
|
+
|
87
|
+
def change_owner(topic_id, params = {})
|
88
|
+
params = API.params(params)
|
89
|
+
.required(:username, :post_ids)
|
90
|
+
|
91
|
+
post("/t/#{topic_id}/change-owner.json", params)
|
92
|
+
end
|
93
|
+
|
94
|
+
def topic_set_user_notification_level(topic_id, params)
|
95
|
+
params = API.params(params)
|
96
|
+
.required(:notification_level)
|
97
|
+
post("/t/#{topic_id}/notifications", params)
|
98
|
+
end
|
75
99
|
end
|
76
100
|
end
|
77
101
|
end
|
@@ -52,7 +52,7 @@ module DiscourseApi
|
|
52
52
|
def create_user(args)
|
53
53
|
args = API.params(args)
|
54
54
|
.required(:name, :email, :password, :username)
|
55
|
-
.optional(:active, :staged, :user_fields)
|
55
|
+
.optional(:active, :approved, :staged, :user_fields)
|
56
56
|
.to_h
|
57
57
|
post("/users", args)
|
58
58
|
end
|
data/lib/discourse_api/client.rb
CHANGED
@@ -109,6 +109,10 @@ module DiscourseApi
|
|
109
109
|
@user_agent ||= "DiscourseAPI Ruby Gem #{DiscourseApi::VERSION}"
|
110
110
|
end
|
111
111
|
|
112
|
+
def deprecated(old, new)
|
113
|
+
warn "[DEPRECATED]: `#{old}` is deprecated. Please use `#{new}` instead."
|
114
|
+
end
|
115
|
+
|
112
116
|
private
|
113
117
|
|
114
118
|
def connection
|
@@ -10,77 +10,101 @@ describe DiscourseApi::API::ApiKey do
|
|
10
10
|
)
|
11
11
|
}
|
12
12
|
|
13
|
-
describe "#
|
13
|
+
describe "#list_api_keys" do
|
14
14
|
before do
|
15
|
-
url = "#{host}/admin/api
|
16
|
-
stub_get(url).to_return(body: fixture("
|
15
|
+
url = "#{host}/admin/api/keys"
|
16
|
+
stub_get(url).to_return(body: fixture("list_api_keys.json"),
|
17
17
|
headers: { content_type: "application/json" })
|
18
18
|
end
|
19
19
|
|
20
20
|
it "requests the correct resource" do
|
21
|
-
subject.
|
22
|
-
url = "#{host}/admin/api
|
21
|
+
subject.list_api_keys
|
22
|
+
url = "#{host}/admin/api/keys"
|
23
23
|
expect(a_get(url)).to have_been_made
|
24
24
|
end
|
25
25
|
|
26
26
|
it "returns the requested api keys" do
|
27
|
-
|
28
|
-
expect(
|
29
|
-
expect(
|
30
|
-
expect(
|
27
|
+
keys = subject.list_api_keys
|
28
|
+
expect(keys["keys"]).to be_an Array
|
29
|
+
expect(keys["keys"].first).to be_a Hash
|
30
|
+
expect(keys["keys"].first).to have_key('key')
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
describe "#
|
34
|
+
describe "#create_api_key" do
|
35
35
|
before do
|
36
|
-
url = "#{host}/admin/api/
|
37
|
-
stub_post(url).to_return(body: fixture("
|
36
|
+
url = "#{host}/admin/api/keys"
|
37
|
+
stub_post(url).to_return(body: fixture("api_key.json"),
|
38
38
|
headers: { content_type: "application/json" })
|
39
39
|
end
|
40
40
|
|
41
|
-
it "
|
42
|
-
|
43
|
-
|
44
|
-
expect(
|
45
|
-
|
41
|
+
it "requests the correct resource" do
|
42
|
+
subject.create_api_key(key: { username: 'robin' })
|
43
|
+
url = "#{host}/admin/api/keys"
|
44
|
+
expect(a_post(url)).to have_been_made
|
45
|
+
end
|
46
|
+
|
47
|
+
it "returns the generated api key" do
|
48
|
+
api_key = subject.create_api_key(key: { username: 'robin' })
|
49
|
+
expect(api_key).to be_a Hash
|
50
|
+
expect(api_key['key']).to have_key('key')
|
46
51
|
end
|
47
52
|
end
|
48
53
|
|
49
54
|
describe "#revoke_api_key" do
|
50
55
|
before do
|
51
|
-
url = "#{host}/admin/api/
|
52
|
-
|
53
|
-
|
56
|
+
url = "#{host}/admin/api/keys/10/revoke"
|
57
|
+
stub_post(url).to_return(body: fixture("api_key.json"),
|
58
|
+
headers: { content_type: "application/json" })
|
54
59
|
end
|
55
60
|
|
56
61
|
it "requests the correct resource" do
|
57
62
|
subject.revoke_api_key(10)
|
58
|
-
url = "#{host}/admin/api/
|
59
|
-
expect(
|
63
|
+
url = "#{host}/admin/api/keys/10/revoke"
|
64
|
+
expect(a_post(url)).to have_been_made
|
60
65
|
end
|
61
66
|
|
62
|
-
it "returns
|
63
|
-
|
64
|
-
expect(
|
67
|
+
it "returns the api key" do
|
68
|
+
api_key = subject.revoke_api_key(10)
|
69
|
+
expect(api_key['key']).to have_key('key')
|
65
70
|
end
|
66
71
|
end
|
67
72
|
|
68
|
-
describe "#
|
73
|
+
describe "#undo_revoke_api_key" do
|
69
74
|
before do
|
70
|
-
url = "#{host}/admin/api/
|
71
|
-
|
72
|
-
|
75
|
+
url = "#{host}/admin/api/keys/10/undo-revoke"
|
76
|
+
stub_post(url).to_return(body: fixture("api_key.json"),
|
77
|
+
headers: { content_type: "application/json" })
|
73
78
|
end
|
74
79
|
|
75
80
|
it "requests the correct resource" do
|
76
|
-
subject.
|
77
|
-
url = "#{host}/admin/api/
|
78
|
-
expect(
|
81
|
+
subject.undo_revoke_api_key(10)
|
82
|
+
url = "#{host}/admin/api/keys/10/undo-revoke"
|
83
|
+
expect(a_post(url)).to have_been_made
|
79
84
|
end
|
80
85
|
|
81
|
-
it "returns the
|
82
|
-
|
83
|
-
expect(
|
86
|
+
it "returns the api key" do
|
87
|
+
api_key = subject.undo_revoke_api_key(10)
|
88
|
+
expect(api_key['key']).to have_key('key')
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "#delete_api_key" do
|
93
|
+
before do
|
94
|
+
url = "#{host}/admin/api/keys/10"
|
95
|
+
stub_delete(url).to_return(body: '{"success": "OK"}',
|
96
|
+
headers: { content_type: "application/json" })
|
97
|
+
end
|
98
|
+
|
99
|
+
it "requests the correct resource" do
|
100
|
+
subject.delete_api_key(10)
|
101
|
+
url = "#{host}/admin/api/keys/10"
|
102
|
+
expect(a_delete(url)).to have_been_made
|
103
|
+
end
|
104
|
+
|
105
|
+
it "returns 200" do
|
106
|
+
response = subject.delete_api_key(10)
|
107
|
+
expect(response['status']).to eq(200)
|
84
108
|
end
|
85
109
|
end
|
86
110
|
end
|
@@ -28,6 +28,25 @@ describe DiscourseApi::API::Categories do
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
describe "#categories_full" do
|
32
|
+
before do
|
33
|
+
stub_get("#{host}/categories.json")
|
34
|
+
.to_return(body: fixture("categories.json"), headers: { content_type: "application/json" })
|
35
|
+
end
|
36
|
+
|
37
|
+
it "requests the correct resource" do
|
38
|
+
subject.categories
|
39
|
+
expect(a_get("#{host}/categories.json")).to have_been_made
|
40
|
+
end
|
41
|
+
|
42
|
+
it "returns the entire categories response" do
|
43
|
+
categories = subject.categories_full
|
44
|
+
expect(categories).to be_a Hash
|
45
|
+
expect(categories).to have_key 'category_list'
|
46
|
+
expect(categories).to have_key 'featured_users'
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
31
50
|
describe '#category_latest_topics' do
|
32
51
|
before do
|
33
52
|
stub_get("#{host}/c/category-slug/l/latest.json")
|
@@ -40,6 +59,20 @@ describe DiscourseApi::API::Categories do
|
|
40
59
|
end
|
41
60
|
end
|
42
61
|
|
62
|
+
describe '#category_latest_topics_full' do
|
63
|
+
before do
|
64
|
+
stub_get("#{host}/c/category-slug/l/latest.json")
|
65
|
+
.to_return(body: fixture("category_latest_topics.json"), headers: { content_type: "application/json" })
|
66
|
+
end
|
67
|
+
|
68
|
+
it "returns the entire latest topics in a category response" do
|
69
|
+
latest_topics = subject.category_latest_topics_full(category_slug: 'category-slug')
|
70
|
+
expect(latest_topics).to be_a Hash
|
71
|
+
expect(latest_topics).to have_key 'topic_list'
|
72
|
+
expect(latest_topics).to have_key 'users'
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
43
76
|
describe '#category_top_topics' do
|
44
77
|
before do
|
45
78
|
stub_get("#{host}/c/category-slug/l/top.json")
|
@@ -55,6 +88,23 @@ describe DiscourseApi::API::Categories do
|
|
55
88
|
end
|
56
89
|
end
|
57
90
|
|
91
|
+
describe '#category_top_topics_full' do
|
92
|
+
before do
|
93
|
+
stub_get("#{host}/c/category-slug/l/top.json")
|
94
|
+
.to_return(
|
95
|
+
body: fixture("category_topics.json"),
|
96
|
+
headers: { content_type: "application/json" }
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
it "returns the entire top topics in a category response" do
|
101
|
+
topics = subject.category_top_topics_full('category-slug')
|
102
|
+
expect(topics).to be_a Hash
|
103
|
+
expect(topics).to have_key 'topic_list'
|
104
|
+
expect(topics).to have_key 'users'
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
58
108
|
describe '#category_new_topics' do
|
59
109
|
before do
|
60
110
|
stub_get("#{host}/c/category-slug/l/new.json")
|
@@ -70,6 +120,23 @@ describe DiscourseApi::API::Categories do
|
|
70
120
|
end
|
71
121
|
end
|
72
122
|
|
123
|
+
describe '#category_new_topics_full' do
|
124
|
+
before do
|
125
|
+
stub_get("#{host}/c/category-slug/l/new.json")
|
126
|
+
.to_return(
|
127
|
+
body: fixture("category_topics.json"),
|
128
|
+
headers: { content_type: "application/json" }
|
129
|
+
)
|
130
|
+
end
|
131
|
+
|
132
|
+
it "returns the new topics in a category" do
|
133
|
+
topics = subject.category_new_topics_full('category-slug')
|
134
|
+
expect(topics).to be_a Hash
|
135
|
+
expect(topics).to have_key 'topic_list'
|
136
|
+
expect(topics).to have_key 'users'
|
137
|
+
end
|
138
|
+
end
|
139
|
+
|
73
140
|
describe '#category_new_category' do
|
74
141
|
before do
|
75
142
|
stub_post("#{host}/categories")
|
@@ -85,4 +152,27 @@ describe DiscourseApi::API::Categories do
|
|
85
152
|
end
|
86
153
|
end
|
87
154
|
|
155
|
+
describe "#category_set_user_notification" do
|
156
|
+
before do
|
157
|
+
stub_post("#{host}/category/1/notifications").to_return(body: fixture("notification_success.json"), headers: { content_type: "application/json" })
|
158
|
+
end
|
159
|
+
|
160
|
+
it "makes the post request" do
|
161
|
+
response = subject.category_set_user_notification(id: 1, notification_level: 3)
|
162
|
+
expect(a_post("#{host}/category/1/notifications")).to have_been_made
|
163
|
+
expect(response['success']).to eq('OK')
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
describe "#category_set_user_notification_level" do
|
168
|
+
before do
|
169
|
+
stub_post("#{host}/category/1/notifications").to_return(body: fixture("notification_success.json"), headers: { content_type: "application/json" })
|
170
|
+
end
|
171
|
+
|
172
|
+
it "makes the post request" do
|
173
|
+
response = subject.category_set_user_notification_level(1, notification_level: 3)
|
174
|
+
expect(a_post("#{host}/category/1/notifications").with(body: "notification_level=3")).to have_been_made
|
175
|
+
expect(response['success']).to eq('OK')
|
176
|
+
end
|
177
|
+
end
|
88
178
|
end
|
@@ -6,12 +6,12 @@ describe DiscourseApi::API::Search do
|
|
6
6
|
|
7
7
|
describe "#search" do
|
8
8
|
before do
|
9
|
-
stub_get("#{host}/search
|
9
|
+
stub_get("#{host}/search").with(query: { q: "test" }).to_return(body: fixture("search.json"), headers: { content_type: "application/json" })
|
10
10
|
end
|
11
11
|
|
12
12
|
it "requests the correct resource" do
|
13
13
|
subject.search("test")
|
14
|
-
expect(a_get("#{host}/search
|
14
|
+
expect(a_get("#{host}/search").with(query: { q: "test" })).to have_been_made
|
15
15
|
end
|
16
16
|
|
17
17
|
it "returns the requested search" do
|
@@ -10,7 +10,7 @@ describe DiscourseApi::API::Topics do
|
|
10
10
|
end
|
11
11
|
|
12
12
|
it "changes the topic status" do
|
13
|
-
subject.
|
13
|
+
subject.update_topic_status(57, { status: 'visible', enabled: false })
|
14
14
|
expect(a_put("#{host}/t/57/status")).to have_been_made
|
15
15
|
end
|
16
16
|
end
|
@@ -55,6 +55,29 @@ describe DiscourseApi::API::Topics do
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
describe "#top_topics" do
|
59
|
+
before do
|
60
|
+
stub_get("#{host}/top.json").to_return(body: fixture("top.json"), headers: { content_type: "application/json" })
|
61
|
+
end
|
62
|
+
|
63
|
+
it "requests the correct resource" do
|
64
|
+
subject.top_topics
|
65
|
+
expect(a_get("#{host}/top.json")).to have_been_made
|
66
|
+
end
|
67
|
+
|
68
|
+
it "returns the requested topics" do
|
69
|
+
topics = subject.top_topics
|
70
|
+
expect(topics).to be_an Array
|
71
|
+
expect(topics.first).to be_a Hash
|
72
|
+
end
|
73
|
+
|
74
|
+
it "can take a hash param" do
|
75
|
+
topics = subject.top_topics({})
|
76
|
+
expect(topics).to be_an Array
|
77
|
+
expect(topics.first).to be_a Hash
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
58
81
|
describe "#new_topics" do
|
59
82
|
before do
|
60
83
|
stub_get("#{host}/new.json").to_return(body: fixture("new.json"), headers: { content_type: "application/json" })
|
@@ -166,4 +189,15 @@ describe DiscourseApi::API::Topics do
|
|
166
189
|
end
|
167
190
|
end
|
168
191
|
|
192
|
+
describe "#topic_set_user_notification_level" do
|
193
|
+
before do
|
194
|
+
stub_post("#{host}/t/1/notifications").to_return(body: fixture("notification_success.json"), headers: { content_type: "application/json" })
|
195
|
+
end
|
196
|
+
|
197
|
+
it "makes the post request" do
|
198
|
+
response = subject.topic_set_user_notification_level(1, notification_level: 3)
|
199
|
+
expect(a_post("#{host}/t/1/notifications").with(body: "notification_level=3")).to have_been_made
|
200
|
+
expect(response['success']).to eq('OK')
|
201
|
+
end
|
202
|
+
end
|
169
203
|
end
|
@@ -0,0 +1,108 @@
|
|
1
|
+
{
|
2
|
+
"topic_list": {
|
3
|
+
"can_create_topic": false,
|
4
|
+
"more_topics_url": "/latest.json?page=1",
|
5
|
+
"draft": null,
|
6
|
+
"draft_key": "new_topic",
|
7
|
+
"draft_sequence": null,
|
8
|
+
"topics": [
|
9
|
+
{
|
10
|
+
"id": 1,
|
11
|
+
"title": "Test topic #1",
|
12
|
+
"fancy_title": "Test topic #1",
|
13
|
+
"slug": "test-topic-1",
|
14
|
+
"posts_count": 1,
|
15
|
+
"reply_count": 0,
|
16
|
+
"highest_post_number": 1,
|
17
|
+
"image_url": null,
|
18
|
+
"created_at": "2013-02-04T15:26:25.977-05:00",
|
19
|
+
"last_posted_at": "2013-02-05T12:14:17.364-05:00",
|
20
|
+
"bumped": true,
|
21
|
+
"bumped_at": "2013-02-07T13:43:11.191-05:00",
|
22
|
+
"unseen": false,
|
23
|
+
"pinned": true,
|
24
|
+
"excerpt": "Welcome! \n\nTry is a sandbox, a safe place to play with Discourse and its features.\n\nThis site is reset every day (or even more often). Any accounts or posts you create here will not exist tomorrow! \n\nFeel free to experim…",
|
25
|
+
"visible": true,
|
26
|
+
"closed": false,
|
27
|
+
"archived": false,
|
28
|
+
"views": 268,
|
29
|
+
"like_count": 14,
|
30
|
+
"has_best_of": false,
|
31
|
+
"archetype": "regular",
|
32
|
+
"last_poster_username": "test_user",
|
33
|
+
"category_id": 1,
|
34
|
+
"posters": [
|
35
|
+
{
|
36
|
+
"extras": null,
|
37
|
+
"description": "Original Poster, Most Recent Poster",
|
38
|
+
"user_id": 1
|
39
|
+
}
|
40
|
+
]
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"id": 1,
|
44
|
+
"title": "Test topic #2",
|
45
|
+
"fancy_title": "Test topic #2",
|
46
|
+
"slug": "test-topic-1",
|
47
|
+
"posts_count": 1,
|
48
|
+
"reply_count": 0,
|
49
|
+
"highest_post_number": 2,
|
50
|
+
"image_url": null,
|
51
|
+
"created_at": "2013-11-06T13:57:47.984-05:00",
|
52
|
+
"last_posted_at": "2013-11-06T13:57:48.111-05:00",
|
53
|
+
"bumped": true,
|
54
|
+
"bumped_at": "2013-11-06T13:57:48.111-05:00",
|
55
|
+
"unseen": false,
|
56
|
+
"pinned": false,
|
57
|
+
"visible": true,
|
58
|
+
"closed": false,
|
59
|
+
"archived": false,
|
60
|
+
"views": 1,
|
61
|
+
"like_count": 0,
|
62
|
+
"has_best_of": false,
|
63
|
+
"archetype": "regular",
|
64
|
+
"last_poster_username": "test_user",
|
65
|
+
"category_id": 1,
|
66
|
+
"posters": [
|
67
|
+
{
|
68
|
+
"extras": null,
|
69
|
+
"description": "Original Poster, Most Recent Poster",
|
70
|
+
"user_id": 1
|
71
|
+
}
|
72
|
+
]
|
73
|
+
},
|
74
|
+
{
|
75
|
+
"id": 1,
|
76
|
+
"title": "Test topic #3",
|
77
|
+
"fancy_title": "Test topic #3",
|
78
|
+
"slug": "test-topic-3",
|
79
|
+
"posts_count": 1,
|
80
|
+
"reply_count": 0,
|
81
|
+
"highest_post_number": 1,
|
82
|
+
"image_url": null,
|
83
|
+
"created_at": "2013-02-04T21:46:58.194-05:00",
|
84
|
+
"last_posted_at": "2013-11-06T13:56:27.753-05:00",
|
85
|
+
"bumped": true,
|
86
|
+
"bumped_at": "2013-11-06T13:56:27.753-05:00",
|
87
|
+
"unseen": false,
|
88
|
+
"pinned": false,
|
89
|
+
"visible": true,
|
90
|
+
"closed": false,
|
91
|
+
"archived": false,
|
92
|
+
"views": 82,
|
93
|
+
"like_count": 10,
|
94
|
+
"has_best_of": false,
|
95
|
+
"archetype": "regular",
|
96
|
+
"last_poster_username": "test_user",
|
97
|
+
"category_id": 1,
|
98
|
+
"posters": [
|
99
|
+
{
|
100
|
+
"extras": null,
|
101
|
+
"description": "Original Poster, Most Recent Poster",
|
102
|
+
"user_id": 1
|
103
|
+
}
|
104
|
+
]
|
105
|
+
}
|
106
|
+
]
|
107
|
+
}
|
108
|
+
}
|
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.45.1
|
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:
|
14
|
+
date: 2021-03-11 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: faraday
|
@@ -159,28 +159,28 @@ dependencies:
|
|
159
159
|
requirements:
|
160
160
|
- - "~>"
|
161
161
|
- !ruby/object:Gem::Version
|
162
|
-
version: '
|
162
|
+
version: '3.0'
|
163
163
|
type: :development
|
164
164
|
prerelease: false
|
165
165
|
version_requirements: !ruby/object:Gem::Requirement
|
166
166
|
requirements:
|
167
167
|
- - "~>"
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version: '
|
169
|
+
version: '3.0'
|
170
170
|
- !ruby/object:Gem::Dependency
|
171
171
|
name: rubocop-discourse
|
172
172
|
requirement: !ruby/object:Gem::Requirement
|
173
173
|
requirements:
|
174
|
-
- - "
|
174
|
+
- - "~>"
|
175
175
|
- !ruby/object:Gem::Version
|
176
|
-
version:
|
176
|
+
version: 2.4.1
|
177
177
|
type: :development
|
178
178
|
prerelease: false
|
179
179
|
version_requirements: !ruby/object:Gem::Requirement
|
180
180
|
requirements:
|
181
|
-
- - "
|
181
|
+
- - "~>"
|
182
182
|
- !ruby/object:Gem::Version
|
183
|
-
version:
|
183
|
+
version: 2.4.1
|
184
184
|
description: Discourse API
|
185
185
|
email:
|
186
186
|
- sam.saffron@gmail.com
|
@@ -216,6 +216,8 @@ files:
|
|
216
216
|
- examples/group_set_user_notification_level.rb
|
217
217
|
- examples/groups.rb
|
218
218
|
- examples/invite_users.rb
|
219
|
+
- examples/manage_api_keys.rb
|
220
|
+
- examples/notifications.rb
|
219
221
|
- examples/polls.rb
|
220
222
|
- examples/post_action.rb
|
221
223
|
- examples/search.rb
|
@@ -271,7 +273,7 @@ files:
|
|
271
273
|
- spec/discourse_api/api/users_spec.rb
|
272
274
|
- spec/discourse_api/client_spec.rb
|
273
275
|
- spec/fixtures/admin_user.json
|
274
|
-
- spec/fixtures/
|
276
|
+
- spec/fixtures/api_key.json
|
275
277
|
- spec/fixtures/backups.json
|
276
278
|
- spec/fixtures/badges.json
|
277
279
|
- spec/fixtures/categories.json
|
@@ -280,15 +282,16 @@ files:
|
|
280
282
|
- spec/fixtures/create_topic_with_tags.json
|
281
283
|
- spec/fixtures/email_list_all.json
|
282
284
|
- spec/fixtures/email_settings.json
|
283
|
-
- spec/fixtures/generate_master_key.json
|
284
285
|
- spec/fixtures/group.json
|
285
286
|
- spec/fixtures/groups.json
|
286
287
|
- spec/fixtures/hot.json
|
287
288
|
- spec/fixtures/latest.json
|
289
|
+
- spec/fixtures/list_api_keys.json
|
288
290
|
- spec/fixtures/members_0.json
|
289
291
|
- spec/fixtures/members_1.json
|
290
292
|
- spec/fixtures/members_2.json
|
291
293
|
- spec/fixtures/new.json
|
294
|
+
- spec/fixtures/notification_success.json
|
292
295
|
- spec/fixtures/notifications.json
|
293
296
|
- spec/fixtures/polls_toggle_status.json
|
294
297
|
- spec/fixtures/polls_vote.json
|
@@ -302,6 +305,7 @@ files:
|
|
302
305
|
- spec/fixtures/replies.json
|
303
306
|
- spec/fixtures/replies_and_topics.json
|
304
307
|
- spec/fixtures/search.json
|
308
|
+
- spec/fixtures/top.json
|
305
309
|
- spec/fixtures/topic.json
|
306
310
|
- spec/fixtures/topic_invite_user.json
|
307
311
|
- spec/fixtures/topic_posts.json
|
@@ -333,14 +337,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
333
337
|
requirements:
|
334
338
|
- - ">="
|
335
339
|
- !ruby/object:Gem::Version
|
336
|
-
version: 2.
|
340
|
+
version: 2.5.0
|
337
341
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
338
342
|
requirements:
|
339
343
|
- - ">="
|
340
344
|
- !ruby/object:Gem::Version
|
341
345
|
version: '0'
|
342
346
|
requirements: []
|
343
|
-
rubygems_version: 3.
|
347
|
+
rubygems_version: 3.1.4
|
344
348
|
signing_key:
|
345
349
|
specification_version: 4
|
346
350
|
summary: Allows access to the Discourse API
|
@@ -365,7 +369,7 @@ test_files:
|
|
365
369
|
- spec/discourse_api/api/users_spec.rb
|
366
370
|
- spec/discourse_api/client_spec.rb
|
367
371
|
- spec/fixtures/admin_user.json
|
368
|
-
- spec/fixtures/
|
372
|
+
- spec/fixtures/api_key.json
|
369
373
|
- spec/fixtures/backups.json
|
370
374
|
- spec/fixtures/badges.json
|
371
375
|
- spec/fixtures/categories.json
|
@@ -374,15 +378,16 @@ test_files:
|
|
374
378
|
- spec/fixtures/create_topic_with_tags.json
|
375
379
|
- spec/fixtures/email_list_all.json
|
376
380
|
- spec/fixtures/email_settings.json
|
377
|
-
- spec/fixtures/generate_master_key.json
|
378
381
|
- spec/fixtures/group.json
|
379
382
|
- spec/fixtures/groups.json
|
380
383
|
- spec/fixtures/hot.json
|
381
384
|
- spec/fixtures/latest.json
|
385
|
+
- spec/fixtures/list_api_keys.json
|
382
386
|
- spec/fixtures/members_0.json
|
383
387
|
- spec/fixtures/members_1.json
|
384
388
|
- spec/fixtures/members_2.json
|
385
389
|
- spec/fixtures/new.json
|
390
|
+
- spec/fixtures/notification_success.json
|
386
391
|
- spec/fixtures/notifications.json
|
387
392
|
- spec/fixtures/polls_toggle_status.json
|
388
393
|
- spec/fixtures/polls_vote.json
|
@@ -396,6 +401,7 @@ test_files:
|
|
396
401
|
- spec/fixtures/replies.json
|
397
402
|
- spec/fixtures/replies_and_topics.json
|
398
403
|
- spec/fixtures/search.json
|
404
|
+
- spec/fixtures/top.json
|
399
405
|
- spec/fixtures/topic.json
|
400
406
|
- spec/fixtures/topic_invite_user.json
|
401
407
|
- spec/fixtures/topic_posts.json
|
data/spec/fixtures/api.json
DELETED