discourse_api 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +11 -0
  3. data/examples/invite_users.rb +3 -0
  4. data/examples/sso.rb +14 -0
  5. data/examples/topic_lists.rb +4 -0
  6. data/lib/discourse_api/api/categories.rb +1 -1
  7. data/lib/discourse_api/api/invite.rb +4 -0
  8. data/lib/discourse_api/api/notifications.rb +10 -0
  9. data/lib/discourse_api/api/private_messages.rb +10 -0
  10. data/lib/discourse_api/api/sso.rb +17 -0
  11. data/lib/discourse_api/api/topics.rb +12 -0
  12. data/lib/discourse_api/api/users.rb +3 -3
  13. data/lib/discourse_api/client.rb +6 -0
  14. data/lib/discourse_api/version.rb +1 -1
  15. data/lib/single_sign_on.rb +98 -0
  16. data/spec/discourse_api/api/categories_spec.rb +2 -8
  17. data/spec/discourse_api/api/notifications_spec.rb +24 -0
  18. data/spec/discourse_api/api/private_messages_spec.rb +22 -0
  19. data/spec/discourse_api/api/search_spec.rb +1 -5
  20. data/spec/discourse_api/api/topics_spec.rb +30 -17
  21. data/spec/discourse_api/api/users_spec.rb +48 -12
  22. data/spec/discourse_api/client_spec.rb +4 -0
  23. data/spec/fixtures/categories.json +72 -1
  24. data/spec/fixtures/category_latest_topics.json +92 -1
  25. data/spec/fixtures/hot.json +113 -1
  26. data/spec/fixtures/latest.json +115 -1
  27. data/spec/fixtures/new.json +113 -1
  28. data/spec/fixtures/notifications.json +16 -0
  29. data/spec/fixtures/private_messages.json +69 -0
  30. data/spec/fixtures/search.json +24 -1
  31. data/spec/fixtures/topic.json +739 -1
  32. data/spec/fixtures/topic_invite_user.json +3 -0
  33. data/spec/fixtures/topics_created_by.json +49 -1
  34. data/spec/fixtures/user.json +65 -1
  35. data/spec/fixtures/user_update_user.json +3 -0
  36. data/spec/fixtures/user_update_username.json +3 -0
  37. metadata +21 -2
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe DiscourseApi::API::Users do
4
- subject { DiscourseApi::Client.new("http://localhost:3000") }
4
+ subject { DiscourseApi::Client.new("http://localhost:3000", "test_d7fd0429940", "test_user") }
5
5
 
6
6
  describe "#user" do
7
7
  before do
@@ -9,15 +9,11 @@ describe DiscourseApi::API::Users do
9
9
  end
10
10
 
11
11
  it "requests the correct resource" do
12
- subject.api_key = 'test_d7fd0429940'
13
- subject.api_username = 'test_user'
14
12
  subject.user("test")
15
13
  expect(a_get("http://localhost:3000/users/test.json?api_key=test_d7fd0429940&api_username=test_user")).to have_been_made
16
14
  end
17
15
 
18
16
  it "returns the requested user" do
19
- subject.api_key = 'test_d7fd0429940'
20
- subject.api_username = 'test_user'
21
17
  user = subject.user("test")
22
18
  expect(user).to be_a Hash
23
19
  end
@@ -28,15 +24,59 @@ describe DiscourseApi::API::Users do
28
24
  end
29
25
 
30
26
  describe "#update_email" do
31
- it "needs to have a test written for it"
27
+ before do
28
+ stub_put("http://localhost:3000/users/fake_user/preferences/email?api_key=test_d7fd0429940&api_username=test_user").to_return(body: fixture("user_update_user.json"), headers: { content_type: "application/json" })
29
+ end
30
+
31
+ it "makes the put request" do
32
+ subject.update_email("fake_user", "fake_user_2@example.com")
33
+ expect(a_put("http://localhost:3000/users/fake_user/preferences/email?api_key=test_d7fd0429940&api_username=test_user")).to have_been_made
34
+ end
35
+
36
+ it "returns success" do
37
+ response = subject.update_email("fake_user", "fake_user_2@example.com")
38
+ expect(response[:body]['success']).to be_truthy
39
+ end
32
40
  end
33
41
 
34
42
  describe "#update_user" do
