Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
69 lines (41 sloc) 2.34 KB
= Yammer4R
== Developers
* {Jim Patterson} <jpatterson at yammer-inc dot com>
* {Jason Stewart}
* {Peter Moran}
*Addendum
* {Tom Meier} <tom at venombytes dot com>
== Description
Yammer4R provides an object based API to query or update your Yammer account via pure Ruby. It hides the ugly HTTP/REST code from your code.
== External Dependencies
* Ruby 1.8 (tested with 1.8.7)
* JSON gem (tested with versions: 1.4.6)
* OAuth gem (tested with versions: 0.4.4)
* RSpec gem (tested with versions: 1.1.11 - 2.4.0)
* Tested and working on Rails 3.0.3
== Usage Examples
grab the saved config file (see oauth.yml.template)
config_path = File.join(repo_location, 'config', 'yammer_oauth.yml')
instantiate the yammer client
yammer = Yammer::Client.new(:config => config_path)
=== Posting a message to a specific group
A quick way to find out a group id (without updating this gem to do group queries - see API doc) is to go to the Yammer page for the group and see the 'feedId' parameter in the url.
yammer.message(:post, {:group_id => 'YourGroupId', :body => 'Some Text'})
=== Using a custom resource under 'messages'
yammer.messages(:all, {:resource => 'messages/sent'}) #All sent messages
yammer.messages(:all, {:resource => 'messages/received'}) #All received messages
yammer.messages(:all, {:resource => 'messages/from_user/CHANGE_ID'}) #All messages by a certain user
yammer.messages(:all, {:resource => 'messages/in_group/CHANGE_ID'}) #All messages in a certain group
See API doc for more possibilities, just set 'resource' accordingly to match the end point given in the api.
=== Deleting a message
yammer.messages(:delete, {:resource => 'messages/MESSAGE_ID'})
=== Assigning a proxy address
==== standard proxy
yammer = Yammer::Client.new(:config => config_path, :proxy => 'http://proxy.somehost.com:3128/')
==== user/pass proxy
yammer = Yammer::Client.new(:config => config_path, :proxy => 'http://user_name:some_password@proxy.somehost.com:3128/')
== TODO
* Write specs for everything!
* Expose all the API endpoints, seriously, this is all I need now, but nothing else is exposed. See : https://www.yammer.com/api_doc.html
* Improve client.rb messages, should be modular.
* Improve how resource is set, ie: it shouldn't need /messages/ sent to a messages method. But not sure how much this API is changed. Left for now.