6

Screenshot / Code Snippet

An excerpt from the README:

First, initialize your client. You can omit the API key, but it's strongly recommended that you use one because it increases your request limit drastically. Also, any parameters that you pass on initialization will be passed with any request (but can be overridden later). It is recommended that you set the site this way.

require 'se/api'

cli = SE::API::Client.new(ENV['APIKey'], site: 'stackoverflow')

Now that you've initialized the client, you can use the instance methods provided:

Note: All the routes below pass **params directly to the API.

  • post(id, **params): Gets a post based on the ID passed.
  • posts(*ids, **params): Get posts based on either a semicolon delimited string of ids or an array of ids.
  • question(id, **params): Gets a question based on the ID passed.
  • questions(*ids, **params): Gets questions based on either a semicolon delimited string of ids or an array of ids.
  • answer(id, **params): Gets an answer based on the ID passed.
  • answers(*ids, **params): Gets answers based on either a semicolon delimited string of ids or an array of ids.
  • user(id, **params): Gets a user based on the ID passed.
  • users(*ids, **params): Gets users based on either a semicolon delimited string of ids or an array of ids.

About

I needed a gem for the Stack Exchange API for some chatbots I was working on, so I wrote this.

License

This project is released under the MIT License. Any contributions are welcome via pull requests. Feature requests can be made via issues or in chat.

Download

Although the library is published on rubygems, the version there will frequently be outdated. To keep up to date, please install from GitHub. The master branch should never be broken, so bundle update regularly. This is easy if you're using the bundler gem, you can just add the following line to your Gemfile:

gem 'se-api', git: 'https://github.com/thesecretmaster/se-api`, branch: 'master'

Platform

This library should work anywhere Ruby will run. That means definitely macOS/Linux, and possibly Windows.

Contact

If you are getting started, I know that documentation is poor, so please ping me in chat. I can be found in either of the two testing rooms for this library, Under the Bed and The Closet. Ping me whenever, and I should respond within 48 hours.

In addition, if you have any feature requests, ping me in chat. I would be more than happy to try to add functions you need or to help you better use the Ruby SE API.

Dependencies

  • MRI Ruby 2.5.0

0

You must log in to answer this question.

Browse other questions tagged .