discourse_api 0.10.1 → 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +21 -21
  3. data/.travis.yml +5 -7
  4. data/CHANGELOG.md +99 -85
  5. data/Gemfile +4 -4
  6. data/Guardfile +5 -5
  7. data/LICENSE.txt +22 -22
  8. data/README.md +73 -73
  9. data/Rakefile +7 -7
  10. data/discourse_api.gemspec +35 -33
  11. data/examples/backups.rb +18 -18
  12. data/examples/category.rb +21 -21
  13. data/examples/change_topic_status.rb +33 -0
  14. data/examples/create_topic.rb +23 -23
  15. data/examples/create_user.rb +14 -14
  16. data/examples/dashboard.rb +13 -13
  17. data/examples/disposable_invite_tokens.rb +18 -18
  18. data/examples/example.rb +9 -9
  19. data/examples/groups.rb +25 -25
  20. data/examples/invite_users.rb +15 -15
  21. data/examples/post_action.rb +25 -25
  22. data/examples/search.rb +9 -9
  23. data/examples/sso.rb +14 -14
  24. data/examples/topic_lists.rb +15 -15
  25. data/examples/update_user.rb +22 -22
  26. data/lib/discourse_api.rb +5 -5
  27. data/lib/discourse_api/api/api_key.rb +31 -31
  28. data/lib/discourse_api/api/backups.rb +24 -24
  29. data/lib/discourse_api/api/badges.rb +28 -28
  30. data/lib/discourse_api/api/categories.rb +57 -57
  31. data/lib/discourse_api/api/dashboard.rb +24 -24
  32. data/lib/discourse_api/api/email.rb +15 -15
  33. data/lib/discourse_api/api/groups.rb +52 -52
  34. data/lib/discourse_api/api/invite.rb +17 -17
  35. data/lib/discourse_api/api/notifications.rb +9 -9
  36. data/lib/discourse_api/api/params.rb +55 -55
  37. data/lib/discourse_api/api/posts.rb +41 -42
  38. data/lib/discourse_api/api/private_messages.rb +10 -10
  39. data/lib/discourse_api/api/search.rb +19 -19
  40. data/lib/discourse_api/api/sso.rb +22 -22
  41. data/lib/discourse_api/api/tags.rb +10 -10
  42. data/lib/discourse_api/api/topics.rb +78 -65
  43. data/lib/discourse_api/api/users.rb +85 -85
  44. data/lib/discourse_api/client.rb +133 -133
  45. data/lib/discourse_api/error.rb +17 -17
  46. data/lib/discourse_api/single_sign_on.rb +110 -110
  47. data/lib/discourse_api/version.rb +3 -3
  48. data/routes.txt +203 -203
  49. data/spec/discourse_api/api/api_key_spec.rb +121 -121
  50. data/spec/discourse_api/api/backups_spec.rb +23 -23
  51. data/spec/discourse_api/api/badges_spec.rb +40 -40
  52. data/spec/discourse_api/api/categories_spec.rb +87 -87
  53. data/spec/discourse_api/api/email_spec.rb +39 -39
  54. data/spec/discourse_api/api/groups_spec.rb +94 -94
  55. data/spec/discourse_api/api/notifications_spec.rb +24 -24
  56. data/spec/discourse_api/api/params_spec.rb +32 -32
  57. data/spec/discourse_api/api/posts_spec.rb +41 -29
  58. data/spec/discourse_api/api/private_messages_spec.rb +22 -22
  59. data/spec/discourse_api/api/search_spec.rb +30 -30
  60. data/spec/discourse_api/api/sso_spec.rb +16 -16
  61. data/spec/discourse_api/api/topics_spec.rb +113 -113
  62. data/spec/discourse_api/api/users_spec.rb +227 -227
  63. data/spec/discourse_api/client_spec.rb +115 -115
  64. data/spec/fixtures/api.json +12 -12
  65. data/spec/fixtures/backups.json +12 -12
  66. data/spec/fixtures/badges.json +569 -569
  67. data/spec/fixtures/categories.json +72 -72
  68. data/spec/fixtures/category_latest_topics.json +92 -92
  69. data/spec/fixtures/category_topics.json +91 -91
  70. data/spec/fixtures/email_list_all.json +749 -749
  71. data/spec/fixtures/email_settings.json +13 -13
  72. data/spec/fixtures/generate_api_key.json +12 -12
  73. data/spec/fixtures/generate_master_key.json +7 -7
  74. data/spec/fixtures/groups.json +18 -18
  75. data/spec/fixtures/hot.json +113 -113
  76. data/spec/fixtures/latest.json +115 -115
  77. data/spec/fixtures/members_0.json +403 -403
  78. data/spec/fixtures/members_1.json +363 -363
  79. data/spec/fixtures/new.json +113 -113
  80. data/spec/fixtures/notifications.json +16 -16
  81. data/spec/fixtures/post.json +94 -94
  82. data/spec/fixtures/post_action_users.json +18 -0
  83. data/spec/fixtures/private_messages.json +69 -69
  84. data/spec/fixtures/regenerate_api_key.json +7 -7
  85. data/spec/fixtures/search.json +24 -24
  86. data/spec/fixtures/topic.json +739 -739
  87. data/spec/fixtures/topic_invite_user.json +3 -3
  88. data/spec/fixtures/topics_created_by.json +49 -49
  89. data/spec/fixtures/update_trust_level.json +37 -37
  90. data/spec/fixtures/upload_avatar.json +13 -13
  91. data/spec/fixtures/user.json +65 -65
  92. data/spec/fixtures/user_activate_success.json +3 -3
  93. data/spec/fixtures/user_badges.json +170 -170
  94. data/spec/fixtures/user_create_success.json +5 -5
  95. data/spec/fixtures/user_grant_admin.json +37 -37
  96. data/spec/fixtures/user_list.json +583 -583
  97. data/spec/fixtures/user_log_out_success.json +3 -3
  98. data/spec/fixtures/user_update_avatar_success.json +3 -3
  99. data/spec/fixtures/user_update_user.json +3 -3
  100. data/spec/fixtures/user_update_username.json +4 -4
  101. data/spec/spec_helper.rb +61 -61
  102. metadata +31 -28
@@ -1,72 +1,72 @@
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
+ {
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,92 +1,92 @@
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
+ {
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,92 +1,92 @@
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
- }
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
92
  }