disqussion 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (83) hide show
  1. data/.gitignore +9 -0
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +80 -0
  4. data/HISTORY.mkd +5 -0
  5. data/LICENSE.mkd +20 -0
  6. data/README.mkd +139 -0
  7. data/Rakefile +23 -0
  8. data/disqussion.gemspec +37 -0
  9. data/lib/disqussion/api.rb +21 -0
  10. data/lib/disqussion/client/.DS_Store +0 -0
  11. data/lib/disqussion/client/applications.rb +20 -0
  12. data/lib/disqussion/client/blacklists.rb +4 -0
  13. data/lib/disqussion/client/categories.rb +4 -0
  14. data/lib/disqussion/client/exports.rb +4 -0
  15. data/lib/disqussion/client/forums.rb +122 -0
  16. data/lib/disqussion/client/imports.rb +4 -0
  17. data/lib/disqussion/client/posts.rb +217 -0
  18. data/lib/disqussion/client/reactions.rb +79 -0
  19. data/lib/disqussion/client/reports.rb +4 -0
  20. data/lib/disqussion/client/threads.rb +199 -0
  21. data/lib/disqussion/client/trends.rb +23 -0
  22. data/lib/disqussion/client/users.rb +103 -0
  23. data/lib/disqussion/client/utils.rb +90 -0
  24. data/lib/disqussion/client/whitelists.rb +4 -0
  25. data/lib/disqussion/client.rb +46 -0
  26. data/lib/disqussion/configuration.rb +121 -0
  27. data/lib/disqussion/connection.rb +36 -0
  28. data/lib/disqussion/error.rb +51 -0
  29. data/lib/disqussion/request.rb +38 -0
  30. data/lib/disqussion/version.rb +3 -0
  31. data/lib/disqussion/view_helpers.rb +9 -0
  32. data/lib/disqussion/widget.rb +183 -0
  33. data/lib/disqussion.rb +25 -0
  34. data/lib/faraday/response/raise_http_4xx.rb +41 -0
  35. data/lib/faraday/response/raise_http_5xx.rb +20 -0
  36. data/spec/disqussion/api_spec.rb +63 -0
  37. data/spec/disqussion/client/.DS_Store +0 -0
  38. data/spec/disqussion/client/applications_spec.rb +24 -0
  39. data/spec/disqussion/client/forums_spec.rb +80 -0
  40. data/spec/disqussion/client/posts_spec.rb +154 -0
  41. data/spec/disqussion/client/reactions_spec.rb +63 -0
  42. data/spec/disqussion/client/threads_spec.rb +128 -0
  43. data/spec/disqussion/client/trends_spec.rb +24 -0
  44. data/spec/disqussion/client/users_spec.rb +33 -0
  45. data/spec/disqussion/client_spec.rb +15 -0
  46. data/spec/disqussion_spec.rb +101 -0
  47. data/spec/faraday/response_spec.rb +30 -0
  48. data/spec/fixtures/applications/listUsage.json +129 -0
  49. data/spec/fixtures/forums/create.json +12 -0
  50. data/spec/fixtures/forums/details.json +12 -0
  51. data/spec/fixtures/forums/listCategories.json +21 -0
  52. data/spec/fixtures/forums/listPosts.json +859 -0
  53. data/spec/fixtures/forums/listThreads.json +533 -0
  54. data/spec/fixtures/posts/approve.json +6 -0
  55. data/spec/fixtures/posts/create.json +6 -0
  56. data/spec/fixtures/posts/details.json +35 -0
  57. data/spec/fixtures/posts/highlight.json +6 -0
  58. data/spec/fixtures/posts/list.json +247 -0
  59. data/spec/fixtures/posts/remove.json +6 -0
  60. data/spec/fixtures/posts/report.json +6 -0
  61. data/spec/fixtures/posts/restore.json +6 -0
  62. data/spec/fixtures/posts/spam.json +6 -0
  63. data/spec/fixtures/posts/unhighlight.json +6 -0
  64. data/spec/fixtures/posts/vote.json +6 -0
  65. data/spec/fixtures/reactions/domains.json +4 -0
  66. data/spec/fixtures/reactions/ips.json +131 -0
  67. data/spec/fixtures/reactions/threads.json +4 -0
  68. data/spec/fixtures/reactions/users.json +124 -0
  69. data/spec/fixtures/threads/close.json +4 -0
  70. data/spec/fixtures/threads/create.json +22 -0
  71. data/spec/fixtures/threads/details.json +24 -0
  72. data/spec/fixtures/threads/list.json +531 -0
  73. data/spec/fixtures/threads/listMostLiked.json +530 -0
  74. data/spec/fixtures/threads/listPosts.json +87 -0
  75. data/spec/fixtures/threads/open.json +8 -0
  76. data/spec/fixtures/threads/remove.json +4 -0
  77. data/spec/fixtures/threads/restore.json +4 -0
  78. data/spec/fixtures/threads/vote.json +4 -0
  79. data/spec/fixtures/trends/listTreads.json +283 -0
  80. data/spec/fixtures/users/details.json +19 -0
  81. data/spec/fixtures/users/follow.json +4 -0
  82. data/spec/helper.rb +47 -0
  83. metadata +348 -0
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ coverage/
2
+ .DS_Store
3
+ .bundle/
4
+ log/*.log
5
+ pkg/
6
+ doc/*
7
+ .yardcache/*
8
+ .yardoc/*
9
+ spec/.DS_Store
data/Gemfile ADDED
@@ -0,0 +1,3 @@
1
+ source :gemcutter
2
+
3
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,80 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ disqussion (0.0.1)
5
+ faraday (~> 0.6.1)
6
+ faraday_middleware (~> 0.6.3)
7
+ hashie (~> 1.0.0)
8
+ multi_json (~> 1.0.0)
9
+ rash (~> 0.3.0)
10
+
11
+ GEM
12
+ remote: http://rubygems.org/
13
+ specs:
14
+ ZenTest (4.5.0)
15
+ addressable (2.2.5)
16
+ archive-tar-minitar (0.5.2)
17
+ columnize (0.3.2)
18
+ crack (0.1.8)
19
+ diff-lcs (1.1.2)
20
+ faraday (0.6.1)
21
+ addressable (~> 2.2.4)
22
+ multipart-post (~> 1.1.0)
23
+ rack (< 2, >= 1.1.0)
24
+ faraday_middleware (0.6.3)
25
+ faraday (~> 0.6.0)
26
+ hashie (1.0.0)
27
+ json (1.5.1)
28
+ linecache19 (0.5.12)
29
+ ruby_core_source (>= 0.1.4)
30
+ maruku (0.6.0)
31
+ syntax (>= 1.0.0)
32
+ multi_json (1.0.1)
33
+ multipart-post (1.1.0)
34
+ nokogiri (1.4.4)
35
+ rack (1.2.2)
36
+ rake (0.8.7)
37
+ rash (0.3.0)
38
+ hashie (~> 1.0.0)
39
+ rspec (2.5.0)
40
+ rspec-core (~> 2.5.0)
41
+ rspec-expectations (~> 2.5.0)
42
+ rspec-mocks (~> 2.5.0)
43
+ rspec-core (2.5.2)
44
+ rspec-expectations (2.5.0)
45
+ diff-lcs (~> 1.1.2)
46
+ rspec-mocks (2.5.0)
47
+ ruby-debug-base19 (0.11.25)
48
+ columnize (>= 0.3.1)
49
+ linecache19 (>= 0.5.11)
50
+ ruby_core_source (>= 0.1.4)
51
+ ruby-debug19 (0.11.6)
52
+ columnize (>= 0.3.1)
53
+ linecache19 (>= 0.5.11)
54
+ ruby-debug-base19 (>= 0.11.19)
55
+ ruby_core_source (0.1.5)
56
+ archive-tar-minitar (>= 0.5.2)
57
+ simplecov (0.4.2)
58
+ simplecov-html (~> 0.4.4)
59
+ simplecov-html (0.4.4)
60
+ syntax (1.0.0)
61
+ webmock (1.6.2)
62
+ addressable (>= 2.2.2)
63
+ crack (>= 0.1.7)
64
+ yard (0.6.8)
65
+
66
+ PLATFORMS
67
+ ruby
68
+
69
+ DEPENDENCIES
70
+ ZenTest (~> 4.5)
71
+ disqussion!
72
+ json (~> 1.5)
73
+ maruku (~> 0.6)
74
+ nokogiri (~> 1.4)
75
+ rake (~> 0.8)
76
+ rspec (~> 2.5)
77
+ ruby-debug19
78
+ simplecov (~> 0.4)
79
+ webmock (~> 1.6)
80
+ yard (~> 0.6)
data/HISTORY.mkd ADDED
@@ -0,0 +1,5 @@
1
+ HISTORY
2
+ =======
3
+ 0.0.1 - May 10, 2011
4
+ ----------------------
5
+ * First release
data/LICENSE.mkd ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Jérémy Van de Wyngaert
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.mkd ADDED
@@ -0,0 +1,139 @@
1
+ The Disqussion Ruby Gem
2
+ ====================
3
+ A Ruby wrapper for the Disqus API
4
+
5
+ IMPORTANT: This gem is non-usable for production, beta version expected on May 9th 2011
6
+
7
+ Installation
8
+ ------------
9
+ ``` sh
10
+ gem install disqussion
11
+ ```
12
+
13
+ Documentation
14
+ -------------
15
+ <http://rdoc.info/gems/disqussion>
16
+
17
+ Does your project or organization use this gem?
18
+ -----------------------------------------------
19
+ Add it to the [apps](http://github.com/jeremyvdw/disqussion/wiki/apps) wiki!
20
+
21
+ Continuous Integration
22
+ ----------------------
23
+ [![Build Status](http://travis-ci.org/jeremyvdw/disqussion.png)](http://travis-ci.org/jeremyvdw/disqussion)
24
+
25
+ What's in 0.1?
26
+ ------------------
27
+
28
+ The error classes are consistent with [Disqus's documented response codes](http://disqus.com/api/docs/errors/).
29
+ Error details from Disqus API are encapsulated in HTTP response.
30
+
31
+ <table>
32
+ <thead>
33
+ <tr>
34
+ <th>Response Code</th>
35
+ <th>Error</th>
36
+ </tr>
37
+ </thead>
38
+ <tbody>
39
+ <tr>
40
+ <td><tt>400</tt></td>
41
+ <td><tt>Disqussion::BadRequest</tt></td>
42
+ </tr>
43
+ <tr>
44
+ <td><tt>401</tt></td>
45
+ <td><tt>Disqussion::Unauthorized</tt></td>
46
+ </tr>
47
+ <tr>
48
+ <td><tt>403</tt></td>
49
+ <td><tt>Disqussion::Forbidden</tt></td>
50
+ </tr>
51
+ <tr>
52
+ <td><tt>404</tt></td>
53
+ <td><tt>Disqussion::NotFound</tt></td>
54
+ </tr>
55
+ <tr>
56
+ <td><tt>500</tt></td>
57
+ <td><tt>Disqussion::InternalServerError</tt></td>
58
+ </tr>
59
+ </tbody>
60
+ </table>
61
+
62
+ Here are a few reasons use (and improve) this gem:
63
+
64
+ * Full Ruby 1.9 compatibility: All code and specs now work in the latest version of Ruby
65
+ * Support for HTTP proxies
66
+ * Support for multiple HTTP adapters: NetHttp (default), em-net-http (async), Typhoeus, Patron, or ActionDispatch
67
+ * SSL: On by default for increased [speed](http://gist.github.com/652330) and security
68
+
69
+ Help! I'm getting: "Did not recognize your engine specification. Please specify either a symbol or a class. (RuntimeError)"
70
+ ---------------------------------------------------------------------------------------------------------------------------
71
+
72
+ If you're using the JSON request format (i.e., the default), you'll need to
73
+ explicitly require a JSON library. We recommend [yajl-ruby](http://github.com/brianmario/yajl-ruby).
74
+
75
+ Usage Examples
76
+ --------------
77
+ ``` ruby
78
+ require "rubygems"
79
+ require "disqussion"
80
+
81
+ # Certain methods require authentication. To get your Disqus credentials,
82
+ # register an app at http://disqus.com/api/applications/
83
+ Disqussion.configure do |config|
84
+ config.api_key = YOUR_API_KEY
85
+ config.api_secret = YOUR_API_SECRET
86
+ end
87
+
88
+ # Get an application's usage details
89
+ puts Disqussion::Client.applications.listUsage("the88")
90
+ ```
91
+
92
+ Contributing
93
+ ------------
94
+ In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help improve this project.
95
+
96
+ Here are some ways *you* can contribute:
97
+
98
+ * by using alpha, beta, and prerelease versions
99
+ * by reporting bugs
100
+ * by suggesting new features
101
+ * by writing or editing documentation
102
+ * by writing specifications
103
+ * by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace)
104
+ * by refactoring code
105
+ * by closing [issues](http://github.com/jeremyvdw/disqussion/issues)
106
+ * by reviewing patches
107
+
108
+ All contributors will be added to the [HISTORY](https://github.com/jeremyvdw/disqussion/blob/master/HISTORY.mkd)
109
+ file and will receive the respect and gratitude of the community.
110
+
111
+ Submitting an Issue
112
+ -------------------
113
+ We use the [GitHub issue tracker](http://github.com/jeremyvdw/disqussion/issues) to track bugs and
114
+ features. Before submitting a bug report or feature request, check to make sure it hasn't already
115
+ been submitted. You can indicate support for an existing issuse by voting it up. When submitting a
116
+ bug report, please include a [Gist](http://gist.github.com/) that includes a stack trace and any
117
+ details that may be necessary to reproduce the bug, including your gem version, Ruby version, and
118
+ operating system. Ideally, a bug report should include a pull request with failing specs.
119
+
120
+ Submitting a Pull Request
121
+ -------------------------
122
+ 1. Fork the project.
123
+ 2. Create a topic branch.
124
+ 3. Implement your feature or bug fix.
125
+ 4. Add documentation for your feature or bug fix.
126
+ 5. Run <tt>bundle exec rake doc:yard</tt>. If your changes are not 100% documented, go back to step 4.
127
+ 6. Add specs for your feature or bug fix.
128
+ 7. Run <tt>bundle exec rake spec</tt>. If your changes are not 100% covered, go back to step 6.
129
+ 8. Commit and push your changes.
130
+ 9. Submit a pull request. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version for some reason, please do so in a separate commit.)
131
+
132
+ Thanks
133
+ ------
134
+ This gem is based on the work by John Nunemaker, Wynn Netherland, Erik Michaels-Ober and Steve Richert on the [Twitter gem](http://github.com/jnunemaker/twitter)
135
+
136
+ Copyright
137
+ ---------
138
+ Copyright (c) 2011 Jérémy Van de Wyngaert.
139
+ See [LICENSE](https://github.com/jeremyvdw/disqussion/blob/master/LICENSE.mkd) for details.
data/Rakefile ADDED
@@ -0,0 +1,23 @@
1
+ require 'bundler'
2
+ Bundler::GemHelper.install_tasks
3
+
4
+ require 'rspec/core/rake_task'
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :test => :spec
8
+ task :default => :spec
9
+
10
+ namespace :doc do
11
+ require 'yard'
12
+ YARD::Rake::YardocTask.new do |task|
13
+ task.files = ['HISTORY.mkd', 'LICENSE.mkd', 'lib/**/*.rb']
14
+ task.options = [
15
+ '--protected',
16
+ '--output-dir', 'doc/yard',
17
+ '--tag', 'format:Supported formats',
18
+ '--tag', 'authenticated:Requires Authentication',
19
+ '--tag', 'rate_limited:Rate Limited',
20
+ '--markup', 'markdown',
21
+ ]
22
+ end
23
+ end
@@ -0,0 +1,37 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/disqussion/version', __FILE__)
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "disqussion"
6
+ s.version = Disqussion::VERSION.dup
7
+ s.platform = Gem::Platform::RUBY
8
+ s.authors = ["Jérémy Van de Wyngaert"]
9
+ s.email = ['jeremyvdw@gmail.com']
10
+ s.homepage = 'https://github.com/jeremyvdw/disqussion'
11
+ s.summary = %q{Disqus API v3 wrapper}
12
+ s.description = %q{Disqus API v3 wrapper}
13
+
14
+ s.rubyforge_project = "disqussion"
15
+
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
+ s.require_paths = ["lib"]
20
+
21
+ s.add_development_dependency('json', '~> 1.5')
22
+ s.add_development_dependency('nokogiri', '~> 1.4')
23
+ s.add_development_dependency('maruku', '~> 0.6')
24
+ s.add_development_dependency('rake', '~> 0.8')
25
+ s.add_development_dependency('rspec', '~> 2.5')
26
+ s.add_development_dependency('simplecov', '~> 0.4')
27
+ s.add_development_dependency('webmock', '~> 1.6')
28
+ s.add_development_dependency('yard', '~> 0.6')
29
+ s.add_development_dependency('ZenTest', '~> 4.5')
30
+ s.add_development_dependency('ruby-debug19')
31
+
32
+ s.add_runtime_dependency('hashie', '~> 1.0.0')
33
+ s.add_runtime_dependency('faraday', '~> 0.6.1')
34
+ s.add_runtime_dependency('faraday_middleware', '~> 0.6.3')
35
+ s.add_runtime_dependency('multi_json', '~> 1.0.0')
36
+ s.add_runtime_dependency('rash', '~> 0.3.0')
37
+ end
@@ -0,0 +1,21 @@
1
+ require 'disqussion/connection'
2
+ require 'disqussion/request'
3
+
4
+ module Disqussion
5
+ # @private
6
+ class API
7
+ # @private
8
+ attr_accessor *Configuration::VALID_OPTIONS_KEYS
9
+
10
+ # Creates a new API
11
+ def initialize(options={})
12
+ options = Disqussion.options.merge(options)
13
+ Configuration::VALID_OPTIONS_KEYS.each do |key|
14
+ send("#{key}=", options[key])
15
+ end
16
+ end
17
+
18
+ include Connection
19
+ include Request
20
+ end
21
+ end
Binary file
@@ -0,0 +1,20 @@
1
+ module Disqussion
2
+ class Applications < Client
3
+ # Returns the API usage per day for this application.
4
+ # @accessibility: public key, secret key
5
+ # @methods: GET
6
+ # @format: json, jsonp
7
+ # @authenticated: true
8
+ # @limited: false
9
+ # @return [Hashie::Rash] API usage per day for this application.
10
+ # @param application [Integer] Defaults to null
11
+ # @param days [Integer] Defaults to 30, Maximum length of 30
12
+ # @example Returns the API usage per day for this application.
13
+ # Disqussion::Client.applications.listUsage
14
+ # @see http://disqus.com/api/3.0/applications/listUsage.json
15
+ def listUsage(*args)
16
+ options = args.last.is_a?(Hash) ? args.pop : {}
17
+ get('applications/listUsage', options)
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,4 @@
1
+ module Disqussion
2
+ class Blacklists < Client
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Disqussion
2
+ class Categories < Client
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Disqussion
2
+ class Exports < Client
3
+ end
4
+ end
@@ -0,0 +1,122 @@
1
+ module Disqussion
2
+ class Forums < Client
3
+ # Creates a new forum.
4
+ # @accessibility: public key, secret key
5
+ # @methods: GET
6
+ # @format: json, jsonp
7
+ # @authenticated: true
8
+ # @limited: false
9
+ # @param website [String] Disqus website name.
10
+ # @param name [String] Forum name.
11
+ # @param short_name [String] Forum short name (aka forum id).
12
+ # @return [Hashie::Rash] New forum infos
13
+ # @example Creates a new forum 'myforum'
14
+ # Disqussion::Client.forums.create("the88", "My Forum", "myforum")
15
+ # @see: http://disqus.com/api/3.0/forums/create.json
16
+ def create(*args)
17
+ options = args.last.is_a?(Hash) ? args.pop : {}
18
+ if args.size == 3
19
+ options.merge!(:website => args[0], :name => args[1], :short_name => args[2])
20
+ response = get('forums/create', options)
21
+ else
22
+ puts "#{Kernel.caller.first}: forums.create expects 3 arguments: website, name, short_name"
23
+ end
24
+ end
25
+
26
+ # Returns forum details.
27
+ # @accessibility: public key, secret key
28
+ # @methods: GET
29
+ # @format: json, jsonp
30
+ # @authenticated: false
31
+ # @limited: false
32
+ # @param forum [String] Forum ID (aka short name).
33
+ # @return [Hashie::Rash] Details on the requested forum.
34
+ # @example Return extended information for forum 'myforum'
35
+ # Disqussion::Client.forums.details("myforum")
36
+ # @see: http://disqus.com/api/3.0/forums/details.json
37
+ def details(*args)
38
+ options = args.last.is_a?(Hash) ? args.pop : {}
39
+ options[:forum] = args.first
40
+ response = get('forums/details', options)
41
+ end
42
+
43
+ # Returns a list of categories within a forum.
44
+ # @accessibility: public key, secret key
45
+ # @methods: GET
46
+ # @format: json, jsonp
47
+ # @authenticated: false
48
+ # @limited: false
49
+ # @param forum [String] Forum ID (aka short name).
50
+ # @return [Hashie::Rash] Details on the requested list of categories.
51
+ # @param options [Hash] A customizable set of options.
52
+ # @option options [Datetime, Timestamp] :since. Unix timestamp (or ISO datetime standard). Defaults to null
53
+ # @option options [Integer] :cursor. Defaults to null
54
+ # @option options [Integer] :limit. Defaults to 25. Maximum length of 100
55
+ # @option options [String] :order. Defaults to "asc". Choices: asc, desc
56
+ # @example Return extended information for forum 'myforum'
57
+ # Disqussion::Client.forums.listCategories("myforum", {:cursor => 10, :limit => 10, :order => 'asc'})
58
+ # @see: http://disqus.com/api/3.0/forums/details.json
59
+ def listCategories(*args)
60
+ options = args.last.is_a?(Hash) ? args.pop : {}
61
+ options[:forum] = args.first
62
+ response = get('forums/listCategories', options)
63
+ end
64
+
65
+ # NOTE: to be implemented
66
+ # Returns a list of users active within a forum ordered by most likes received.
67
+ # @see: http://disqus.com/api/3.0/forums/listMostLikedUsers.json
68
+ def listMostLikedUsers(*args)
69
+ end
70
+
71
+ # Returns a list of posts within a forum.
72
+ # @accessibility: public key, secret key
73
+ # @methods: GET
74
+ # @format: json, jsonp, rss
75
+ # @authenticated: false
76
+ # @limited: false
77
+ # @param forum [String] Forum ID (aka short name).
78
+ # @return [Hashie::Rash] Details on the list of posts.
79
+ # @param options [Hash] A customizable set of options.
80
+ # @option options [Datetime, Timestamp] :since. Defaults to null. Unix timestamp (or ISO datetime standard).
81
+ # @option options [Integer, String] :related. Allows multiple. Defaults to []. You may specify relations to include with your response. Choices: thread.
82
+ # @option options [Integer] :cursor. Defaults to null
83
+ # @option options [Integer] :limit. Defaults to 25. Maximum number of posts to return. Maximum length of 100
84
+ # @option options [Integer] :query. Defaults to null.
85
+ # @option options [String, Array] :include allows multiple. Defaults to ["approved"]. Choices: unapproved, approved, spam, deleted, flagged
86
+ # @option options [String] :order. Defaults to "desc". Choices: asc, desc
87
+ # @example Return list of (all) posts for forum 'myforum', including related threads
88
+ # Disqussion::Client.forums.listPosts("myforum", {:related => ["thread"], :include => ["spam", "deleted", "flagged"]})
89
+ # @see: http://disqus.com/api/3.0/forums/listPosts.json
90
+ def listPosts(*args)
91
+ options = args.last.is_a?(Hash) ? args.pop : {}
92
+ options[:forum] = args.first
93
+ response = get('forums/listPosts', options)
94
+ end
95
+
96
+ # Returns a list of threads within a forum.
97
+ # @accessibility: public key, secret key
98
+ # @methods: GET
99
+ # @format: json, jsonp, rss
100
+ # @authenticated: false
101
+ # @limited: false
102
+ # @param forum [String] Forum ID (aka short name).
103
+ # @return [Hashie::Rash] Details on the list of posts.
104
+ # @param options [Hash] A customizable set of options.
105
+ # @option options [Integer, String, Array] :thread. Allows multiple. Defaults to null. Looks up a thread by ID. You may pass use the 'ident' or 'link' query types instead of an ID by including 'forum'
106
+ # @option options [Datetime, Timestamp] :since. Unix timestamp (or ISO datetime standard). Defaults to null
107
+ # @option options [Integer, String] :related. Allows multiple. Defaults to []. You may specify relations to include with your response. Choices: forum, author.
108
+ # @option options [Integer] :cursor. Defaults to null
109
+ # @option options [Integer] :limit. Defaults to 25. Maximum length of 100
110
+ # @option options [String, Array] :include allows multiple. Defaults to ["open", "close"]. Choices: open, closed, killed.
111
+ # @option options [String] :order. Defaults to "desc". Choices: asc, desc
112
+ # @example Return list of (all) threads for forum 'myforum', including closed ones and related forums.
113
+ # Disqussion::Client.forums.listThreads("myforum", {:related => ["forum"], :include => ["close"]})
114
+ # @see: http://disqus.com/api/3.0/forums/listThreads.json
115
+ def listThreads(*args)
116
+ options = args.last.is_a?(Hash) ? args.pop : {}
117
+ options[:forum] = args.first
118
+ response = get('forums/listThreads', options)
119
+ end
120
+
121
+ end
122
+ end
@@ -0,0 +1,4 @@
1
+ module Disqussion
2
+ class Imports < Client
3
+ end
4
+ end