Skip to content

Latest commit

 

History

History
89 lines (60 loc) · 2.14 KB

README.md

File metadata and controls

89 lines (60 loc) · 2.14 KB

Hey

A Ruby library for sending yo's from Yo.

github.com/jackjennings/hey

Gem Version Code Climate Build Status

Installation

gem install hey

Usage

First get an API token.

There are two ways of setting your API token and interacting with the library, depending on the requirements of you program. If you only need to work with a single API token, you can set it in an initializer or at the start of your script. If you set the API token this way, you can ineteract with either the class methods or the instance methods described below.

Hey.api_token = "3858f62230ac3c915f300c664312c63f"

If you need to use multiple API tokens, any hey class will accept an api_token on initialization.

Hey::Yo.new api_token: "3858f62230ac3c915f300c664312c63f"

An API token set when initializing an object takes precidence over the API token set on the Hey module.

Yo All

Sends a yo to all of the account's subscribers.

Hey::Yo.all
# or
yo = Hey::Yo.new api_token: "..."
yo.all

Accepts either link or location in a hash of parameters (optional).

Hey::Yo.all link: "https://github.com/jackjennings/hey"

Yo User

Sends a yo to a specific user.

Hey::Yo.user "WORLDCUP"
# or
yo = Hey::Yo.new api_token: "..."
yo.user "WORLDCUP"

Accepts either link or location in a hash of parameters (optional).

Hey::Yo.user "WORLDCUP" link: "https://github.com/jackjennings/hey"

Subscriber Count

Returns the number of subscribers.

Hey::Subscriber.count
# or
yo = Hey::Yo.new api_token: "3858f62230ac3c915f300c664312c63f"
yo.subscribers.count

Create Account

Creates a new Yo account.

Hey::Account.create "MYAPIACCOUNT", "********"
# or
yo = Hey::Yo.new api_token: "..."
yo.accounts.create "MYAPIACCOUNT", "********"

That's it!