35
- it "needs to have a test written for it"
43
+ before do
44
+ stub_put("http://localhost:3000/users/fake_user?api_key=test_d7fd0429940&api_username=test_user").to_return(body: fixture("user_update_user.json"), headers: { content_type: "application/json" })
45
+ end
46
+
47
+ it "makes the put request" do
48
+ subject.api_key = 'test_d7fd0429940'
49
+ subject.api_username = 'test_user'
50
+ subject.update_user("fake_user", name: "Fake User 2")
51
+ expect(a_put("http://localhost:3000/users/fake_user?api_key=test_d7fd0429940&api_username=test_user")).to have_been_made
52
+ end
53
+
54
+ it "returns success" do
55
+ subject.api_key = 'test_d7fd0429940'
56
+ subject.api_username = 'test_user'
57
+ response = subject.update_user("fake_user", name: "Fake User 2")
58
+ expect(response[:body]['success']).to be_truthy
59
+ end
36
60
  end
37
61
 
38
62
  describe "#update_username" do
39
- it "needs to have a test written for it"
63
+ before do
64
+ stub_put("http://localhost:3000/users/fake_user/preferences/username?api_key=test_d7fd0429940&api_username=test_user").to_return(body: fixture("user_update_username.json"), headers: { content_type: "application/json" })
65
+ end
66
+
67
+ it "makes the put request" do
68
+ subject.api_key = 'test_d7fd0429940'
69
+ subject.api_username = 'test_user'
70
+ subject.update_username("fake_user", "fake_user_2")
71
+ expect(a_put("http://localhost:3000/users/fake_user/preferences/username?api_key=test_d7fd0429940&api_username=test_user")).to have_been_made
72
+ end
73
+
74
+ it "returns success" do
75
+ subject.api_key = 'test_d7fd0429940'
76
+ subject.api_username = 'test_user'
77
+ response = subject.update_username("fake_user", "fake_user_2")
78
+ expect(response[:body]['success']).to be_truthy
79
+ end
40
80
  end
41
81
 
42
82
  describe "#create_user" do
@@ -46,15 +86,11 @@ describe DiscourseApi::API::Users do
46
86
  end
47
87
 
48
88
  it "makes the post request" do
49
- subject.api_key = 'test_d7fd0429940'
50
- subject.api_username = 'test_user'
51
89
  subject.create_user :name => "Test User", :email => "test2@example.com", :password => "P@ssword", :username => "test2"
52
90
  expect(a_post("http://localhost:3000/users?api_key=test_d7fd0429940&api_username=test_user")).to have_been_made
53
91
  end
54
92
 
55
93
  it "returns success" do
56
- subject.api_key = 'test_d7fd0429940'
57
- subject.api_username = 'test_user'
58
94
  response = subject.create_user :name => "Test User", :email => "test2@example.com", :password => "P@ssword", :username => "test2"
59
95
  expect(response[:body]['success']).to be_truthy
60
96
  end
@@ -55,6 +55,7 @@ describe DiscourseApi::Client do
55
55
  it "looks like a Faraday connection" do
56
56
  expect(subject.send(:connection)).to respond_to :run_request
57
57
  end
58
+
58
59
  it "memorizes the connection" do
59
60
  c1, c2 = subject.send(:connection), subject.send(:connection)
60
61
  expect(c1.object_id).to eq(c2.object_id)
@@ -65,6 +66,7 @@ describe DiscourseApi::Client do
65
66
  before do
66
67
  stub_delete("http://localhost:3000/test/delete?api_key=test_d7fd0429940&api_username=test_user").with(query: { deleted: "object" })
67
68
  end
69
+
68
70
  it "allows custom delete requests" do
69
71
  subject.api_key = 'test_d7fd0429940'
70
72
  subject.api_username = 'test_user'
@@ -90,6 +92,7 @@ describe DiscourseApi::Client do
90
92
  before do
91
93
  stub_put("http://localhost:3000/test/put?api_key=test_d7fd0429940&api_username=test_user").with(body: { updated: "object" })
92
94
  end
95
+
93
96
  it "allows custom put requests" do
94
97
  subject.api_key = 'test_d7fd0429940'
95
98
  subject.api_username = 'test_user'
@@ -103,6 +106,7 @@ describe DiscourseApi::Client do
103
106
  allow(subject).to receive(:connection).and_raise(Faraday::Error::ClientError.new("BOOM!"))
104
107
  expect{subject.send(:request, :get, "/test")}.to raise_error DiscourseApi::Error
105
108
  end
109
+
106
110
  it "catches JSON::ParserError errors" do
107
111
  allow(subject).to receive(:connection).and_raise(JSON::ParserError.new("unexpected token"))
108
112
  expect{subject.send(:request, :get, "/test")}.to raise_error DiscourseApi::Error
@@ -1 +1,72 @@
1
- {"featured_users":[],"category_list":{"can_create_category":false,"can_create_topic":false,"draft":null,"draft_key":"new_topic","draft_sequence":null,"categories":[{"id":1,"name":"test1","color":"0000FF","text_color":"FFFFFF","slug":"test1","topic_count":0,"description":"Test category #1.","topic_url":"\/t\/category-definition-for-test1\/1","hotness":5.0,"read_restricted":false,"permission":null,"post_count":0,"topics_week":0,"topics_month":0,"topics_year":0,"description_excerpt":"Test category #1.","featured_user_ids":[],"topics":[]},{"id":2,"name":"test2","color":"00FF00","text_color":"FFFFFF","slug":"test2","topic_count":0,"description":"Test category #2.","topic_url":"\/t\/category-definition-for-test2\/2","hotness":5.0,"read_restricted":false,"permission":null,"post_count":0,"topics_week":0,"topics_month":0,"topics_year":0,"description_excerpt":"Test category #2.","featured_user_ids":[],"topics":[]},{"id":3,"name":"test3","color":"FF0000","text_color":"FFFFFF","slug":"test3","topic_count":0,"description":"Test category #3.","topic_url":"\/t\/category-definition-for-test3\/3","hotness":5.0,"read_restricted":false,"permission":null,"post_count":0,"topics_week":0,"topics_month":0,"topics_year":0,"description_excerpt":"Test category #3.","featured_user_ids":[],"topics":[]}]}}
1
+ {
2
+ "featured_users": [],
3
+ "category_list": {
4
+ "can_create_category": false,
5
+ "can_create_topic": false,
6
+ "draft": null,
7
+ "draft_key": "new_topic",
8
+ "draft_sequence": null,
9
+ "categories": [
10
+ {
11
+ "id": 1,
12
+ "n ame": "test1",
13
+ "color": "0000FF",
14
+ "text_color": "FFFFFF",
15
+ "slug": "test1",
16
+ "topic_count": 0,
17
+ "description": "Test category #1.",
18
+ "topic_url": "/t/category-definition-for-test1/1",
19
+ "hotness": 5,
20
+ "read_restricted": false,
21
+ "permission": null,
22
+ "post_count": 0,
23
+ "topics_week": 0,
24
+ "topics_month": 0,
25
+ "topics_year": 0,
26
+ "description_excerpt": "Test category #1.",
27
+ "featured_user_id s": [],
28
+ "topics": []
29
+ },
30
+ {
31
+ "id": 2,
32
+ "name": "test2",
33
+ "color": "00FF00",
34
+ "text_color": "FFFFFF",
35
+ "slug": "test2",
36
+ "topic_count": 0,
37
+ "description": "Test category #2.",
38
+ "topic_url": "/t/category-definition-for-test2/2",
39
+ "hotness": 5,
40
+ "read_restricted": false,
41
+ "permission": null,
42
+ "post_count": 0,
43
+ "topics_week": 0,
44
+ "topics_month": 0,
45
+ "topics_year": 0,
46
+ "description_excerpt": "Test category #2.",
47
+ "featured_user_ids": [],
48
+ "topics": []
49
+ },
50
+ {
51
+ "id": 3,
52
+ "name": "test3",
53
+ "color": "FF0000",
54
+ "text_color": "FFFFFF",
55
+ "slug": "test3",
56
+ "topic_count": 0,
57
+ "description": "Test category #3.",
58
+ "topic_url": "/t/category-definition-for-test3/3",
59
+ "hotness": 5,
60
+ "read_restricted": false,
61
+ "permission": null,
62
+ "post_count": 0,
63
+ "topics_week": 0,
64
+ "topics_month": 0,
65
+ "topics_year": 0,
66
+ "description_excerpt": "Test category #3.",
67
+ "featured_user_ids": [],
68
+ "topics": []
69
+ }
70
+ ]
71
+ }
72
+ }
@@ -1 +1,92 @@
1
- {"users":[{"id":3,"username":"fuzzy","avatar_template":"//www.gravatar.com/avatar/c0c59575e86a794d733db4ee29b2baf4.png?s={size}&r=pg&d=identicon"}],"topic_list":{"can_create_topic":true,"draft":null,"draft_key":"new_topic","draft_sequence":2,"topics":[{"id":5,"title":"About the category","fancy_title":"About the category","slug":"about-the-category","posts_count":2,"reply_count":0,"highest_post_number":2,"image_url":null,"created_at":"2014-04-16T14:10:50.950-04:00","last_posted_at":"2014-04-16T14:31:10.406-04:00","bumped":true,"bumped_at":"2014-04-17T13:35:01.102-04:00","unseen":false,"last_read_post_number":2,"unread":0,"new_posts":0,"pinned":true,"unpinned":null,"excerpt":null,"visible":true,"closed":false,"archived":false,"views":0,"like_count":0,"starred":false,"has_summary":false,"archetype":"regular","last_poster_username":"fuzzy","category_id":2,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":3}]},{"id":4,"title":"This is a markdown post","fancy_title":"This is a markdown post","slug":"this-is-a-markdown-post","posts_count":2,"reply_count":0,"highest_post_number":2,"image_url":null,"created_at":"2014-04-16T13:52:58.777-04:00","last_posted_at":"2014-04-16T14:31:37.371-04:00","bumped":true,"bumped_at":"2014-04-16T14:31:37.371-04:00","unseen":false,"last_read_post_number":2,"unread":0,"new_posts":0,"pinned":false,"unpinned":null,"visible":true,"closed":false,"archived":false,"views":0,"like_count":0,"starred":false,"has_summary":false,"archetype":"regular","last_poster_username":"fuzzy","category_id":2,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":3}]}]}}
1
+ {
2
+ "users": [
3
+ {
4
+ "id": 3,
5
+ "username": "fuzzy",
6
+ "avatar_template": "//www.gravatar.com/avatar/c0c59575e86a794d733db4ee29b2baf4.png?s={size}&r=pg&d=identicon"
7
+ }
8
+ ],
9
+ "topic_list": {
10
+ "can_create_topic": true,
11
+ "draft": null,
12
+ "draft_key": "new_topic",
13
+ "draft_sequence": 2,
14
+ "topics": [
15
+ {
16
+ "id": 5,
17
+ "title": "About the category",
18
+ "fancy_title": "About the category",
19
+ "slug": "about-the-category",
20
+ "posts_count": 2,
21
+ "reply_count": 0,
22
+ "highest_post_number": 2,
23
+ "image_url": null,
24
+ "created_at": "2014-04-16T14:10:50.950-04:00",
25
+ "last_posted_at": "2014-04-16T14:31:10.406-04:00",
26
+ "bumped": true,
27
+ "bumped_at": "2014-04-17T13:35:01.102-04:00",
28
+ "unseen": false,
29
+ "last_read_post_number": 2,
30
+ "unread": 0,
31
+ "new_posts": 0,
32
+ "pinned": true,
33
+ "unpinned": null,
34
+ "excerpt": null,
35
+ "visible ": true,
36
+ "closed": false,
37
+ "archived": false,
38
+ "views": 0,
39
+ "like_count": 0,
40
+ "starred": false,
41
+ "has_summary": false,
42
+ "archetype": "regular",
43
+ "last_poster_username": "fuzzy",
44
+ "category_id": 2,
45
+ "posters": [
46
+ {
47
+ "extras": "latest",
48
+ "description": "Original Poster, Most Recent Poster",
49
+ "user_id": 3
50
+ }
51
+ ]
52
+ },
53
+ {
54
+ "id": 4,
55
+ "title": "This is a markdown post",
56
+ "fancy_title": "This is a markdown post",
57
+ "slug": "this-is-a-markdown-post",
58
+ "posts_count": 2,
59
+ "reply_count": 0,
60
+ "highest_post_number": 2,
61
+ "image_url": null,
62
+ "created_at": "2014-04-16T13:52:58.777-04:00",
63
+ "last_posted_at": "2014-04-16T14:31:37.371-04:00",
64
+ "bumped": true,
65
+ "bumped_at": "2014-04-16T14:31:37.371-04:00",
66
+ "unseen": false,
67
+ "last_read_post_number": 2,
68
+ "unread": 0,
69
+ "new_posts": 0,
70
+ "pinned": false,
71
+ "unpinned ": null,
72
+ "visible": true,
73
+ "closed": false,
74
+ "archived": false,
75
+ "views": 0,
76
+ "like_count": 0,
77
+ "starred": false,
78
+ "has_summary": false,
79
+ "archetype": "regular",
80
+ "last_poster_username": "fuzzy",
81
+ "category_id": 2,
82
+ "posters": [
83
+ {
84
+ "extras": "latest",
85
+ "description": "Original Poster, Most Recent Poster",
86
+ "user_id": 3
87
+ }
88
+ ]
89
+ }
90
+ ]
91
+ }
92
+ }
@@ -1 +1,113 @@
1
- {"users":[{"id":1,"username":"test_users","avatar_template":"//www.gravatar.com/avatar/test.png?s={size}&r=pg&d=identicon"}],"topic_list":{"can_create_topic":false,"draft":null,"draft_key":"new_topic","draft_sequence":null,"topics":[{"id":1,"title":"Test topic #1","fancy_title":"Test topic #1","slug":"test-topic-1","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2013-02-04T14:38:46.480-05:00","last_posted_at":"2013-09-13T16:46:59.783-04:00","bumped":true,"bumped_at":"2013-09-13T16:46:59.783-04:00","unseen":false,"pinned":false,"visible":true,"closed":false,"archived":false,"views":1,"like_count":0,"has_best_of":false,"archetype":"regular","last_poster_username":"test_user","category_id":1,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":1}]},{"id":2,"title":"Test topic #2","fancy_title":"Test topic #2","slug":"test-topic-2","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2013-02-04T14:38:46.480-05:00","last_posted_at":"2013-09-13T16:46:59.783-04:00","bumped":true,"bumped_at":"2013-09-13T16:46:59.783-04:00","unseen":false,"pinned":false,"visible":true,"closed":false,"archived":false,"views":1,"like_count":0,"has_best_of":false,"archetype":"regular","last_poster_username":"test_user","category_id":1,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":1}]},{"id":3,"title":"Test topic #3","fancy_title":"Test topic #3","slug":"test-topic-3","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2013-02-04T14:38:46.480-05:00","last_posted_at":"2013-09-13T16:46:59.783-04:00","bumped":true,"bumped_at":"2013-09-13T16:46:59.783-04:00","unseen":false,"pinned":false,"visible":true,"closed":false,"archived":false,"views":1,"like_count":0,"has_best_of":false,"archetype":"regular","last_poster_username":"test_user","category_id":1,"posters":[{"extras":"latest","description":"Original Poster, Most Recent Poster","user_id":1}]}]}}
1
+ {
2
+ "users": [
3
+ {
4
+ "id": 1,
5
+ "username": "test_users",
6
+ "avatar_template": "//www.gravatar.com/avatar/test.png?s={size}&r=pg&d=identicon"
7
+ }
8
+ ],
9
+ "topic_list": {
10
+ "can_create_topic": false,
11
+ "draft": null,
12
+ "draft_key": "new_topic",
13
+ "draft_sequence": null,
14
+ "topics": [
15
+ {
16
+ "id": 1,
17
+ "title": "Test topic #1",
18
+ "fancy_title": "Test topic #1",
19
+ "slug": "test-topic-1",
20
+ "posts_count": 1,
21
+ "reply_count": 0,
22
+ "highest_post_number": 1,
23
+ "image_url": null,
24
+ "created_at": "2013-02-04T14:38:46.480-05:00",
25
+ "last_posted_at": "2013-09-13T16:46:59.783-04:00",
26
+ "bumped": true,
27
+ "bumped_at": "2013-09-13T16:46:59.783-04:00",
28
+ "unseen": false,
29
+ "pinned": false,
30
+ "visible": true,
31
+ "closed": false,
32
+ "archived": false,
33
+ "views": 1,
34
+ "like_count": 0,
35
+ "has_best_of": false,
36
+ "archetype": "regular",
37
+ "last_poster_username": "test_user",
38
+ "category_id": 1,
39
+ "posters": [
40
+ {
41
+ "extras": "latest",
42
+ "description": "Original Poster, Most Recent Poster",
43
+ "user_id": 1
44
+ }
45
+ ]
46
+ },
47
+ {
48
+ "id": 2,
49
+ "title": "Test topic #2",
50
+ "fancy_title": "Test topic #2",
51
+ "slug": "test-topic-2",
52
+ "posts_count": 1,
53
+ "reply_count": 0,
54
+ "highest_post_number": 1,
55
+ "image_url": null,
56
+ "created_at": "2013-02-04T14:38:46.480-05:00",
57
+ "last_posted_at": "2013-09-13T16:46:59.783-04:00",
58
+ "bumped": true,
59
+ "bumped_at": "2013-09-13T16:46:59.783-04:00",
60
+ "unseen": false,
61
+ "pinned": false,
62
+ "visible": true,
63
+ "closed": false,
64
+ "archived": false,
65
+ "views": 1,
66
+ "like_count": 0,
67
+ "has_best_of": false,
68
+ "archetype": "regular",
69
+ "last_poster_username": "test_user",
70
+ "category_id": 1,
71
+ "posters": [
72
+ {
73
+ "extras": "latest",
74
+ "description": "Original Poster, Most Recent Poster",
75
+ "user_id": 1
76
+ }
77
+ ]
78
+ },
79
+ {
80
+ "id": 3,
81
+ "title": "Test topic #3",
82
+ "fancy_title": "Test topic #3",
83
+ "slug": "test-topic-3",
84
+ "posts_count": 1,
85
+ "reply_count": 0,
86
+ "highest_post_number": 1,
87
+ "image_url": null,
88
+ "created_at": "2013-02-04T14:38:46.480-05:00",
89
+ "last_posted_at": "2013-09-13T16:46:59.783-04:00",
90
+ "bumped": true,
91
+ "bumped_at": "2013-09-13T16:46:59.783-04:00",
92
+ "unseen": false,
93
+ "pinned": false,
94
+ "visible": true,
95
+ "closed": false,
96
+ "archived": false,
97
+ "views": 1,
98
+ "like_count": 0,
99
+ "has_best_of": false,
100
+ "archetype": "regular",
101
+ "last_poster_username": "test_user",
102
+ "category_id": 1,
103
+ "posters": [
104
+ {
105
+ "extras": "latest",
106
+ "description": "Original Poster, Most Recent Poster",
107
+ "user_id": 1
108
+ }
109
+ ]
110
+ }
111
+ ]
112
+ }
113
+ }
@@ -1 +1,115 @@
1
- {"users":[{"id":1,"username":"test_users","avatar_template":"//www.gravatar.com/avatar/test.png?s={size}&r=pg&d=identicon"}],"topic_list":{"can_create_topic":false,"more_topics_url":"/latest.json?page=1","draft":null,"draft_key":"new_topic","draft_sequence":null,"topics":[{"id":1,"title":"Test topic #1","fancy_title":"Test topic #1","slug":"test-topic-1","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2013-02-04T15:26:25.977-05:00","last_posted_at":"2013-02-05T12:14:17.364-05:00","bumped":true,"bumped_at":"2013-02-07T13:43:11.191-05:00","unseen":false,"pinned":true,"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…","visible":true,"closed":false,"archived":false,"views":268,"like_count":14,"has_best_of":false,"archetype":"regular","last_poster_username":"test_user","category_id":1,"posters":[{"extras":null,"description":"Original Poster, Most Recent Poster","user_id":1}]},{"id":1,"title":"Test topic #2","fancy_title":"Test topic #2","slug":"test-topic-1","posts_count":1,"reply_count":0,"highest_post_number":2,"image_url":null,"created_at":"2013-11-06T13:57:47.984-05:00","last_posted_at":"2013-11-06T13:57:48.111-05:00","bumped":true,"bumped_at":"2013-11-06T13:57:48.111-05:00","unseen":false,"pinned":false,"visible":true,"closed":false,"archived":false,"views":1,"like_count":0,"has_best_of":false,"archetype":"regular","last_poster_username":"test_user","category_id":1,"posters":[{"extras":null,"description":"Original Poster, Most Recent Poster","user_id":1}]},{"id":1,"title":"Test topic #3","fancy_title":"Test topic #3","slug":"test-topic-3","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2013-02-04T21:46:58.194-05:00","last_posted_at":"2013-11-06T13:56:27.753-05:00","bumped":true,"bumped_at":"2013-11-06T13:56:27.753-05:00","unseen":false,"pinned":false,"visible":true,"closed":false,"archived":false,"views":82,"like_count":10,"has_best_of":false,"archetype":"regular","last_poster_username":"test_user","category_id":1,"posters":[{"extras":null,"description":"Original Poster, Most Recent Poster","user_id":1}]}]}}
1
+ {
2
+ "users": [
3
+ {
4
+ "id": 1,
5
+ "username": "test_users",
6
+ "avatar_template": "//www.gravatar.com/avatar/test.png?s={size}&r=pg&d=identicon"
7
+ }
8
+ ],
9
+ "topic_list": {
10
+ "can_create_topic": false,
11
+ "more_topics_url": "/latest.json?page=1",
12
+ "draft": null,
13
+ "draft_key": "new_topic",
14
+ "draft_sequence": null,
15
+ "topics": [
16
+ {
17
+ "id": 1,
18
+ "title": "Test topic #1",
19
+ "fancy_title": "Test topic #1",
20
+ "slug": "test-topic-1",
21
+ "posts_count": 1,
22
+ "reply_count": 0,
23
+ "highest_post_number": 1,
24
+ "image_url": null,
25
+ "created_at": "2013-02-04T15:26:25.977-05:00",
26
+ "last_posted_at": "2013-02-05T12:14:17.364-05:00",
27
+ "bumped": true,
28
+ "bumped_at": "2013-02-07T13:43:11.191-05:00",
29
+ "unseen": false,
30
+ "pinned": true,
31
+ "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…",
32
+ "visible": true,
33
+ "closed": false,
34
+ "archived": false,
35
+ "views": 268,
36
+ "like_count": 14,
37
+ "has_best_of": false,
38
+ "archetype": "regular",
39
+ "last_poster_username": "test_user",
40
+ "category_id": 1,
41
+ "posters": [
42
+ {
43
+ "extras": null,
44
+ "description": "Original Poster, Most Recent Poster",
45
+ "user_id": 1
46
+ }
47
+ ]
48
+ },
49
+ {
50
+ "id": 1,
51
+ "title": "Test topic #2",
52
+ "fancy_title": "Test topic #2",
53
+ "slug": "test-topic-1",
54
+ "posts_count": 1,
55
+ "reply_count": 0,
56
+ "highest_post_number": 2,
57
+ "image_url": null,
58
+ "created_at": "2013-11-06T13:57:47.984-05:00",
59
+ "last_posted_at": "2013-11-06T13:57:48.111-05:00",
60
+ "bumped": true,
61
+ "bumped_at": "2013-11-06T13:57:48.111-05:00",
62
+ "unseen": false,
63
+ "pinned": false,
64
+ "visible": true,
65
+ "closed": false,
66
+ "archived": false,
67
+ "views": 1,
68
+ "like_count": 0,
69
+ "has_best_of": false,
70
+ "archetype": "regular",
71
+ "last_poster_username": "test_user",
72
+ "category_id": 1,
73
+ "posters": [
74
+ {
75
+ "extras": null,
76
+ "description": "Original Poster, Most Recent Poster",
77
+ "user_id": 1
78
+ }
79
+ ]
80
+ },
81
+ {
82
+ "id": 1,
83
+ "title": "Test topic #3",
84
+ "fancy_title": "Test topic #3",
85
+ "slug": "test-topic-3",
86
+ "posts_count": 1,
87
+ "reply_count": 0,
88
+ "highest_post_number": 1,
89
+ "image_url": null,
90
+ "created_at": "2013-02-04T21:46:58.194-05:00",
91
+ "last_posted_at": "2013-11-06T13:56:27.753-05:00",
92
+ "bumped": true,
93
+ "bumped_at": "2013-11-06T13:56:27.753-05:00",
94
+ "unseen": false,
95
+ "pinned": false,
96
+ "visible": true,
97
+ "closed": false,
98
+ "archived": false,
99
+ "views": 82,
100
+ "like_count": 10,
101
+ "has_best_of": false,
102
+ "archetype": "regular",
103
+ "last_poster_username": "test_user",
104
+ "category_id": 1,
105
+ "posters": [
106
+ {
107
+ "extras": null,
108
+ "description": "Original Poster, Most Recent Poster",
109
+ "user_id": 1
110
+ }
111
+ ]
112
+ }
113
+ ]
114
+ }
115
+ }