rubyoverflow

rubyoverflow is a library for querying the Stack Overflow API

Configuration

Rubyoverflow::Client.config do |options|
  options.host = 'http://api.superuser.com' # optional, defaults to stackoverflow, queries super user
  options.api_key = 'api_key_here'  # optional, sets the api key
  options.version = '0.8' # optional, defaults to 0.8,sets the api version
end

Example

require 'rubyoverflow'
include Rubyoverflow
# Tags Example
tagsSet = Tags.retrieve_all({:sort=>'name',:order=>'asc',:pagesize=>'5'}) # gets the first 5 tags in alphabetical order by name
firstTag = tagsSet.tags.first # gets the first tag
secondTagSet = tagsSet.get_next_set #gets the next page of tags using the prior parameters
thirdTagSet = secondTagSet.get_next_set #gets the third page of tags using the prior parameters
puts firstTag.name # => tag's name
puts tag.count # => # of questions with tag

#User Example
me = Users.retrieve_by_id(53587).users.first  #gets me
myquestions = me.get_questions  #gets the questions I asked

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)

  • Send me a pull request. Bonus points for topic branches.

Copyright © 2010 phsr. See LICENSE for details.