Skip to content

Commit

Permalink
Added Cadmus support
Browse files Browse the repository at this point in the history
  • Loading branch information
pengwynn committed Apr 5, 2010
1 parent f60845c commit 3a9b96d
Show file tree
Hide file tree
Showing 4 changed files with 2,238 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/twitterland.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def self.url_info(url)

directory = File.expand_path(File.dirname(__FILE__))

require File.join(directory, 'twitterland', 'cadmus')
require File.join(directory, 'twitterland', 'zutual')
require File.join(directory, 'twitterland', 'autoff')
require File.join(directory, 'twitterland', 'foller_me')
Expand Down
23 changes: 23 additions & 0 deletions lib/twitterland/cadmus.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module Twitterland
class Cadmus
include HTTParty
base_uri 'http://thecadmus.com/api'
format :json

def self.posts(options={})
response = get("/posts", :query => options)
handle_response(response)
response.map{|p| Hashie::Mash.new(p)}
end

def self.handle_response(response)
case response.code.to_i
when 401
raise Twitterland::Unauthorized.new(response.body)
when 500
raise Twitterland::General.new(response.body)
end
end

end
end
Loading

0 comments on commit 3a9b96d

Please sign in to comment.