A Ruby library for sending yo's from Yo.
gem install hey
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.
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"
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"
Returns the number of subscribers.
Hey::Subscriber.count
# or
yo = Hey::Yo.new api_token: "3858f62230ac3c915f300c664312c63f"
yo.subscribers.count
Creates a new Yo account.
Hey::Account.create "MYAPIACCOUNT", "********"
# or
yo = Hey::Yo.new api_token: "..."
yo.accounts.create "MYAPIACCOUNT", "********"
That's it!