Sha256: d33005fad3b167b9a98965c0fb3b1eeb5be19db8740087f143e217539f746055

Contents?: true

Size: 529 Bytes

Versions: 1

Compression:

Stored size: 529 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitterland-0.4.6 lib/twitterland/cadmus.rb