Skip to content

Instantly share code, notes, and snippets.

@mrjjwright
Created October 3, 2008 21:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrjjwright/14643 to your computer and use it in GitHub Desktop.
Save mrjjwright/14643 to your computer and use it in GitHub Desktop.
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