This repository has been archived by the owner on Feb 18, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First commit: import project. Largely inspired by the Twitter gem fro…
…m John Nunemaker, Wynn Netherland, Erik Michaels-Ober and Steve Richert.
- Loading branch information
0 parents
commit 7cbc608
Showing
50 changed files
with
3,213 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source :gemcutter | ||
|
||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
disqussion (0.0.1) | ||
faraday (~> 0.6.1) | ||
faraday_middleware (~> 0.6.3) | ||
hashie (~> 1.0.0) | ||
multi_json (~> 1.0.0) | ||
rash (~> 0.3.0) | ||
simple_oauth (~> 0.1.4) | ||
|
||
GEM | ||
remote: http://rubygems.org/ | ||
specs: | ||
ZenTest (4.5.0) | ||
addressable (2.2.5) | ||
archive-tar-minitar (0.5.2) | ||
columnize (0.3.2) | ||
crack (0.1.8) | ||
diff-lcs (1.1.2) | ||
faraday (0.6.1) | ||
addressable (~> 2.2.4) | ||
multipart-post (~> 1.1.0) | ||
rack (< 2, >= 1.1.0) | ||
faraday_middleware (0.6.3) | ||
faraday (~> 0.6.0) | ||
hashie (1.0.0) | ||
json (1.5.1) | ||
linecache19 (0.5.12) | ||
ruby_core_source (>= 0.1.4) | ||
maruku (0.6.0) | ||
syntax (>= 1.0.0) | ||
multi_json (1.0.1) | ||
multipart-post (1.1.0) | ||
nokogiri (1.4.4) | ||
rack (1.2.2) | ||
rake (0.8.7) | ||
rash (0.3.0) | ||
hashie (~> 1.0.0) | ||
rspec (2.5.0) | ||
rspec-core (~> 2.5.0) | ||
rspec-expectations (~> 2.5.0) | ||
rspec-mocks (~> 2.5.0) | ||
rspec-core (2.5.2) | ||
rspec-expectations (2.5.0) | ||
diff-lcs (~> 1.1.2) | ||
rspec-mocks (2.5.0) | ||
ruby-debug-base19 (0.11.25) | ||
columnize (>= 0.3.1) | ||
linecache19 (>= 0.5.11) | ||
ruby_core_source (>= 0.1.4) | ||
ruby-debug19 (0.11.6) | ||
columnize (>= 0.3.1) | ||
linecache19 (>= 0.5.11) | ||
ruby-debug-base19 (>= 0.11.19) | ||
ruby_core_source (0.1.5) | ||
archive-tar-minitar (>= 0.5.2) | ||
simple_oauth (0.1.4) | ||
simplecov (0.4.2) | ||
simplecov-html (~> 0.4.4) | ||
simplecov-html (0.4.4) | ||
syntax (1.0.0) | ||
webmock (1.6.2) | ||
addressable (>= 2.2.2) | ||
crack (>= 0.1.7) | ||
yard (0.6.8) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
ZenTest (~> 4.5) | ||
disqussion! | ||
json (~> 1.5) | ||
maruku (~> 0.6) | ||
nokogiri (~> 1.4) | ||
rake (~> 0.8) | ||
rspec (~> 2.5) | ||
ruby-debug19 | ||
simplecov (~> 0.4) | ||
webmock (~> 1.6) | ||
yard (~> 0.6) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
HISTORY | ||
======= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Copyright (c) 2011 Jérémy Van de Wyngaert | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining | ||
a copy of this software and associated documentation files (the | ||
"Software"), to deal in the Software without restriction, including | ||
without limitation the rights to use, copy, modify, merge, publish, | ||
distribute, sublicense, and/or sell copies of the Software, and to | ||
permit persons to whom the Software is furnished to do so, subject to | ||
the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be | ||
included in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | ||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | ||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND | ||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE | ||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION | ||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | ||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,147 @@ | ||
The Disqussion Ruby Gem | ||
==================== | ||
A Ruby wrapper for the Disqus API | ||
|
||
Installation | ||
------------ | ||
``` sh | ||
gem install disqussion | ||
``` | ||
|
||
Documentation | ||
------------- | ||
<http://rdoc.info/gems/twitter> | ||
|
||
Does your project or organization use this gem? | ||
----------------------------------------------- | ||
Add it to the [apps](http://github.com/jeremyvdw/disqussion/wiki/apps) wiki! | ||
|
||
Continuous Integration | ||
---------------------- | ||
[![Build Status](http://travis-ci.org/jnunemaker/twitter.png)](http://travis-ci.org/jnunemaker/twitter) | ||
|
||
What's in 0.1? | ||
------------------ | ||
|
||
|
||
``` | ||
The error classes have gone through a transformation to make them consistent with [Disqus's documented response codes](http://disqus.com/api/docs/errors/). These changes should make it easier to rescue from specific errors and take action accordingly. We've also added support for two new classes of error. | ||
<table> | ||
<thead> | ||
<tr> | ||
<th>Response Code</th> | ||
<th>Error</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td><tt>400</tt></td> | ||
<td><tt>Disqus::</tt></td> | ||
</tr> | ||
<tr> | ||
<td><tt>401</tt></td> | ||
<td><tt>Disqus::</tt></td> | ||
</tr> | ||
<tr> | ||
<td><tt>403</tt></td> | ||
<td><tt>Disqus::</tt></td> | ||
</tr> | ||
<tr> | ||
<td><tt>404</tt></td> | ||
<td><tt>Disqus::NotFound</tt></td> | ||
</tr> | ||
<tr> | ||
<td><tt>500</tt></td> | ||
<td><tt>Disqus::InternalServerError</tt></td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
Here are a few reasons use (and improve) this gem: | ||
* Full Ruby 1.9 compatibility: All code and specs now work in the latest version of Ruby | ||
* Support for HTTP proxies: Access Disqus from China, Iran, or inside your office firewall | ||
* Support for multiple HTTP adapters: NetHttp (default), em-net-http, Typhoeus, Patron, or ActionDispatch | ||
* SSL: On by default for increased [speed](http://gist.github.com/652330) and security | ||
* Improved error handling: More easily rescue from rate-limit errors or fail whales | ||
Help! I'm getting: "Did not recognize your engine specification. Please specify either a symbol or a class. (RuntimeError)" | ||
--------------------------------------------------------------------------------------------------------------------------- | ||
If you're using the JSON request format (i.e., the default), you'll need to | ||
explicitly require a JSON library. We recommend [yajl-ruby](http://github.com/brianmario/yajl-ruby). | ||
Usage Examples | ||
-------------- | ||
``` ruby | ||
require "rubygems" | ||
require "disqussion" | ||
# Get a user's details | ||
puts Disqussion.details("the88").url | ||
# Certain methods require authentication. To get your Disqus credentials, | ||
# register an app at http://disqus.com/api/applications/ | ||
Disqussion.configure do |config| | ||
config.api_key = YOUR_API_KEY | ||
config.api_secret = YOUR_API_SECRET | ||
end | ||
# Read the most recent tweet in your home timeline | ||
puts Disqussion.home_timeline.first.text | ||
# Who's your most popular friend? | ||
puts Disqussion.friends.users.sort{|a, b| a.followers_count <=> b.followers_count}.reverse.first.name | ||
# Who's your most popular follower? | ||
puts Disqussion.followers.users.sort{|a, b| a.followers_count <=> b.followers_count}.reverse.first.name | ||
# Get your rate limit status | ||
puts Disqussion.rate_limit_status.remaining_hits.to_s + " Disqussion API request(s) remaining this hour" | ||
``` | ||
|
||
Contributing | ||
------------ | ||
In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help improve this project. | ||
|
||
Here are some ways *you* can contribute: | ||
|
||
* by using alpha, beta, and prerelease versions | ||
* by reporting bugs | ||
* by suggesting new features | ||
* by writing or editing documentation | ||
* by writing specifications | ||
* by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace) | ||
* by refactoring code | ||
* by closing [issues](http://github.com/jeremyvdw/disqussion/issues) | ||
* by reviewing patches | ||
|
||
All contributors will be added to the [HISTORY](https://github.com/jeremyvdw/disqussion/blob/master/HISTORY.mkd) | ||
file and will receive the respect and gratitude of the community. | ||
|
||
Submitting an Issue | ||
------------------- | ||
We use the [GitHub issue tracker](http://github.com/jeremyvdw/disqussion/issues) to track bugs and | ||
features. Before submitting a bug report or feature request, check to make sure it hasn't already | ||
been submitted. You can indicate support for an existing issuse by voting it up. When submitting a | ||
bug report, please include a [Gist](http://gist.github.com/) that includes a stack trace and any | ||
details that may be necessary to reproduce the bug, including your gem version, Ruby version, and | ||
operating system. Ideally, a bug report should include a pull request with failing specs. | ||
|
||
Submitting a Pull Request | ||
------------------------- | ||
1. Fork the project. | ||
2. Create a topic branch. | ||
3. Implement your feature or bug fix. | ||
4. Add documentation for your feature or bug fix. | ||
5. Run <tt>bundle exec rake doc:yard</tt>. If your changes are not 100% documented, go back to step 4. | ||
6. Add specs for your feature or bug fix. | ||
7. Run <tt>bundle exec rake spec</tt>. If your changes are not 100% covered, go back to step 6. | ||
8. Commit and push your changes. | ||
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.) | ||
|
||
Copyright | ||
--------- | ||
Copyright (c) 2011 Jérémy Van de Wyngaert. | ||
See [LICENSE](https://github.com/jeremyvdw/disqussion/blob/master/LICENSE.mkd) for details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
require 'bundler' | ||
Bundler::GemHelper.install_tasks | ||
|
||
require 'rspec/core/rake_task' | ||
RSpec::Core::RakeTask.new(:spec) | ||
|
||
task :test => :spec | ||
task :default => :spec | ||
|
||
namespace :doc do | ||
require 'yard' | ||
YARD::Rake::YardocTask.new do |task| | ||
task.files = ['HISTORY.mkd', 'LICENSE.mkd', 'lib/**/*.rb'] | ||
task.options = [ | ||
'--protected', | ||
'--output-dir', 'doc/yard', | ||
'--tag', 'format:Supported formats', | ||
'--tag', 'authenticated:Requires Authentication', | ||
'--tag', 'rate_limited:Rate Limited', | ||
'--markup', 'markdown', | ||
] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# -*- encoding: utf-8 -*- | ||
require File.expand_path('../lib/disqussion/version', __FILE__) | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "disqussion" | ||
s.version = Disqussion::VERSION.dup | ||
s.platform = Gem::Platform::RUBY | ||
s.authors = ["Jérémy Van de Wyngaert"] | ||
s.email = ['jeremyvdw@gmail.com'] | ||
s.homepage = 'https://github.com/jeremyvdw/disqussion' | ||
s.summary = %q{Disqus API v3 wrapper} | ||
s.description = %q{Disqus API v3 wrapper} | ||
|
||
s.rubyforge_project = "disqussion" | ||
|
||
s.files = `git ls-files`.split("\n") | ||
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") | ||
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } | ||
s.require_paths = ["lib"] | ||
|
||
s.add_development_dependency('json', '~> 1.5') | ||
s.add_development_dependency('nokogiri', '~> 1.4') | ||
s.add_development_dependency('maruku', '~> 0.6') | ||
s.add_development_dependency('rake', '~> 0.8') | ||
s.add_development_dependency('rspec', '~> 2.5') | ||
s.add_development_dependency('simplecov', '~> 0.4') | ||
s.add_development_dependency('webmock', '~> 1.6') | ||
s.add_development_dependency('yard', '~> 0.6') | ||
s.add_development_dependency('ZenTest', '~> 4.5') | ||
s.add_development_dependency('ruby-debug19') | ||
|
||
s.add_runtime_dependency('hashie', '~> 1.0.0') | ||
s.add_runtime_dependency('faraday', '~> 0.6.1') | ||
s.add_runtime_dependency('faraday_middleware', '~> 0.6.3') | ||
s.add_runtime_dependency('multi_json', '~> 1.0.0') | ||
s.add_runtime_dependency('rash', '~> 0.3.0') | ||
s.add_runtime_dependency('simple_oauth', '~> 0.1.4') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'disqussion/error' | ||
require 'disqussion/configuration' | ||
require 'disqussion/api' | ||
require 'disqussion/client' | ||
|
||
module Disqussion | ||
extend Configuration | ||
|
||
# Alias for Disqussion::Client.new | ||
# | ||
# @return [Disqussion::Client] | ||
def self.client(options={}) | ||
Disqussion::Client.new(options) | ||
end | ||
|
||
# Delegate to Disqussion::Client | ||
def self.method_missing(method, *args, &block) | ||
return super unless client.respond_to?(method) | ||
client.send(method, *args, &block) | ||
end | ||
|
||
def self.respond_to?(method, include_private = false) | ||
client.respond_to?(method, include_private) || super(method, include_private) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require 'disqussion/connection' | ||
require 'disqussion/request' | ||
|
||
module Disqussion | ||
# @private | ||
class API | ||
# @private | ||
attr_accessor *Configuration::VALID_OPTIONS_KEYS | ||
|
||
# Creates a new API | ||
def initialize(options={}) | ||
options = Disqussion.options.merge(options) | ||
Configuration::VALID_OPTIONS_KEYS.each do |key| | ||
send("#{key}=", options[key]) | ||
end | ||
end | ||
|
||
include Connection | ||
include Request | ||
end | ||
end |
Oops, something went wrong.