forked from jstewart/yammer4r
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README
69 lines (41 loc) · 2.34 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
= 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.