discourse_api 0.41.0 → 0.42.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 +4 -0
- data/examples/create_topic.rb +10 -0
- data/lib/discourse_api/api/topics.rb +1 -1
- data/lib/discourse_api/version.rb +1 -1
- data/spec/discourse_api/api/topics_spec.rb +18 -0
- data/spec/fixtures/create_topic_with_tags.json +65 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ea694de473b398c706c2b61333e05663dcb69423178a6bcb25c2f6b1ac4abde
|
4
|
+
data.tar.gz: 85fb225fd5d9ab4aa407510a437b7b92a55f4c117b480cecbfb026c0f0b3750f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fbdd42c087c47c52ea91ba75d70fba75989ee6242a914f1147755d851d2645403c5f153cefbd60f04073cf34bc94e1e2fb01247204bce128538fe5b485b0b332
|
7
|
+
data.tar.gz: 43cf32bef0aba4d313c2d198e04be5531cc9e52bb5473ff6e6dbbfe6406090fa121c18b681e45847f4624031e0c7e004bb62443cb79a03e3fe972703b9d73410
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,10 @@
|
|
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.42.0] - 2020-07-09
|
6
|
+
### Added
|
7
|
+
- Create topics with tags
|
8
|
+
|
5
9
|
## [0.41.0] - 2020-06-17
|
6
10
|
### Added
|
7
11
|
- Add basic auth support
|
data/examples/create_topic.rb
CHANGED
@@ -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
|
+
)
|
@@ -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
|
|
@@ -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,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
|
+
}
|
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.42.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-
|
14
|
+
date: 2020-07-09 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: faraday
|
@@ -277,6 +277,7 @@ files:
|
|
277
277
|
- spec/fixtures/categories.json
|
278
278
|
- spec/fixtures/category_latest_topics.json
|
279
279
|
- spec/fixtures/category_topics.json
|
280
|
+
- spec/fixtures/create_topic_with_tags.json
|
280
281
|
- spec/fixtures/email_list_all.json
|
281
282
|
- spec/fixtures/email_settings.json
|
282
283
|
- spec/fixtures/generate_master_key.json
|
@@ -370,6 +371,7 @@ test_files:
|
|
370
371
|
- spec/fixtures/categories.json
|
371
372
|
- spec/fixtures/category_latest_topics.json
|
372
373
|
- spec/fixtures/category_topics.json
|
374
|
+
- spec/fixtures/create_topic_with_tags.json
|
373
375
|
- spec/fixtures/email_list_all.json
|
374
376
|
- spec/fixtures/email_settings.json
|
375
377
|
- spec/fixtures/generate_master_key.json
|