discourse_api 0.41.0 → 0.45.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e8e19227c879502b171c001c16ecef5ba35e1aa97db19430c30bf35cc7fe6bf0
4
- data.tar.gz: 94571b5d801c0c89e18768bee1182f5d37114bb2e3b06e6665ace17e9acb001e
3
+ metadata.gz: 82cd748487d5d986f8327b702088ea4ea22c43cae311c2634dfa5d9cf4c4059f
4
+ data.tar.gz: a4fd68101134895f5071443f221a2327e9fe9e4a0a79df0d53a620c7e08d685d
5
5
  SHA512:
6
- metadata.gz: 32a0f6371f096dff33f1a71ab200d36824ca4a22f49500f7e06c5f245b53073215f3ae11b2410d11ca0a0a94c8d23546bb66faf48727c0bc241c689fd41795a6
7
- data.tar.gz: 857e1f6535a4d1a49369101e351950f4c393b5f502f2dd7499874347b326b7731a761a97a6f0301b2b97cb64017bc5908bd7505642cb1c6e3524597299ab43fa
6
+ metadata.gz: 42546f17e134cd1e4ac6be81c8fdb53cf82461d60a73859dd757c2ec69e1128127f33a131e45dfec3d910012702256a173a7a1afd2a9873dc3d8a3e220c4af1a
7
+ data.tar.gz: 990fc89fd2a4935704e1512b858872b41ed7a6b7ba3ef28f583ad272e0675daff74f61b9a441632a8dc92c76892b8c507e53afce356317403c7c67f31a4fab18
@@ -1,21 +1,52 @@
1
- # Change Log
1
+ # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
- This project adheres to [Semantic Versioning](http://semver.org/).
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.
34
+
35
+ ## [0.42.0] - 2020-07-09
36
+ ### Added
37
+ - Create topics with tags
4
38
 
5
39
  ## [0.41.0] - 2020-06-17
6
40
  ### Added
7
41
  - Add basic auth support
8
-
9
42
  ### Fixed
10
43
  - Fix SSO custom field prefixes
11
-
12
44
  ### Removed
13
45
  - Obsolete api key endpoints
14
46
 
15
47
  ## [0.40.0] - 2020-05-07
16
48
  ### Fixed
17
49
  - Add missing attributes to `sync_sso`
18
-
19
50
  ### Added
20
51
  - Add delete category method
21
52
 
@@ -37,7 +68,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
37
68
  - Allow more options parameters when creating a category
38
69
  - Don't require topic slug when updating topic status
39
70
  - Example files now read config.yml file when present for client settings
40
-
41
71
  ### Fixed
42
72
  - Issue with `topic_posts` and frozen strings
43
73
  - Fixed some topic and category methods
@@ -289,5 +319,4 @@ This project adheres to [Semantic Versioning](http://semver.org/).
289
319
  - `client.category_latest_posts("category-slug")` endpoint
290
320
 
291
321
  ## [0.1.2] - 2014-05-11
292
-
293
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
@@ -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', '~> 2.0'
32
+ spec.add_development_dependency 'webmock', '~> 3.0'
33
33
  spec.add_development_dependency 'rubocop-discourse'
34
34
 
35
- spec.required_ruby_version = '>= 2.2.3'
35
+ spec.required_ruby_version = '>= 2.5.0'
36
36
  end
@@ -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 and topic_slug from response
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(topic_slug, topic_id, params)
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(topic_slug, topic_id, params)
34
+ client.change_topic_status(topic_id, params)
@@ -24,3 +24,13 @@ client.create_topic(
24
24
  title: "Your Favorite Color?",
25
25
  raw: "[poll name=color]\n- Green\n- Blue\n- Red\n[/poll]"
26
26
  )
27
+
28
+ # Create Topic with Tags
29
+ client.create_topic(
30
+ category: 1,
31
+ skip_validations: true,
32
+ auto_track: false,
33
+ title: "Concert Master: A new way to choose",
34
+ raw: "This is the raw markdown for my post"
35
+ tags: ['asdf', 'fdsa']
36
+ )
@@ -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"}
@@ -2,22 +2,28 @@
2
2
  module DiscourseApi
3
3
  module API
4
4
  module ApiKey
5
- def api
6
- response = get("/admin/api.json")
7
- response.body
5
+ def list_api_keys
6
+ response = get("/admin/api/keys")
7
+ response[:body]
8
8
  end
9
9
 
10
- def generate_master_key
11
- response = post("/admin/api/key")
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
- response = delete("/admin/api/key", id: id)
18
+ post("/admin/api/keys/#{id}/revoke")
16
19
  end
17
20
 
18
- def regenerate_api_key(id)
19
- response = put("/admin/api/key", id: id)
20
- response.body
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']
@@ -60,8 +60,16 @@ module DiscourseApi
60
60
  put("/groups/#{group_id}", group: args)
61
61
  end
62
62
 
63
- def groups
64
- response = get("/groups.json")
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
 
@@ -3,7 +3,7 @@ module DiscourseApi
3
3
  module API
4
4
  module Tags
5
5
  def show_tag(tag)
6
- response = get("/tags/#{tag}")
6
+ response = get("/tag/#{tag}")
7
7
  response[:body]
8
8
  end
9
9
  end
@@ -9,7 +9,7 @@ module DiscourseApi
9
9
  def create_topic(args = {})
10
10
  args = API.params(args)
11
11
  .required(:title, :raw)
12
- .optional(:skip_validations, :category, :auto_track, :created_at, :api_username)
12
+ .optional(:skip_validations, :category, :auto_track, :created_at, :api_username, :tags)
13
13
  post("/posts", args.to_h)
14
14
  end
15
15
 
@@ -42,11 +42,17 @@ module DiscourseApi
42
42
  put("/t/#{topic_id}.json", topic_id: topic_id, category_id: category_id)
43
43
  end
44
44
 
45
+ # TODO: Deprecated. Remove after 20201231
45
46
  def change_topic_status(topic_slug, topic_id, params = {})
47
+ deprecated(__method__, 'update_topic_status')
48
+ update_topic_status(topic_id, params)
49
+ end
50
+
51
+ def update_topic_status(topic_id, params = {})
46
52
  params = API.params(params)
47
53
  .required(:status, :enabled)
48
54
  .optional(:api_username)
49
- put("/t/#{topic_id}/status", params.to_h)
55
+ put("/t/#{topic_id}/status", params)
50
56
  end
51
57
 
52
58
  def topic(id, params = {})
@@ -72,6 +78,13 @@ module DiscourseApi
72
78
  response = get(url.join)
73
79
  response[:body]
74
80
  end
81
+
82
+ def change_owner(topic_id, params = {})
83
+ params = API.params(params)
84
+ .required(:username, :post_ids)
85
+
86
+ post("/t/#{topic_id}/change-owner.json", params)
87
+ end
75
88
  end
76
89
  end
77
90
  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
@@ -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
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module DiscourseApi
3
- VERSION = "0.41.0"
3
+ VERSION = "0.45.0"
4
4
  end
@@ -10,77 +10,101 @@ describe DiscourseApi::API::ApiKey do
10
10
  )
11
11
  }
