A object oriented wrapper for the StackExchange/StackOverflow API
Why such a strange name?
'Pilha' (pronounced peeleeah) means 'stack' in portuguese.
gem install pilha
Pilha aims to provide a ActiveRecord like interface for querying the StackExchange API.
include StackExchange::StackOverflow StackExchange::StackOverflow::Client.config do |options| options.api_key = 'your_key' #optional end Badge.all # returns all badges User.find_by_badge_id(2) # returns all users awarded by the badge identified with 'id'
As all response objects returned by Pilha are instances of OpenStruct, so you need to call the 'api_methods' on a desired class to see which methods of the OpenStruct were added by the gem.
Question.api_methods # => [:@struct, :question_id, :tags, :creation_date, :last_activity_date, :up_vote_count, :down_vote_count, :view_count, :score, :community_owned, :title, :body, :answers, :answer_count, :accepted_answer_id, :favorite_count, :question_timeline_url, :question_comments_url, :question_answers_url, :owner]
Michael Barton (http://github.com/michaelbarton) Thomas McDonald (http://github.com/conceptcoding)
(The MIT License)
Copyright © 2010-2011 Dalto Curvelano Junior
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.