From 6dcf4083a408829d40f327f12549a716d66f34b5 Mon Sep 17 00:00:00 2001 From: Isaiah Zwick-Schachter Date: Mon, 15 Jan 2018 11:05:50 -0500 Subject: [PATCH] Wrote README --- README.md | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 7c6360e..616529a 100644 --- a/README.md +++ b/README.md @@ -1,28 +1,46 @@ -# Se::Api +# SE API -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/se/api`. To experiment with that code, run `bin/console` for an interactive prompt. +SE API is a ruby gem for interacting with the Stack Exchange API. It was designed with the [SE Realtime Fee](https://stackexchange.com) in mind (specifically interactions through [se-realtime](https://github.com/izwick-schachter/se-realtime)), and therefore it will only work with four route subsets: -TODO: Delete this and the text above, and describe your gem +- `/users/{ids}` +- `/posts/{ids}` +- `/questions/{ids}` +- `/answers/{ids}` ## Installation -Add this line to your application's Gemfile: +While a version of this gem does exist in rubygems, it's recommended to use it from git. The master branch should always work. You can add it to your Gemfile with: ```ruby -gem 'se-api' +gem 'se-api', git: 'https://github.com/izwick-schachter/se-api.git', branch: 'master' ``` And then execute: $ bundle -Or install it yourself as: +## Usage - $ gem install se-api +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 paramters 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. -## Usage +```ruby +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. -TODO: Write usage instructions here +- `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. ## Development @@ -32,7 +50,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To ## Contributing -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/se-api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. +Bug reports and pull requests are welcome on GitHub at https://github.com/izwick-schachter/se-api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. ## License @@ -40,4 +58,4 @@ The gem is available as open source under the terms of the [MIT License](http:// ## Code of Conduct -Everyone interacting in the Se::Api project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/se-api/blob/master/CODE_OF_CONDUCT.md). +Everyone interacting in the Se::Api project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/izwick-schachter/se-api/blob/master/CODE_OF_CONDUCT.md).