Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bih/yo-ruby
🌈 ✨ A super awesome Ruby wrapper of the Yo API.
https://github.com/bih/yo-ruby
gem rspec ruby yo
Last synced: 13 days ago
JSON representation
🌈 ✨ A super awesome Ruby wrapper of the Yo API.
- Host: GitHub
- URL: https://github.com/bih/yo-ruby
- Owner: bih
- License: mit
- Created: 2014-07-21T20:12:04.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-03-21T13:58:10.000Z (over 8 years ago)
- Last Synced: 2024-10-31T09:41:47.873Z (20 days ago)
- Topics: gem, rspec, ruby, yo
- Language: Ruby
- Homepage: http://bilaw.al/the-unofficial-yo-api-for-ruby
- Size: 37.1 KB
- Stars: 15
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.markdown
- License: LICENSE.txt
Awesome Lists containing this project
README
![Yo for Ruby](http://i.imgur.com/N0L8m9P.png)
# Yo! API for Ruby (v1.0.0)
[![Build Status](https://travis-ci.org/bih/yo-ruby.svg?branch=master)](https://travis-ci.org/bih/yo-ruby)
[![Code Climate](https://codeclimate.com/github/bih/yo-ruby/badges/gpa.svg)](https://codeclimate.com/github/bih/yo-ruby)
[![Coverage Status](https://coveralls.io/repos/github/bih/yo-ruby/badge.svg?branch=master)](https://coveralls.io/github/bih/yo-ruby?branch=master)This is a Ruby API wrapper [that's fully tested](https://travis-ci.org/bih/yo-ruby). It works on Ruby 2.1 and above. This was originally written for the [Yo! hackathon in New York](http://www.eventbrite.com/e/yo-hackathon-nyc-2-letters-2-hours-ready-set-yo-tickets-12145608843?aff=eorg) (which I later won first place with [YoAuth](http://yoauth.herokuapp.com)).
### Installation
Do it through your terminal, yo.
```
$ gem install yo-ruby
```No? Stick it in your Gemfile, yo.
```
gem 'yo-ruby', '~> 1.0'
```### Documentation
Before using the Yo! API, you need to obtain a free [API key](http://dev.justyo.co/). It takes a few seconds.
**Required:** Now you need to include the library and set your API key.
```ruby
require 'yo-ruby'Yo::Configuration.setup do |config|
config.api_key = "[insert api key here]"
end# Alternatively: Yo::Configuration.api_key = "[insert api key here]"
```**Method:** Send a yo to someone
```ruby
yo = Yo.yo!("username")
yo.ok? # => true
```**Method:** Send a yo to someone with a URL
```ruby
yo = Yo.link!("username", "http://github.com/bih/yo-ruby")
yo.ok? # => true
```**Method:** Subscriber count
```ruby
Yo.subscribers
```**Method:** Send a yo to all your subscribers
```ruby
Yo.all!
```**Method:** Send a yo to all your subscribers with a URL (New)
```ruby
Yo.all!("http://github.com/bih/yo-ruby")
```### Lazy Documentation
```ruby
require 'sinatra'
require 'yo-ruby'Yo::Configuration.setup do |config|
config.api_key = "[insert api key here]"
endget '/yo/:username' do
yo = Yo.yo!(params[:username])
yo.ok?
endget '/yoall' do
yo = Yo.all!
yo.ok?
endget '/subscribers' do
puts "Subscribers: #{Yo.subscribers}"
end
```### Testing
This gem is fully tested and you can find all the tests in the `spec/yo-ruby/` folder.
You can also execute them by running the `rake` command.```
$ rake
```### Who made this?
[Bilawal Hameed](http://github.com/bih). Released freely under the [MIT License](http://bih.mit-license.org/).