discourse_api 0.1.1
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 +7 -0
- data/.gitignore +20 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/Guardfile +5 -0
- data/LICENSE.txt +22 -0
- data/README.md +55 -0
- data/Rakefile +7 -0
- data/discourse_api.gemspec +31 -0
- data/examples/example.rb +7 -0
- data/examples/invite_users.rb +10 -0
- data/examples/post_topic.rb +16 -0
- data/examples/topic_lists.rb +13 -0
- data/examples/update_user.rb +14 -0
- data/lib/discourse_api.rb +3 -0
- data/lib/discourse_api/api/categories.rb +10 -0
- data/lib/discourse_api/api/search.rb +16 -0
- data/lib/discourse_api/api/topics.rb +35 -0
- data/lib/discourse_api/api/users.rb +30 -0
- data/lib/discourse_api/client.rb +76 -0
- data/lib/discourse_api/error.rb +14 -0
- data/lib/discourse_api/version.rb +3 -0
- data/routes.txt +203 -0
- data/spec/discourse_api/api/categories_spec.rb +22 -0
- data/spec/discourse_api/api/search_spec.rb +22 -0
- data/spec/discourse_api/api/topics_spec.rb +94 -0
- data/spec/discourse_api/api/users_spec.rb +41 -0
- data/spec/discourse_api/client_spec.rb +105 -0
- data/spec/fixtures/categories.json +1 -0
- data/spec/fixtures/hot.json +1 -0
- data/spec/fixtures/latest.json +1 -0
- data/spec/fixtures/new.json +1 -0
- data/spec/fixtures/search.json +1 -0
- data/spec/fixtures/topic.json +1 -0
- data/spec/fixtures/topics_created_by.json +1 -0
- data/spec/fixtures/user.json +1 -0
- data/spec/spec_helper.rb +60 -0
- metadata +238 -0
| @@ -0,0 +1 @@ | |
| 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":[]}]}}
         | 
| @@ -0,0 +1 @@ | |
| 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}]}]}}
         | 
