discourse_api 0.43.0 → 0.46.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,6 +28,21 @@ describe DiscourseApi::Client do
28
28
  end
29
29
  end
30
30
 
31
+ describe "#timeout" do
32
+ context 'custom timeout' do
33
+ it "is set to Faraday connection" do
34
+ expect(subject.send(:connection).options.timeout).to eq(30)
35
+ end
36
+ end
37
+
38
+ context 'default timeout' do
39
+ it "is set to Faraday connection" do
40
+ subject.timeout = 25
41
+ expect(subject.send(:connection).options.timeout).to eq(25)
42
+ end
43
+ end
44
+ end
45
+
31
46
  describe "#api_key" do
32
47
  it "is publically accessible" do
33
48
  subject.api_key = "test_d7fd0429940"
@@ -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,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
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "success": "OK"
3
+ }
@@ -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
+ }
@@ -34,6 +34,7 @@
34
34
  "read":true,
35
35
  "user_title":null,
36
36
  "actions_summary":[{"id":2,"count":3,"can_act":true}],
37
+ "raw": [{"type":"paragraph","children":[{"text":"This is a raw post I've got white space!... and emojis 😈😈😈😈😈😈"}]}],
37
38
  "moderator":false,
38
39
  "admin":false,
39
40
  "staff":false,
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.43.0
4
+ version: 0.46.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-11-04 00:00:00.000000000 Z
14
+ date: 2021-04-12 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: '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
173
173
  requirements:
174
- - - ">="
174
+ - - "~>"
175
175
  - !ruby/object:Gem::Version
176
- version: '0'
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: '0'
183
+ version: 2.4.1
184
184
  description: Discourse API
185
185
  email:
186
186
  - sam.saffron@gmail.com
@@ -204,6 +204,7 @@ files:
204
204
  - discourse_api.gemspec
205
205
  - examples/backups.rb
206
206
  - examples/badges.rb
207
+ - examples/bookmark_topic.rb
207
208
  - examples/category.rb
208
209
  - examples/change_topic_status.rb
209
210
  - examples/create_private_message.rb
@@ -216,6 +217,8 @@ files:
216
217
  - examples/group_set_user_notification_level.rb
217
218
  - examples/groups.rb
218
219
  - examples/invite_users.rb
220
+ - examples/manage_api_keys.rb
221
+ - examples/notifications.rb
219
222
  - examples/polls.rb
220
223
  - examples/post_action.rb
221
224
  - examples/search.rb
@@ -271,7 +274,7 @@ files:
271
274
  - spec/discourse_api/api/users_spec.rb
272
275
  - spec/discourse_api/client_spec.rb
273
276
  - spec/fixtures/admin_user.json
274
- - spec/fixtures/api.json
277
+ - spec/fixtures/api_key.json
275
278
  - spec/fixtures/backups.json
276
279
  - spec/fixtures/badges.json
277
280
  - spec/fixtures/categories.json
@@ -280,15 +283,16 @@ files:
280
283
  - spec/fixtures/create_topic_with_tags.json
281
284
  - spec/fixtures/email_list_all.json
282
285
  - spec/fixtures/email_settings.json
283
- - spec/fixtures/generate_master_key.json
284
286
  - spec/fixtures/group.json
285
287
  - spec/fixtures/groups.json
286
288
  - spec/fixtures/hot.json
287
289
  - spec/fixtures/latest.json
290
+ - spec/fixtures/list_api_keys.json
288
291
  - spec/fixtures/members_0.json
289
292
  - spec/fixtures/members_1.json
290
293
  - spec/fixtures/members_2.json
291
294
  - spec/fixtures/new.json
295
+ - spec/fixtures/notification_success.json
292
296
  - spec/fixtures/notifications.json
293
297
  - spec/fixtures/polls_toggle_status.json
294
298
  - spec/fixtures/polls_vote.json
@@ -302,6 +306,7 @@ files:
302
306
  - spec/fixtures/replies.json
303
307
  - spec/fixtures/replies_and_topics.json
304
308
  - spec/fixtures/search.json
309
+ - spec/fixtures/top.json
305
310
  - spec/fixtures/topic.json
306
311
  - spec/fixtures/topic_invite_user.json
307
312
  - spec/fixtures/topic_posts.json
@@ -333,14 +338,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
333
338
  requirements:
334
339
  - - ">="
335
340
  - !ruby/object:Gem::Version
336
- version: 2.2.3
341
+ version: 2.5.0
337
342
  required_rubygems_version: !ruby/object:Gem::Requirement
338
343
  requirements:
339
344
  - - ">="
340
345
  - !ruby/object:Gem::Version
341
346
  version: '0'
342
347
  requirements: []
343
- rubygems_version: 3.0.3
348
+ rubygems_version: 3.1.6
344
349
  signing_key:
345
350
  specification_version: 4
346
351
  summary: Allows access to the Discourse API
@@ -365,7 +370,7 @@ test_files:
365
370
  - spec/discourse_api/api/users_spec.rb
366
371
  - spec/discourse_api/client_spec.rb
367
372
  - spec/fixtures/admin_user.json
368
- - spec/fixtures/api.json
373
+ - spec/fixtures/api_key.json
369
374
  - spec/fixtures/backups.json
370
375
  - spec/fixtures/badges.json
371
376
  - spec/fixtures/categories.json
@@ -374,15 +379,16 @@ test_files:
374
379
  - spec/fixtures/create_topic_with_tags.json
375
380
  - spec/fixtures/email_list_all.json
376
381
  - spec/fixtures/email_settings.json
377
- - spec/fixtures/generate_master_key.json
378
382
  - spec/fixtures/group.json
379
383
  - spec/fixtures/groups.json
380
384
  - spec/fixtures/hot.json
381
385
  - spec/fixtures/latest.json
386
+ - spec/fixtures/list_api_keys.json
382
387
  - spec/fixtures/members_0.json
383
388
  - spec/fixtures/members_1.json
384
389
  - spec/fixtures/members_2.json
385
390
  - spec/fixtures/new.json
391
+ - spec/fixtures/notification_success.json
386
392
  - spec/fixtures/notifications.json
387
393
  - spec/fixtures/polls_toggle_status.json
388
394
  - spec/fixtures/polls_vote.json
@@ -396,6 +402,7 @@ test_files:
396
402
  - spec/fixtures/replies.json
397
403
  - spec/fixtures/replies_and_topics.json
398
404
  - spec/fixtures/search.json
405
+ - spec/fixtures/top.json
399
406
  - spec/fixtures/topic.json
400
407
  - spec/fixtures/topic_invite_user.json
401
408
  - spec/fixtures/topic_posts.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
- }