Sha256: 74be5d9fd0779996b05a96e8b1b16d4d6e9f32764652313c534d0847ed5e132c
Contents?: true
Size: 967 Bytes
Versions: 1
Compression:
Stored size: 967 Bytes
Contents
require 'yo_client/version' require 'faraday' require 'faraday_middleware' module YoClient class Client # Constructor # @param [String] token Yo API Token def initialize(api_token) @api_token = api_token @faraday = Faraday.new(url: 'http://api.justyo.co') do |faraday| faraday.request :url_encoded faraday.response :json faraday.adapter :net_http end end # Yo to all subscribers def yoall @faraday.post '/yoall/', token_hash end # Yo to specific user # @param [String] username def yo(username) @faraday.post '/yo/', token_hash.merge(username: username.upcase) end # Get a number of subscribers # @return [Integer] number of subscribers def subscribers_count response = @faraday.get '/subscribers_count/', token_hash response.body['result'] end private def token_hash { api_token: @api_token } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
yo_client-0.0.2 | lib/yo_client.rb |