| @@ -0,0 +1 @@ | |
| 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}]}]}}
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            {"users":[{"id":1,"username":"test_user","avatar_template":"//www.gravatar.com/avatar/test.png?s={size}&r=pg&d=identicon"}],"topic_list":{"can_create_topic":true,"draft":null,"draft_key":"new_topic","draft_sequence":0,"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-11-07T03:02:03.615-05:00","last_posted_at":"2013-11-07T09:42:57.094-05:00","bumped":true,"bumped_at":"2013-11-07T09:42:57.094-05:00","unseen":true,"pinned":false,"visible":true,"closed":false,"archived":false,"views":20,"like_count":1,"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":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-11-06T12:21:37.811-05:00","last_posted_at":"2013-11-07T05:41:55.171-05:00","bumped":true,"bumped_at":"2013-11-07T05:41:55.171-05:00","unseen":true,"pinned":false,"visible":true,"closed":false,"archived":false,"views":50,"like_count":0,"has_best_of":false,"archetype":"regular","last_poster_username":"cowboytomash","category_id":1,"posters":[{"extras":null,"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-11-07T02:43:19.243-05:00","last_posted_at":"2013-11-07T02:43:19.389-05:00","bumped":true,"bumped_at":"2013-11-07T02:43:19.389-05:00","unseen":true,"pinned":false,"visible":true,"closed":false,"archived":false,"views":14,"like_count":0,"has_best_of":false,"archetype":"regular","last_poster_username":"akshar","category_id":1,"posters":[{"extras":null,"description":"Original Poster, Most Recent Poster","user_id":1}]}]}}
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            [{"type":"topic","name":"Topics","more":true,"results":[{"id":1,"title":"Test topic #1","url":"/t/test-topic-1/1"},{"id":2,"title":"Test topic #2","url":"/t/test-topic-2/2"},{"id":3,"title":"Test topic #3","url":"/t/test-topic-3/3"}]}]
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            {"post_stream":{"posts":[{"id":83,"name":"Sam Saffron","username":"samsaffron","avatar_template":"//www.gravatar.com/avatar/3dcae8378d46c244172a115c28ca49ce.png?s={size}&r=pg&d=identicon","created_at":"2013-02-04T15:26:26.278-05:00","cooked":"<p>Welcome!</p>\n\n<h3>Try is a sandbox, a safe place to play with Discourse and its features.</h3>\n\n<p>This site is reset every day (or even more often). <strong>Any accounts or posts you create here will not exist tomorrow!</strong></p>\n\n<p>Feel free to experiment here in the sandbox, but always be civil and respectful -- <em>and don't post anything here you wouldn't want lost forever!</em></p>\n\n<p>If you see anything here that is out of bounds, <strong>please flag it</strong>. Help keep our community clean. We monitor the flags regularly.</p>\n\n<ul>\n<li><p>For more information on the Discourse project and its goals, visit <a href=\"http://www.discourse.org\" rel=\"nofollow\">http://www.discourse.org</a></p></li>\n<li><p>If you wish to participate in the Discourse development process, visit <a href=\"http://meta.discourse.org\" rel=\"nofollow\">http://meta.discourse.org</a></p></li>\n<li><p>If you want to check out the open source Discourse code, or set up a Discourse forum, visit <a href=\"https://github.com/discourse/discourse\" rel=\"nofollow\">https://github.com/discourse/discourse</a></p></li>\n</ul>","post_number":1,"post_type":1,"updated_at":"2013-04-30T14:33:37.273-04:00","reply_count":1,"reply_to_post_number":null,"quote_count":0,"avg_time":17,"incoming_link_count":0,"reads":34,"score":12.65,"yours":false,"topic_slug":"this-site-is-a-sandbox-it-is-reset-every-day","topic_id":57,"display_username":"Sam Saffron","version":5,"can_edit":null,"can_delete":null,"can_recover":false,"link_counts":[{"url":"http://meta.discourse.org","internal":false,"reflection":false,"clicks":7},{"url":"http://www.discourse.org","internal":false,"reflection":false,"clicks":4},{"url":"https://github.com/discourse/discourse","internal":false,"reflection":false,"clicks":0}],"read":false,"user_title":null,"actions_summary":[{"id":2,"count":0,"hidden":false,"can_act":null},{"id":3,"count":0,"hidden":false,"can_act":null},{"id":4,"count":0,"hidden":false,"can_act":null},{"id":5,"count":0,"hidden":true,"can_act":null},{"id":6,"count":0,"hidden":false,"can_act":null},{"id":7,"count":0,"hidden":false,"can_act":null},{"id":8,"count":0,"hidden":false,"can_act":null}],"moderator":false,"staff":true,"user_id":15,"hidden":false,"hidden_reason_id":null,"trust_level":1,"deleted_at":null,"user_deleted":false},{"id":84,"name":"Sam Saffron","username":"samsaffron","avatar_template":"//www.gravatar.com/avatar/3dcae8378d46c244172a115c28ca49ce.png?s={size}&r=pg&d=identicon","created_at":"2013-02-04T15:26:32.362-05:00","cooked":"<p>This topic is now pinned. It will appear at the top of its category.</p>","post_number":2,"post_type":2,"updated_at":"2013-02-04T15:26:32.362-05:00","reply_count":0,"reply_to_post_number":null,"quote_count":0,"avg_time":18,"incoming_link_count":0,"reads":34,"score":7.7,"yours":false,"topic_slug":"this-site-is-a-sandbox-it-is-reset-every-day","topic_id":57,"display_username":"Sam Saffron","version":1,"can_edit":null,"can_delete":null,"can_recover":false,"read":false,"user_title":null,"actions_summary":[{"id":2,"count":0,"hidden":false,"can_act":null},{"id":3,"count":0,"hidden":false,"can_act":null},{"id":4,"count":0,"hidden":false,"can_act":null},{"id":5,"count":0,"hidden":true,"can_act":null},{"id":6,"count":0,"hidden":false,"can_act":null},{"id":7,"count":0,"hidden":false,"can_act":null},{"id":8,"count":0,"hidden":false,"can_act":null}],"moderator":false,"staff":true,"user_id":15,"hidden":false,"hidden_reason_id":null,"trust_level":1,"deleted_at":null,"user_deleted":false},{"id":86,"name":"Adam Davis","username":"stienman","avatar_template":"//www.gravatar.com/avatar/281486f2a20201375414760dd347951d.png?s={size}&r=pg&d=identicon","created_at":"2013-02-04T15:29:00.843-05:00","cooked":"<p><img src=\"http://i288.photobucket.com/albums/ll164/stienman/ahh.gif\" alt=\"image\" title=\"\" width=\"36\" height=\"22\"></p>","post_number":3,"post_type":1,"updated_at":"2013-02-04T15:29:00.843-05:00","reply_count":0,"reply_to_post_number":null,"quote_count":0,"avg_time":19,"incoming_link_count":2,"reads":34,"score":152.75,"yours":false,"topic_slug":"this-site-is-a-sandbox-it-is-reset-every-day","topic_id":57,"display_username":"Adam Davis","version":1,"can_edit":null,"can_delete":null,"can_recover":false,"read":false,"user_title":null,"actions_summary":[{"id":2,"count":5,"hidden":false,"can_act":null},{"id":3,"count":0,"hidden":false,"can_act":null},{"id":4,"count":0,"hidden":false,"can_act":null},{"id":5,"count":0,"hidden":true,"can_act":null},{"id":6,"count":0,"hidden":false,"can_act":null},{"id":7,"count":0,"hidden":false,"can_act":null},{"id":8,"count":0,"hidden":false,"can_act":null}],"moderator":false,"staff":true,"user_id":23,"hidden":false,"hidden_reason_id":null,"trust_level":1,"deleted_at":null,"user_deleted":false},{"id":226,"name":"Stefan Plattner","username":"splattne","avatar_template":"//www.gravatar.com/avatar/7847006dbf49f1722b07c8da396f1275.png?s={size}&r=pg&d=identicon","created_at":"2013-02-05T12:14:17.364-05:00","cooked":"<p>What? So I have to post this every day? <br><img src=\"http://q101.com/wp-content/uploads/2012/02/GroundhogDay.gif\" alt=\"image\" title=\"\" width=\"650\" height=\"824\"></p>","post_number":14,"post_type":1,"updated_at":"2013-02-05T12:14:17.364-05:00","reply_count":0,"reply_to_post_number":1,"quote_count":0,"avg_time":16,"incoming_link_count":0,"reads":22,"score":170.2,"yours":false,"topic_slug":"this-site-is-a-sandbox-it-is-reset-every-day","topic_id":57,"display_username":"Stefan Plattner","version":1,"can_edit":null,"can_delete":null,"can_recover":false,"read":false,"user_title":null,"reply_to_user":{"username":"samsaffron","avatar_template":"//www.gravatar.com/avatar/3dcae8378d46c244172a115c28ca49ce.png?s={size}&r=pg&d=identicon"},"actions_summary":[{"id":2,"count":5,"hidden":false,"can_act":null},{"id":3,"count":0,"hidden":false,"can_act":null},{"id":4,"count":0,"hidden":false,"can_act":null},{"id":5,"count":0,"hidden":true,"can_act":null},{"id":6,"count":0,"hidden":false,"can_act":null},{"id":7,"count":0,"hidden":false,"can_act":null},{"id":8,"count":0,"hidden":false,"can_act":null}],"moderator":false,"staff":true,"user_id":50,"hidden":false,"hidden_reason_id":null,"trust_level":1,"deleted_at":null,"user_deleted":false}],"stream":[83,84,86,226]},"draft":null,"draft_key":"topic_57","draft_sequence":null,"pinned":true,"details":{"auto_close_at":null,"created_by":{"id":15,"username":"samsaffron","avatar_template":"//www.gravatar.com/avatar/3dcae8378d46c244172a115c28ca49ce.png?s={size}&r=pg&d=identicon"},"last_poster":{"id":50,"username":"splattne","avatar_template":"//www.gravatar.com/avatar/7847006dbf49f1722b07c8da396f1275.png?s={size}&r=pg&d=identicon"},"participants":[{"id":15,"username":"samsaffron","avatar_template":"//www.gravatar.com/avatar/3dcae8378d46c244172a115c28ca49ce.png?s={size}&r=pg&d=identicon","post_count":2},{"id":23,"username":"stienman","avatar_template":"//www.gravatar.com/avatar/281486f2a20201375414760dd347951d.png?s={size}&r=pg&d=identicon","post_count":1},{"id":50,"username":"splattne","avatar_template":"//www.gravatar.com/avatar/7847006dbf49f1722b07c8da396f1275.png?s={size}&r=pg&d=identicon","post_count":1}],"suggested_topics":[{"id":62,"title":"Funny pictures (Keep 'em clean, folks!)","fancy_title":"Funny pictures (Keep ‘em clean, folks!)","slug":"funny-pictures-keep-em-clean-folks","posts_count":39,"reply_count":3,"highest_post_number":39,"image_url":"http://cdn.discourse.org/uploads/try2_discourse/27/nt3b8.jpeg","created_at":"2013-02-04T15:42:30.290-05:00","last_posted_at":"2013-11-06T02:47:27.135-05:00","bumped":true,"bumped_at":"2013-11-06T03:02:06.494-05:00","unseen":false,"pinned":false,"visible":true,"closed":false,"archived":false,"archetype":"regular","like_count":10,"views":186,"category":{"id":13,"name":"uncategPorized","color":"AB9364","text_color":"FFFFFF","slug":"uncategorized","topic_count":21,"description":"","topic_url":null,"hotness":5.0,"read_restricted":false,"permission":null,"available_groups":["admins","everyone","moderators","staff","trust_level_1","trust_level_2","trust_level_3","trust_level_4","trust_level_5"],"auto_close_days":null,"group_permissions":[{"permission_type":1,"group_name":"everyone"}],"position":1}},{"id":152,"title":"What are good resolutions to the enviroment?","fancy_title":"What are good resolutions to the enviroment?","slug":"what-are-good-resolutions-to-the-enviroment","posts_count":3,"reply_count":0,"highest_post_number":3,"image_url":null,"created_at":"2013-11-05T02:12:37.113-05:00","last_posted_at":"2013-11-05T11:32:31.259-05:00","bumped":true,"bumped_at":"2013-11-05T11:32:31.259-05:00","unseen":false,"pinned":false,"visible":true,"closed":false,"archived":false,"archetype":"regular","like_count":0,"views":50,"category":{"id":13,"name":"uncategorized","color":"AB9364","text_color":"FFFFFF","slug":"uncategorized","topic_count":21,"description":"","topic_url":null,"hotness":5.0,"read_restricted":false,"permission":null,"available_groups":["admins","everyone","moderators","staff","trust_level_1","trust_level_2","trust_level_3","trust_level_4","trust_level_5"],"auto_close_days":null,"group_permissions":[{"permission_type":1,"group_name":"everyone"}],"position":1}},{"id":87,"title":"Hilarious Picture Dump (Image Heavy)","fancy_title":"Hilarious Picture Dump (Image Heavy)","slug":"hilarious-picture-dump-image-heavy","posts_count":4,"reply_count":0,"highest_post_number":4,"image_url":"http://cdn.discourse.org/uploads/try2_discourse/33/1208514086be7cd9d27c00836da43ab15d00ec7be_4c256628scaled.jpeg","created_at":"2013-02-04T21:07:51.246-05:00","last_posted_at":"2013-02-05T12:52:47.243-05:00","bumped":true,"bumped_at":"2013-06-26T01:45:24.590-04:00","unseen":false,"pinned":false,"visible":true,"closed":false,"archived":false,"archetype":"regular","like_count":0,"views":69,"category":{"id":13,"name":"uncategorized","color":"AB9364","text_color":"FFFFFF","slug":"uncategorized","topic_count":21,"description":"","topic_url":null,"hotness":5.0,"read_restricted":false,"permission":null,"available_groups":["admins","everyone","moderators","staff","trust_level_1","trust_level_2","trust_level_3","trust_level_4","trust_level_5"],"auto_close_days":null,"group_permissions":[{"permission_type":1,"group_name":"everyone"}],"position":1}},{"id":197,"title":"Replying as a new topic","fancy_title":"Replying as a new topic","slug":"replying-as-a-new-topic","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2013-11-06T00:57:00.177-05:00","last_posted_at":"2013-11-06T00:57:00.326-05:00","bumped":true,"bumped_at":"2013-11-06T00:57:00.326-05:00","unseen":false,"pinned":false,"visible":true,"closed":false,"archived":false,"archetype":"regular","like_count":0,"views":23,"category":{"id":13,"name":"uncategorized","color":"AB9364","text_color":"FFFFFF","slug":"uncategorized","topic_count":21,"description":"","topic_url":null,"hotness":5.0,"read_restricted":false,"permission":null,"available_groups":["admins","everyone","moderators","staff","trust_level_1","trust_level_2","trust_level_3","trust_level_4","trust_level_5"],"auto_close_days":null,"group_permissions":[{"permission_type":1,"group_name":"everyone"}],"position":1}},{"id":157,"title":"What is your opinion on the movie hunger game?","fancy_title":"What is your opinion on the movie hunger game?","slug":"what-is-your-opinion-on-the-movie-hunger-game","posts_count":1,"reply_count":0,"highest_post_number":1,"image_url":null,"created_at":"2013-11-05T03:59:13.194-05:00","last_posted_at":"2013-11-05T03:59:13.343-05:00","bumped":true,"bumped_at":"2013-11-05T03:59:13.343-05:00","unseen":false,"pinned":false,"visible":true,"closed":false,"archived":false,"archetype":"regular","like_count":1,"views":23,"category":{"id":13,"name":"uncategorized","color":"AB9364","text_color":"FFFFFF","slug":"uncategorized","topic_count":21,"description":"","topic_url":null,"hotness":5.0,"read_restricted":false,"permission":null,"available_groups":["admins","everyone","moderators","staff","trust_level_1","trust_level_2","trust_level_3","trust_level_4","trust_level_5"],"auto_close_days":null,"group_permissions":[{"permission_type":1,"group_name":"everyone"}],"position":1}}],"links":[{"url":"http://meta.discourse.org","title":null,"fancy_title":null,"internal":false,"reflection":false,"clicks":"7","user_id":15},{"url":"http://www.discourse.org","title":null,"fancy_title":null,"internal":false,"reflection":false,"clicks":"4","user_id":15},{"url":"https://github.com/discourse/discourse","title":null,"fancy_title":null,"internal":false,"reflection":false,"clicks":"0","user_id":15},{"url":"/users/pekka.gaiser","title":null,"fancy_title":null,"internal":true,"reflection":false,"clicks":"0","user_id":9},{"url":"http://dev.discourse.org/t/general-bugs-list/92/365)","title":null,"fancy_title":null,"internal":false,"reflection":false,"clicks":"0","user_id":9},{"url":"/users/pekka","title":null,"fancy_title":null,"internal":true,"reflection":false,"clicks":"0","user_id":9}]},"highest_post_number":14,"deleted_by":null,"id":57,"title":"THIS SITE IS A SANDBOX -- it is reset every day","fancy_title":"THIS SITE IS A SANDBOX – it is reset every day","posts_count":4,"created_at":"2013-02-04T15:26:25.977-05:00","views":268,"reply_count":9,"last_posted_at":"2013-02-05T12:14:17.364-05:00","visible":true,"closed":false,"archived":false,"has_best_of":false,"archetype":"regular","slug":"this-site-is-a-sandbox-it-is-reset-every-day","category_id":13,"deleted_at":null}
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            {"users":[{"id":1,"username":"test_user","avatar_template":"//www.gravatar.com/avatar/test.png?s={size}&r=pg&d=identicon"}],"topic_list":{"can_create_topic":true,"draft":null,"draft_key":"new_topic","draft_sequence":0,"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-07-22T19:27:14.818-04:00","last_posted_at":"2013-07-22T19:41:49.768-04:00","bumped":true,"bumped_at":"2013-07-22T19:41:49.768-04:00","unseen":false,"pinned":false,"visible":true,"closed":false,"archived":false,"views":68,"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}]}]}}
         | 
| @@ -0,0 +1 @@ | |
| 1 | 
            +
            {"user":{"id":1,"username":"test-user","avatar_template":"http://try.discourse.org/uploads/try_discourse/avatars/a/b/c/{size}.gif","name":"Test User","email":"test@example.com","last_posted_at":null,"last_seen_at":"2013-11-06T21:57:26.260-05:00","bio_raw":null,"bio_cooked":null,"created_at":"2013-11-06T10:56:23.687-05:00","website":"http://example.com","can_edit":true,"can_edit_username":true,"can_edit_email":true,"stats":[{"action_type":13,"count":1,"id":null}],"can_send_private_message_to_user":false,"bio_excerpt":"I'm a test user.","trust_level":1,"moderator":false,"admin":false,"title":null,"email_digests":false,"email_private_messages":true,"email_direct":true,"email_always":false,"digest_after_days":null,"auto_track_topics_after_msecs":240000,"new_topic_duration_minutes":2880,"external_links_in_new_tab":false,"dynamic_favicon":false,"enable_quoting":true,"use_uploaded_avatar":true,"has_uploaded_avatar":true,"gravatar_template":"//www.gravatar.com/avatar/test.png?s={size}&r=pg&d=identicon","uploaded_avatar_template":"http://try.discourse.org/uploads/try_discourse/avatars/a/b/c/{size}.gif","invited_by":null}}
         | 
    
        data/spec/spec_helper.rb
    ADDED
    
    | @@ -0,0 +1,60 @@ | |
| 1 | 
            +
            require 'simplecov'
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
         | 
| 4 | 
            +
              SimpleCov::Formatter::HTMLFormatter,
         | 
| 5 | 
            +
            ]
         | 
| 6 | 
            +
            SimpleCov.start do
         | 
| 7 | 
            +
              add_filter "/spec/"
         | 
| 8 | 
            +
            end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            require 'discourse_api'
         | 
| 11 | 
            +
            require 'rspec'
         | 
| 12 | 
            +
            require 'webmock/rspec'
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            RSpec.configure do |config|
         | 
| 15 | 
            +
              config.expect_with :rspec do |c|
         | 
| 16 | 
            +
                c.syntax = :expect
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
            end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
            WebMock.disable_net_connect!
         | 
| 21 | 
            +
             | 
| 22 | 
            +
            def a_delete(path)
         | 
| 23 | 
            +
              a_request(:delete, path)
         | 
| 24 | 
            +
            end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
            def a_get(path)
         | 
| 27 | 
            +
              a_request(:get, path)
         | 
| 28 | 
            +
            end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
            def a_post(path)
         | 
| 31 | 
            +
              a_request(:post, path)
         | 
| 32 | 
            +
            end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
            def a_put(path)
         | 
| 35 | 
            +
              a_request(:put, path)
         | 
| 36 | 
            +
            end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
            def stub_delete(path)
         | 
| 39 | 
            +
              stub_request(:delete, path)
         | 
| 40 | 
            +
            end
         | 
| 41 | 
            +
             | 
| 42 | 
            +
            def stub_get(path)
         | 
| 43 | 
            +
              stub_request(:get, path)
         | 
| 44 | 
            +
            end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
            def stub_post(path)
         | 
| 47 | 
            +
              stub_request(:post, path)
         | 
| 48 | 
            +
            end
         | 
| 49 | 
            +
             | 
| 50 | 
            +
            def stub_put(path)
         | 
| 51 | 
            +
              stub_request(:put, path)
         | 
| 52 | 
            +
            end
         | 
| 53 | 
            +
             | 
| 54 | 
            +
            def fixture_path
         | 
| 55 | 
            +
              File.expand_path("../fixtures", __FILE__)
         | 
| 56 | 
            +
            end
         | 
| 57 | 
            +
             | 
| 58 | 
            +
            def fixture(file)
         | 
| 59 | 
            +
              File.new(fixture_path + '/' + file)
         | 
| 60 | 
            +
            end
         | 
    
        metadata
    ADDED
    
    | @@ -0,0 +1,238 @@ | |
| 1 | 
            +
            --- !ruby/object:Gem::Specification
         | 
| 2 | 
            +
            name: discourse_api
         | 
| 3 | 
            +
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            +
              version: 0.1.1
         | 
| 5 | 
            +
            platform: ruby
         | 
| 6 | 
            +
            authors:
         | 
| 7 | 
            +
            - Sam Saffron
         | 
| 8 | 
            +
            - John Paul Ashenfelter
         | 
| 9 | 
            +
            - Michael Herold
         | 
| 10 | 
            +
            autorequire: 
         | 
| 11 | 
            +
            bindir: bin
         | 
| 12 | 
            +
            cert_chain: []
         | 
| 13 | 
            +
            date: 2013-12-27 00:00:00.000000000 Z
         | 
| 14 | 
            +
            dependencies:
         | 
| 15 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 16 | 
            +
              name: faraday
         | 
| 17 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 18 | 
            +
                requirements:
         | 
| 19 | 
            +
                - - ~>
         | 
| 20 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 21 | 
            +
                    version: 0.8.8
         | 
| 22 | 
            +
              type: :runtime
         | 
| 23 | 
            +
              prerelease: false
         | 
| 24 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 25 | 
            +
                requirements:
         | 
| 26 | 
            +
                - - ~>
         | 
| 27 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 28 | 
            +
                    version: 0.8.8
         | 
| 29 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 30 | 
            +
              name: faraday_middleware
         | 
| 31 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 32 | 
            +
                requirements:
         | 
| 33 | 
            +
                - - ~>
         | 
| 34 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 35 | 
            +
                    version: '0.9'
         | 
| 36 | 
            +
              type: :runtime
         | 
| 37 | 
            +
              prerelease: false
         | 
| 38 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 39 | 
            +
                requirements:
         | 
| 40 | 
            +
                - - ~>
         | 
| 41 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 42 | 
            +
                    version: '0.9'
         | 
| 43 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 44 | 
            +
              name: bundler
         | 
| 45 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 46 | 
            +
                requirements:
         | 
| 47 | 
            +
                - - ~>
         | 
| 48 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 49 | 
            +
                    version: '1.3'
         | 
| 50 | 
            +
              type: :development
         | 
| 51 | 
            +
              prerelease: false
         | 
| 52 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 53 | 
            +
                requirements:
         | 
| 54 | 
            +
                - - ~>
         | 
| 55 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 56 | 
            +
                    version: '1.3'
         | 
| 57 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 58 | 
            +
              name: rake
         | 
| 59 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 60 | 
            +
                requirements:
         | 
| 61 | 
            +
                - - '>='
         | 
| 62 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 63 | 
            +
                    version: '0'
         | 
| 64 | 
            +
              type: :development
         | 
| 65 | 
            +
              prerelease: false
         | 
| 66 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 67 | 
            +
                requirements:
         | 
| 68 | 
            +
                - - '>='
         | 
| 69 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 70 | 
            +
                    version: '0'
         | 
| 71 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 72 | 
            +
              name: rspec
         | 
| 73 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 74 | 
            +
                requirements:
         | 
| 75 | 
            +
                - - '>='
         | 
| 76 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 77 | 
            +
                    version: '0'
         | 
| 78 | 
            +
              type: :development
         | 
| 79 | 
            +
              prerelease: false
         | 
| 80 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 81 | 
            +
                requirements:
         | 
| 82 | 
            +
                - - '>='
         | 
| 83 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 84 | 
            +
                    version: '0'
         | 
| 85 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 86 | 
            +
              name: webmock
         | 
| 87 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 88 | 
            +
                requirements:
         | 
| 89 | 
            +
                - - '>='
         | 
| 90 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 91 | 
            +
                    version: '0'
         | 
| 92 | 
            +
              type: :development
         | 
| 93 | 
            +
              prerelease: false
         | 
| 94 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 95 | 
            +
                requirements:
         | 
| 96 | 
            +
                - - '>='
         | 
| 97 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 98 | 
            +
                    version: '0'
         | 
| 99 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 100 | 
            +
              name: guard-rspec
         | 
| 101 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 102 | 
            +
                requirements:
         | 
| 103 | 
            +
                - - '>='
         | 
| 104 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 105 | 
            +
                    version: '0'
         | 
| 106 | 
            +
              type: :development
         | 
| 107 | 
            +
              prerelease: false
         | 
| 108 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 109 | 
            +
                requirements:
         | 
| 110 | 
            +
                - - '>='
         | 
| 111 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 112 | 
            +
                    version: '0'
         | 
| 113 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 114 | 
            +
              name: guard
         | 
| 115 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 116 | 
            +
                requirements:
         | 
| 117 | 
            +
                - - '>='
         | 
| 118 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 119 | 
            +
                    version: '0'
         | 
| 120 | 
            +
              type: :development
         | 
| 121 | 
            +
              prerelease: false
         | 
| 122 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 123 | 
            +
                requirements:
         | 
| 124 | 
            +
                - - '>='
         | 
| 125 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 126 | 
            +
                    version: '0'
         | 
| 127 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 128 | 
            +
              name: rb-inotify
         | 
| 129 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 130 | 
            +
                requirements:
         | 
| 131 | 
            +
                - - '>='
         | 
| 132 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 133 | 
            +
                    version: '0'
         | 
| 134 | 
            +
              type: :development
         | 
| 135 | 
            +
              prerelease: false
         | 
| 136 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 137 | 
            +
                requirements:
         | 
| 138 | 
            +
                - - '>='
         | 
| 139 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 140 | 
            +
                    version: '0'
         | 
| 141 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 142 | 
            +
              name: simplecov
         | 
| 143 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 144 | 
            +
                requirements:
         | 
| 145 | 
            +
                - - '>='
         | 
| 146 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 147 | 
            +
                    version: '0'
         | 
| 148 | 
            +
              type: :development
         | 
| 149 | 
            +
              prerelease: false
         | 
| 150 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 151 | 
            +
                requirements:
         | 
| 152 | 
            +
                - - '>='
         | 
| 153 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 154 | 
            +
                    version: '0'
         | 
| 155 | 
            +
            description: Discourse API
         | 
| 156 | 
            +
            email:
         | 
| 157 | 
            +
            - sam.saffron@gmail.com
         | 
| 158 | 
            +
            - john@ashenfelter.com
         | 
| 159 | 
            +
            - michael.j.herold@gmail.com
         | 
| 160 | 
            +
            executables: []
         | 
| 161 | 
            +
            extensions: []
         | 
| 162 | 
            +
            extra_rdoc_files: []
         | 
| 163 | 
            +
            files:
         | 
| 164 | 
            +
            - .gitignore
         | 
| 165 | 
            +
            - .travis.yml
         | 
| 166 | 
            +
            - Gemfile
         | 
| 167 | 
            +
            - Guardfile
         | 
| 168 | 
            +
            - LICENSE.txt
         | 
| 169 | 
            +
            - README.md
         | 
| 170 | 
            +
            - Rakefile
         | 
| 171 | 
            +
            - discourse_api.gemspec
         | 
| 172 | 
            +
            - examples/example.rb
         | 
| 173 | 
            +
            - examples/invite_users.rb
         | 
| 174 | 
            +
            - examples/post_topic.rb
         | 
| 175 | 
            +
            - examples/topic_lists.rb
         | 
| 176 | 
            +
            - examples/update_user.rb
         | 
| 177 | 
            +
            - lib/discourse_api.rb
         | 
| 178 | 
            +
            - lib/discourse_api/api/categories.rb
         | 
| 179 | 
            +
            - lib/discourse_api/api/search.rb
         | 
| 180 | 
            +
            - lib/discourse_api/api/topics.rb
         | 
| 181 | 
            +
            - lib/discourse_api/api/users.rb
         | 
| 182 | 
            +
            - lib/discourse_api/client.rb
         | 
| 183 | 
            +
            - lib/discourse_api/error.rb
         | 
| 184 | 
            +
            - lib/discourse_api/version.rb
         | 
| 185 | 
            +
            - routes.txt
         | 
| 186 | 
            +
            - spec/discourse_api/api/categories_spec.rb
         | 
| 187 | 
            +
            - spec/discourse_api/api/search_spec.rb
         | 
| 188 | 
            +
            - spec/discourse_api/api/topics_spec.rb
         | 
| 189 | 
            +
            - spec/discourse_api/api/users_spec.rb
         | 
| 190 | 
            +
            - spec/discourse_api/client_spec.rb
         | 
| 191 | 
            +
            - spec/fixtures/categories.json
         | 
| 192 | 
            +
            - spec/fixtures/hot.json
         | 
| 193 | 
            +
            - spec/fixtures/latest.json
         | 
| 194 | 
            +
            - spec/fixtures/new.json
         | 
| 195 | 
            +
            - spec/fixtures/search.json
         | 
| 196 | 
            +
            - spec/fixtures/topic.json
         | 
| 197 | 
            +
            - spec/fixtures/topics_created_by.json
         | 
| 198 | 
            +
            - spec/fixtures/user.json
         | 
| 199 | 
            +
            - spec/spec_helper.rb
         | 
| 200 | 
            +
            homepage: http://github.com/discourse/discourse_api
         | 
| 201 | 
            +
            licenses:
         | 
| 202 | 
            +
            - MIT
         | 
| 203 | 
            +
            metadata: {}
         | 
| 204 | 
            +
            post_install_message: 
         | 
| 205 | 
            +
            rdoc_options: []
         | 
| 206 | 
            +
            require_paths:
         | 
| 207 | 
            +
            - lib
         | 
| 208 | 
            +
            required_ruby_version: !ruby/object:Gem::Requirement
         | 
| 209 | 
            +
              requirements:
         | 
| 210 | 
            +
              - - '>='
         | 
| 211 | 
            +
                - !ruby/object:Gem::Version
         | 
| 212 | 
            +
                  version: '0'
         | 
| 213 | 
            +
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 214 | 
            +
              requirements:
         | 
| 215 | 
            +
              - - '>='
         | 
| 216 | 
            +
                - !ruby/object:Gem::Version
         | 
| 217 | 
            +
                  version: '0'
         | 
| 218 | 
            +
            requirements: []
         | 
| 219 | 
            +
            rubyforge_project: 
         | 
| 220 | 
            +
            rubygems_version: 2.0.14
         | 
| 221 | 
            +
            signing_key: 
         | 
| 222 | 
            +
            specification_version: 4
         | 
| 223 | 
            +
            summary: Allows access to the Discourse API
         | 
| 224 | 
            +
            test_files:
         | 
| 225 | 
            +
            - spec/discourse_api/api/categories_spec.rb
         | 
| 226 | 
            +
            - spec/discourse_api/api/search_spec.rb
         | 
| 227 | 
            +
            - spec/discourse_api/api/topics_spec.rb
         | 
| 228 | 
            +
            - spec/discourse_api/api/users_spec.rb
         | 
| 229 | 
            +
            - spec/discourse_api/client_spec.rb
         | 
| 230 | 
            +
            - spec/fixtures/categories.json
         | 
| 231 | 
            +
            - spec/fixtures/hot.json
         | 
| 232 | 
            +
            - spec/fixtures/latest.json
         | 
| 233 | 
            +
            - spec/fixtures/new.json
         | 
| 234 | 
            +
            - spec/fixtures/search.json
         | 
| 235 | 
            +
            - spec/fixtures/topic.json
         | 
| 236 | 
            +
            - spec/fixtures/topics_created_by.json
         | 
| 237 | 
            +
            - spec/fixtures/user.json
         | 
| 238 | 
            +
            - spec/spec_helper.rb
         |