12
12
 
13
- describe "#api" do
13
+ describe "#list_api_keys" do
14
14
  before do
15
- url = "#{host}/admin/api.json"
16
- stub_get(url).to_return(body: fixture("api.json"),
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.api
22
- url = "#{host}/admin/api.json"
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
- api = subject.api
28
- expect(api).to be_an Array
29
- expect(api.first).to be_a Hash
30
- expect(api.first).to have_key('key')
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 "#generate_master_key" do
34
+ describe "#create_api_key" do
35
35
  before do
36
- url = "#{host}/admin/api/key"
37
- stub_post(url).to_return(body: fixture("generate_master_key.json"),
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 "returns the generated master key" do
42
- master_key = subject.generate_master_key
43
- expect(master_key).to be_a Hash
44
- expect(master_key['api_key']).to have_key('key')
45
- expect(master_key['api_key']['user']).to eq(nil)
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/key?id=10"
52
- stub_delete(url).to_return(body: "",
53
- headers: { content_type: "application/json" })
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/key?id=10"
59
- expect(a_delete(url)).to have_been_made
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 200" do
63
- response = subject.revoke_api_key(10)
64
- expect(response['status']).to eq(200)
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 "#regenerate_api_key" do
73
+ describe "#undo_revoke_api_key" do
69
74
  before do
70
- url = "#{host}/admin/api/key"
71
- stub_put(url).to_return(body: fixture("regenerate_api_key.json"),
72
- headers: { content_type: "application/json" })
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.regenerate_api_key(10)
77
- url = "#{host}/admin/api/key"
78
- expect(a_put(url)).to have_been_made
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 regenerated api key" do
82
- key = subject.regenerate_api_key(10)
83
- expect(key['api_key']).to have_key('key')
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
@@ -10,7 +10,7 @@ describe DiscourseApi::API::Topics do
10
10
  end
11
11
 
12
12
  it "changes the topic status" do
13
- subject.change_topic_status(nil, 57, { status: 'visible', enabled: false })
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
@@ -148,4 +148,22 @@ describe DiscourseApi::API::Topics do
148
148
  expect(body['post_stream']['posts'].first).to be_a Hash
149
149
  end
150
150
  end
151
+
152
+ describe "#create_topic_with_tags" do
153
+ before do
154
+ stub_post("#{host}/posts").to_return(body: fixture("create_topic_with_tags.json"), headers: { content_type: "application/json" })
155
+ end
156
+
157
+ it "makes the post request" do
158
+ subject.create_topic title: "Sample Topic Title", raw: "Sample topic content body", tags: ["asdf", "fdsa"]
159
+ expect(a_post("#{host}/posts")).to have_been_made
160
+ end
161
+
162
+ it "returns success" do
163
+ response = subject.create_topic title: "Sample Topic Title", raw: "Sample topic content body", tags: ["asdf", "fdsa"]
164
+ expect(response).to be_a Hash
165
+ expect(response['topic_id']).to eq 21
166
+ end
167
+ end
168
+
151
169
  end
@@ -0,0 +1,12 @@
1
+ {
2
+ "key": {
3
+ "id": 5,
4
+ "key": "e722e04df8cf6d097d565ca04eea1ff8e9e8f09beb405bae6f0c79852916f334",
5
+ "user": {
6
+ "id": 2,
7
+ "username": "robin",
8
+ "uploaded_avatar_id": 3,
9
+ "avatar_template": "/user_avatar/localhost/robin/{size}/3.png"
10
+ }
11
+ }
12
+ }
@@ -0,0 +1,65 @@
1
+ {
2
+ "id": 29,
3
+ "name": null,
4
+ "username": "blake",
5
+ "avatar_template": "/user_avatar/localhost/blake/{size}/3_2.png",
6
+ "created_at": "2020-07-09T15:52:43.802Z",
7
+ "cooked": "<p>cb8ee24eb3c5a81139958cf2b6bee9bd 2a7f7ea218e24c9ee6528cd383527f99 5a3006b92918946230385393a83b6005</p>",
8
+ "post_number": 1,
9
+ "post_type": 1,
10
+ "updated_at": "2020-07-09T15:52:43.802Z",
11
+ "reply_count": 0,
12
+ "reply_to_post_number": null,
13
+ "quote_count": 0,
14
+ "incoming_link_count": 0,
15
+ "reads": 0,
16
+ "readers_count": 0,
17
+ "score": 0,
18
+ "yours": true,
19
+ "topic_id": 21,
20
+ "topic_slug": "1412a036bfe-6480718525e-9f71f98ef46",
21
+ "display_username": null,
22
+ "primary_group_name": null,
23
+ "primary_group_flair_url": null,
24
+ "primary_group_flair_bg_color": null,
25
+ "primary_group_flair_color": null,
26
+ "version": 1,
27
+ "can_edit": true,
28
+ "can_delete": false,
29
+ "can_recover": false,
30
+ "can_wiki": true,
31
+ "user_title": null,
32
+ "actions_summary": [
33
+ {
34
+ "id": 3,
35
+ "can_act": true
36
+ },
37
+ {
38
+ "id": 4,
39
+ "can_act": true
40
+ },
41
+ {
42
+ "id": 8,
43
+ "can_act": true
44
+ },
45
+ {
46
+ "id": 7,
47
+ "can_act": true
48
+ }
49
+ ],
50
+ "moderator": false,
51
+ "admin": true,
52
+ "staff": true,
53
+ "user_id": 1,
54
+ "draft_sequence": 0,
55
+ "hidden": false,
56
+ "trust_level": 1,
57
+ "deleted_at": null,
58
+ "user_deleted": false,
59
+ "edit_reason": null,
60
+ "can_view_edit_history": true,
61
+ "wiki": false,
62
+ "reviewable_id": null,
63
+ "reviewable_score_count": 0,
64
+ "reviewable_score_pending_count": 0
65
+ }
@@ -0,0 +1,14 @@
1
+ {
2
+ "keys": [
3
+ {
4
+ "id": 1,
5
+ "key": "test_d7fd0429940",
6
+ "user": {
7
+ "id": 1,
8
+ "username": "test_user",
9
+ "uploaded_avatar_id": 7,
10
+ "avatar_template": "/user_avatar/localhost/test_user/{size}/7.png"
11
+ }
12
+ }
13
+ ]
14
+ }
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.41.0
4
+ version: 0.45.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: 2020-06-17 00:00:00.000000000 Z
14
+ date: 2021-01-15 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: faraday
@@ -159,14 +159,14 @@ dependencies:
159
159
  requirements:
160
160
  - - "~>"
161
161
  - !ruby/object:Gem::Version
162
- version: '2.0'
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: '2.0'
169
+ version: '3.0'
170
170
  - !ruby/object:Gem::Dependency
171
171
  name: rubocop-discourse
172
172
  requirement: !ruby/object:Gem::Requirement
@@ -216,6 +216,7 @@ 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
219
220
  - examples/polls.rb
220
221
  - examples/post_action.rb
221
222
  - examples/search.rb
@@ -271,19 +272,20 @@ files:
271
272
  - spec/discourse_api/api/users_spec.rb
272
273
  - spec/discourse_api/client_spec.rb
273
274
  - spec/fixtures/admin_user.json
274
- - spec/fixtures/api.json
275
+ - spec/fixtures/api_key.json
275
276
  - spec/fixtures/backups.json
276
277
  - spec/fixtures/badges.json
277
278
  - spec/fixtures/categories.json
278
279
  - spec/fixtures/category_latest_topics.json
279
280
  - spec/fixtures/category_topics.json
281
+ - spec/fixtures/create_topic_with_tags.json
280
282
  - spec/fixtures/email_list_all.json
281
283
  - spec/fixtures/email_settings.json
282
- - spec/fixtures/generate_master_key.json
283
284
  - spec/fixtures/group.json
284
285
  - spec/fixtures/groups.json
285
286
  - spec/fixtures/hot.json
286
287
  - spec/fixtures/latest.json
288
+ - spec/fixtures/list_api_keys.json
287
289
  - spec/fixtures/members_0.json
288
290
  - spec/fixtures/members_1.json
289
291
  - spec/fixtures/members_2.json
@@ -332,7 +334,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
332
334
  requirements:
333
335
  - - ">="
334
336
  - !ruby/object:Gem::Version
335
- version: 2.2.3
337
+ version: 2.5.0
336
338
  required_rubygems_version: !ruby/object:Gem::Requirement
337
339
  requirements:
338
340
  - - ">="
@@ -364,19 +366,20 @@ test_files:
364
366
  - spec/discourse_api/api/users_spec.rb
365
367
  - spec/discourse_api/client_spec.rb
366
368
  - spec/fixtures/admin_user.json
367
- - spec/fixtures/api.json
369
+ - spec/fixtures/api_key.json
368
370
  - spec/fixtures/backups.json
369
371
  - spec/fixtures/badges.json
370
372
  - spec/fixtures/categories.json
371
373
  - spec/fixtures/category_latest_topics.json
372
374
  - spec/fixtures/category_topics.json
375
+ - spec/fixtures/create_topic_with_tags.json
373
376
  - spec/fixtures/email_list_all.json
374
377
  - spec/fixtures/email_settings.json
375
- - spec/fixtures/generate_master_key.json
376
378
  - spec/fixtures/group.json
377
379
  - spec/fixtures/groups.json
378
380
  - spec/fixtures/hot.json
379
381
  - spec/fixtures/latest.json
382
+ - spec/fixtures/list_api_keys.json
380
383
  - spec/fixtures/members_0.json
381
384
  - spec/fixtures/members_1.json
382
385
  - spec/fixtures/members_2.json
@@ -1,12 +0,0 @@
1
- [
2
- {
3
- "id": 1,
4
- "key": "test_d7fd0429940",
5
- "user": {
6
- "id": 1,
7
- "username": "test_user",
8
- "uploaded_avatar_id": 7,
9
- "avatar_template": "/user_avatar/localhost/test_user/{size}/7.png"
10
- }
11
- }
12
- ]
@@ -1,7 +0,0 @@
1
- {
2
- "api_key": {
3
- "id": 10,
4
- "key": "c999afe41d3a6ed0798a13ef69f90c4cc7d38120818c4a098e402bc5e5ef2085",
5
- "user": null
6
- }
7
- }