Created
October 3, 2008 21:01
-
-
Save mrjjwright/14643 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'httparty' | |
require 'digest' | |
USER = 'enter your username here' | |
PASS = 'Enter your password here' | |
SECRET = 'enter our secret here' | |
CLIENT = 'enter our inbox here' | |
class EffectiveUsers | |
include HTTParty | |
base_uri 'https://yammer.com/api/v1' | |
format :json | |
basic_auth USER, PASS | |
api_nonce = "#{rand(2**32)}:#{Time.now.to_i}" | |
api_digest = Digest::SHA1.hexdigest(api_nonce + ":" + SECRET) | |
headers = {'X-Yammer-Client' => CLIENT, 'X-Yammer-Client-Nonce' => api_nonce, 'X-Yammer-Client-Hexdigest' => api_digest} | |
def users(force=false) | |
return self.class.get('/users.json') | |
end | |
def user(id) | |
self.class.get('/users/' + id.to_s + ".json") | |
end | |
end | |
puts EffectiveUsers.new.users.inspect | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment