yammer-client 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. data/.gitignore +29 -0
  2. data/.travis.yml +9 -0
  3. data/.yardopts +10 -0
  4. data/CHANGELOG.md +0 -0
  5. data/Gemfile +13 -0
  6. data/LICENSE.md +20 -0
  7. data/README.md +265 -0
  8. data/Rakefile +12 -0
  9. data/certs/tiabas-public.pem +21 -0
  10. data/lib/yammer.rb +28 -0
  11. data/lib/yammer/api.rb +10 -0
  12. data/lib/yammer/api/autocomplete.rb +25 -0
  13. data/lib/yammer/api/group.rb +78 -0
  14. data/lib/yammer/api/group_membership.rb +32 -0
  15. data/lib/yammer/api/message.rb +196 -0
  16. data/lib/yammer/api/network.rb +21 -0
  17. data/lib/yammer/api/notification.rb +18 -0
  18. data/lib/yammer/api/search.rb +28 -0
  19. data/lib/yammer/api/thread.rb +23 -0
  20. data/lib/yammer/api/topic.rb +21 -0
  21. data/lib/yammer/api/user.rb +156 -0
  22. data/lib/yammer/client.rb +101 -0
  23. data/lib/yammer/configurable.rb +46 -0
  24. data/lib/yammer/error.rb +61 -0
  25. data/lib/yammer/http_connection.rb +184 -0
  26. data/lib/yammer/identity_map.rb +42 -0
  27. data/lib/yammer/model.rb +6 -0
  28. data/lib/yammer/model/base.rb +133 -0
  29. data/lib/yammer/model/group.rb +13 -0
  30. data/lib/yammer/model/group_membership.rb +11 -0
  31. data/lib/yammer/model/message.rb +17 -0
  32. data/lib/yammer/model/message_body.rb +13 -0
  33. data/lib/yammer/model/thread.rb +44 -0
  34. data/lib/yammer/model/user.rb +46 -0
  35. data/lib/yammer/response.rb +43 -0
  36. data/lib/yammer/version.rb +18 -0
  37. data/spec/api/autocomplete_spec.rb +23 -0
  38. data/spec/api/group_membership_spec.rb +30 -0
  39. data/spec/api/group_spec.rb +58 -0
  40. data/spec/api/message_spec.rb +118 -0
  41. data/spec/api/network_spec.rb +23 -0
  42. data/spec/api/notification_spec.rb +23 -0
  43. data/spec/api/search_spec.rb +23 -0
  44. data/spec/api/thread_spec.rb +23 -0
  45. data/spec/api/topic_spec.rb +23 -0
  46. data/spec/api/user_spec.rb +76 -0
  47. data/spec/client_spec.rb +208 -0
  48. data/spec/connection_spec.rb +280 -0
  49. data/spec/error_spec.rb +69 -0
  50. data/spec/fixtures/group.json +1 -0
  51. data/spec/fixtures/message.json +1 -0
  52. data/spec/fixtures/messages_in_thread.json +1 -0
  53. data/spec/fixtures/portal_thread.json +1 -0
  54. data/spec/fixtures/private_thread.json +1 -0
  55. data/spec/fixtures/public_thread.json +1 -0
  56. data/spec/fixtures/user.json +1 -0
  57. data/spec/identity_map_spec.rb +108 -0
  58. data/spec/model/base_spec.rb +155 -0
  59. data/spec/model/group_membership_spec.rb +27 -0
  60. data/spec/model/group_spec.rb +44 -0
  61. data/spec/model/message_spec.rb +45 -0
  62. data/spec/model/thread_spec.rb +66 -0
  63. data/spec/model/user_spec.rb +150 -0
  64. data/spec/response_spec.rb +66 -0
  65. data/spec/spec_helper.rb +42 -0
  66. data/yammer.gemspec +29 -0
  67. metadata +270 -0
@@ -0,0 +1,78 @@
1
+ module Yammer
2
+ module Api
3
+ module Group
4
+
5
+ # @see https://developer.yammer.com/restapi/#rest-groups
6
+ # @rate_limited Yes
7
+ # @authentication Requires user context
8
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
9
+ # @return [Yammer::Response]
10
+ # @param [Hash] opts the opts to fetch a thread with
11
+ # @option opts [Integer] :page
12
+ # @option opts [String] :sort_by sort groups by created_on, creator, name default order is by number of messages
13
+ # @option opts [String] :letter groups starting with letter
14
+ # @example Fetch all groups for authenticated user's network
15
+ # Yammer.all_groups
16
+ def all_groups(opts={})
17
+ get("/api/v1/groups", opts)
18
+ end
19
+
20
+ # @see https://developer.yammer.com/restapi/#rest-groups
21
+ # @rate_limited Yes
22
+ # @authentication Requires user context
23
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
24
+ # @return [Yammer::Response]
25
+ # @param id [Integer] the group ID
26
+ # @example Fetch data for the thread
27
+ # Yammer.get_group(74)
28
+ def get_group(id)
29
+ get("/api/v1/groups/#{id}")
30
+ end
31
+
32
+ # @see https://developer.yammer.com/restapi/#rest-groups
33
+ # @rate_limited Yes
34
+ # @authentication Requires user context
35
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
36
+ # @return [Yammer::Response]
37
+ # @param [Hash] opts the opts to fetch a thread with
38
+ # @option opts [String] :name
39
+ # @option opts [String] :description
40
+ # @option opts [Boolean] :private
41
+ # @option opts [Boolean] :show_in_directory
42
+ # @example Fetch data for the thread
43
+ # Yammer.create_group(74)
44
+ def create_group(opts={})
45
+ post("/api/v1/groups", opts)
46
+ end
47
+
48
+ # @see https://developer.yammer.com/restapi/#rest-groups
49
+ # @rate_limited Yes
50
+ # @authentication Requires user context
51
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
52
+ # @return [Yammer::Response]
53
+ # @param id [Integer] the group ID
54
+ # @param [Hash] opts
55
+ # @option opts [String] :name
56
+ # @option opts [String] :description
57
+ # @option opts [Boolean] :private
58
+ # @option opts [Boolean] :show_in_directory
59
+ # @example Fetch data for the thread
60
+ # Yammer.update_group(74, :name => "new group name")
61
+ def update_group(id, opts={})
62
+ post("/api/v1/groups/#{id}", opts)
63
+ end
64
+
65
+ # @see https://developer.yammer.com/restapi/#rest-groups
66
+ # @rate_limited Yes
67
+ # @authentication Requires user context
68
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
69
+ # @return [Yammer::Response]
70
+ # @param id [Integer] the group ID
71
+ # @example Fetch data for the thread
72
+ # Yammer.groups_for_user(74)
73
+ def groups_for_user(id)
74
+ get("/api/v1/groups/for_user/#{id}")
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,32 @@
1
+ module Yammer
2
+ module Api
3
+ module GroupMembership
4
+
5
+ # @see https://developer.yammer.com/restapi/#rest-groups
6
+ # @api_path /api/v1/group_memberships/id
7
+ # @rate_limited Yes
8
+ # @authentication Requires user context
9
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
10
+ # @return [Yammer::Response]
11
+ # @param id [Integer] the group membership ID
12
+ # @example Fetch data for the thread
13
+ # Yammer.get_group_membership(7)
14
+ def get_group_membership(id)
15
+ get("/api/v1/group_memberships/#{id}")
16
+ end
17
+
18
+ # @see https://developer.yammer.com/restapi/#rest-groups
19
+ # @api_path /api/v1/group_memberships
20
+ # @rate_limited Yes
21
+ # @authentication Requires user context
22
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
23
+ # @return [Yammer::Response]
24
+ # @param id [Integer] the group ID
25
+ # @example Fetch data for the thread
26
+ # Yammer.create_group_membership(74)
27
+ def create_group_membership(id)
28
+ post("/api/v1/group_memberships", :group_id => id)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,196 @@
1
+ module Yammer
2
+ module Api
3
+ module Message
4
+
5
+ # @see https://developer.yammer.com/restapi/#rest-messages
6
+ # @api_path /api/v1/messages
7
+ # @rate_limited Yes
8
+ # @authentication Requires user context
9
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
10
+ # @return [Yammer::Response]
11
+ # @param [Hash] opts the options to fetch a thread with
12
+ # @option opts [Integer] :newer_than
13
+ # @example Fetch data for the thread
14
+ # Yammer.create_message()
15
+ def create_message(opts={})
16
+ post("/api/v1/messages", opts)
17
+ end
18
+
19
+ # @see https://developer.yammer.com/restapi/#rest-messages
20
+ # @api_path /api/v1/messages
21
+ # @rate_limited Yes
22
+ # @authentication Requires user context
23
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
24
+ # @return [Yammer::Response]
25
+ # @param id [Integer] the thread ID
26
+ # @param [Hash] opts the options to fetch a thread with
27
+ # @option opts [Integer] :newer_than
28
+ # @example Fetch data for the thread
29
+ # Yammer.delete_message
30
+ def delete_message(id, opts={})
31
+ post("/api/v1/messages/#{id}", opts)
32
+ end
33
+
34
+ # @see https://developer.yammer.com/restapi/#rest-messages
35
+ # @api_path /api/v1/messages
36
+ # @rate_limited Yes
37
+ # @authentication Requires user context
38
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
39
+ # @return [Yammer::Response]
40
+ # @param id [Integer] the thread ID
41
+ # @param [Hash] opts the options to fetch a thread with
42
+ # @option opts [Integer] :newer_than
43
+ # @example Fetch data for the thread
44
+ # Yammer.get_message
45
+ def get_message(id, opts={})
46
+ get("/api/v1/messages/#{id}", opts)
47
+ end
48
+
49
+ # @see https://developer.yammer.com/restapi/#rest-messages
50
+ # @api_path /api/v1/messages
51
+ # @rate_limited Yes
52
+ # @authentication Requires user context
53
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
54
+ # @return [Yammer::Response]
55
+ # @param [Hash] opts the options to fetch a thread with
56
+ # @option opts [Integer] :newer_than
57
+ # @example Fetch data for the thread
58
+ # Yammer.all_messages
59
+ def all_messages(opts={})
60
+ get("/api/v1/messages", opts)
61
+ end
62
+
63
+ # @see https://developer.yammer.com/restapi/#rest-messages
64
+ # @api_path /api/v1/messages
65
+ # @rate_limited Yes
66
+ # @authentication Requires user context
67
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
68
+ # @return [Yammer::Response]
69
+ # @param [Hash] opts the options to fetch a thread with
70
+ # @option opts [Integer] :newer_than
71
+ # @example Fetch data for the thread
72
+ # Yammer.messages_sent
73
+ def messages_sent(opts={})
74
+ get("/api/v1/messages/sent", opts)
75
+ end
76
+
77
+ # @see https://developer.yammer.com/restapi/#rest-messages
78
+ # @api_path /api/v1/messages
79
+ # @rate_limited Yes
80
+ # @authentication Requires user context
81
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
82
+ # @return [Yammer::Response]
83
+ # @param [Hash] opts the options to fetch a thread with
84
+ # @option opts [Integer] :newer_than
85
+ # @example Fetch data for the thread
86
+ # Yammer.messages_received
87
+ def messages_received(opts={})
88
+ get("/api/v1/messages/received", opts)
89
+ end
90
+
91
+ # @see https://developer.yammer.com/restapi/#rest-messages
92
+ # @api_path /api/v1/messages
93
+ # @rate_limited Yes
94
+ # @authentication Requires user context
95
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
96
+ # @return [Yammer::Response]
97
+ # @param [Hash] opts the options to fetch a thread with
98
+ # @option opts [Integer] :newer_than
99
+ # @example Fetch data for the thread
100
+ # Yammer.private_messages
101
+ def private_messages(opts={})
102
+ get("/api/v1/messages/private", opts)
103
+ end
104
+
105
+ # @see https://developer.yammer.com/restapi/#rest-messages
106
+ # @api_path /api/v1/messages
107
+ # @rate_limited Yes
108
+ # @authentication Requires user context
109
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
110
+ # @return [Yammer::Response]
111
+ # @param [Hash] opts the options to fetch a thread with
112
+ # @option opts [Integer] :newer_than
113
+ # @example Fetch data for the thread
114
+ # Yammer.followed_messages
115
+ def followed_messages(opts={})
116
+ get("/api/v1/messages/following", opts)
117
+ end
118
+
119
+ # @see https://developer.yammer.com/restapi/#rest-messages
120
+ # @api_path /api/v1/messages
121
+ # @rate_limited Yes
122
+ # @authentication Requires user context
123
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
124
+ # @return [Yammer::Response]
125
+ # @param id [Integer] the thread ID
126
+ # @param [Hash] opts the options to fetch a thread with
127
+ # @option opts [Integer] :newer_than
128
+ # @example Fetch data for the thread
129
+ # Yammer.messages_from_user
130
+ def messages_from_user(id, opts={})
131
+ get("/api/v1/messages/from_user/#{id}", opts)
132
+ end
133
+
134
+ # @see https://developer.yammer.com/restapi/#rest-messages
135
+ # @api_path /api/v1/messages
136
+ # @rate_limited Yes
137
+ # @authentication Requires user context
138
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
139
+ # @return [Yammer::Response]
140
+ # @param id [Integer] the thread ID
141
+ # @param [Hash] opts the options to fetch a thread with
142
+ # @option opts [Integer] :newer_than
143
+ # @example Fetch data for the thread
144
+ # Yammer.messages_about_topic
145
+ def messages_about_topic(id, opts={})
146
+ get("/api/v1/messages/about_topic/#{id}", opts)
147
+ end
148
+
149
+ # @see https://developer.yammer.com/restapi/#rest-messages
150
+ # @api_path /api/v1/messages
151
+ # @rate_limited Yes
152
+ # @authentication Requires user context
153
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
154
+ # @return [Yammer::Response]
155
+ # @param id [Integer] the thread ID
156
+ # @param [Hash] opts the options to fetch a thread with
157
+ # @option opts [Integer] :newer_than
158
+ # @example Fetch data for the thread
159
+ # Yammer.messages_in_group
160
+ def messages_in_group(id, opts={})
161
+ get("/api/v1/messages/in_group/#{id}", opts)
162
+ end
163
+
164
+ # @see https://developer.yammer.com/restapi/#rest-messages
165
+ # @api_path /api/v1/messages
166
+ # @rate_limited Yes
167
+ # @authentication Requires user context
168
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
169
+ # @return [Yammer::Response]
170
+ # @param id [Integer] the thread ID
171
+ # @param [Hash] opts the options to fetch a thread with
172
+ # @option opts [Integer] :newer_than
173
+ # @example Fetch data for the thread
174
+ # Yammer.messages_liked_by
175
+ def messages_liked_by(id, opts={})
176
+ get("/api/v1/messages/liked_by/#{id}", opts)
177
+ end
178
+
179
+ # @see https://developer.yammer.com/restapi/#rest-messages
180
+ # @api_path /api/v1/messages
181
+ # @rate_limited Yes
182
+ # @authentication Requires user context
183
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
184
+ # @return [Yammer::Response]
185
+ # @param id [Integer] the thread ID
186
+ # @param [Hash] opts the options to fetch a thread with
187
+ # @option opts [Integer] :newer_than
188
+ # @example Fetch data for the thread
189
+ # Yammer.messages_in_thread
190
+ def messages_in_thread(id, opts={})
191
+ get("/api/v1/messages/in_thread/#{id}", opts)
192
+ end
193
+
194
+ end
195
+ end
196
+ end
@@ -0,0 +1,21 @@
1
+ module Yammer
2
+ module Api
3
+ module Network
4
+
5
+ # @see https://developer.yammer.com/restapi/#rest-network
6
+ # @api_path /api/v1//networks/current
7
+ # @rate_limited Yes
8
+ # @authentication authenticated user context
9
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
10
+ # @return [Yammer::Response]
11
+ # @param [Hash] opts the options to fetch a thread with
12
+ # @option opts [Boolean] :include_suspended
13
+ # @option opts [Boolean] :exclude_own_messages_from_unseen
14
+ # @example Fetch data for the thread
15
+ # Yammer.current_networks
16
+ def current_networks(opts={})
17
+ get('/api/v1/networks/current', opts)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,18 @@
1
+ module Yammer
2
+ module Api
3
+ module Notification
4
+
5
+ # @see https://developer.yammer.com/restapi/#rest-search
6
+ # @api_path /api/v1/streams/notifications
7
+ # @rate_limited Yes
8
+ # @authentication authenticated user context
9
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
10
+ # @return [Yammer::Response]
11
+ # @example Fetch notifications for authenticated user
12
+ # Yammer.notifications
13
+ def notifications
14
+ get('/api/v1/streams/notifications')
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,28 @@
1
+ module Yammer
2
+ module Api
3
+ module Search
4
+
5
+ # @see https://developer.yammer.com/restapi/#rest-search
6
+ # @api_path /api/v1/search
7
+ # @rate_limited Yes
8
+ # @authentication Requires user context
9
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
10
+ # @return [Yammer::Response]
11
+ # @param [Hash] opts the options to fetch a thread with
12
+ # @option opts [Integer] :num_per_page
13
+ # @option opts [Integer] :page
14
+ # @option opts [Integer] :search_group
15
+ # @option opts [Integer] :search_user
16
+ # @option opts [String] :search_sort
17
+ # @option opts [String] :match
18
+ # @option opts [String] :model_types
19
+ # @option opts [String] :search_startdate
20
+ # @option opts [String] :search_enddate
21
+ # @example Fetch data for the thread
22
+ # Yammer.search(:search => 'money power women')
23
+ def search(opts={})
24
+ get('/api/v1/search.json', opts)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,23 @@
1
+ module Yammer
2
+ module Api
3
+ module Thread
4
+
5
+ # @see https://developer.yammer.com/restapi/#rest-users
6
+ # @api_path /api/v1/threads/id
7
+ # @rate_limited Yes
8
+ # @authentication Requires user context
9
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
10
+ # @return [Yammer::Response]
11
+ # @param id [Integer] the thread ID
12
+ # @param [Hash] opts the options to fetch a thread with
13
+ # @option opts [Integer] :newer_than
14
+ # @option opts [String] :threaded
15
+ # @option opts [Boolean] :exclude_own_messages_from_unseen
16
+ # @example Fetch data for the thread
17
+ # Yammer.get_thread(42)
18
+ def get_thread(id, opts={})
19
+ get("/api/v1/threads/#{id}", opts)
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,21 @@
1
+ module Yammer
2
+ module Api
3
+ module Topic
4
+
5
+ # @see https://developer.yammer.com/restapi/#rest-users
6
+ # @api_path /api/v1/topics
7
+ # @rate_limited Yes
8
+ # @authentication Requires user context
9
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
10
+ # @return [Yammer::Response]
11
+ # @param id [Integer]
12
+ # @param [Hash] opts the options to fetch a thread with
13
+ # @option opts [Integer] :is_followed_by
14
+ # @example Fetch data for the thread
15
+ # Yammer.get_topic(42, :is_followed_by => 2)
16
+ def get_topic(id, opts={})
17
+ get("/api/v1/topics/#{id}", opts)
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,156 @@
1
+ module Yammer
2
+ module Api
3
+ module User
4
+
5
+ # @see https://developer.yammer.com/restapi/#rest-users
6
+ # @rate_limited Yes
7
+ # @authentication Requires user context
8
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
9
+ # @return [Yammer::Response]
10
+ # @param opts [Hash] A customizable set of options.
11
+ # @option opts [String] :email
12
+ # @option opts [String] :full_name
13
+ # @option opts [String] :guid
14
+ # @option opts [String] :job_title
15
+ # @option opts [String] :location
16
+ # @option opts [String] :im_provider
17
+ # @option opts [String] :im_username
18
+ # @option opts [String] :work_telephone
19
+ # @option opts [String] :work_extension
20
+ # @option opts [String] :mobile_telephone
21
+ # @option opts [String] :external_profiles
22
+ # @option opts [String] :significant_other
23
+ # @option opts [String] :kids_names
24
+ # @option opts [String] :interests
25
+ # @option opts [String] :summary
26
+ # @option opts [String] :expertise
27
+ # @option opts [String] :schools_csv
28
+ # @option opts [String] :previous_companies_csv
29
+ # @option opts [String] :preferred_my_feed
30
+ # @option opts [String] :sticky_my_feed
31
+ # @option opts [String] :prescribed_my_feed
32
+ # @example create a user with the email `thekev@yammer.com`
33
+ # Yammer.create_user('thekev@yammer.com')
34
+ def create_user(opts={})
35
+ post("/api/v1/users", opts)
36
+ end
37
+
38
+ # @see https://developer.yammer.com/restapi/#rest-users
39
+ # @rate_limited Yes
40
+ # @authentication Requires user context
41
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
42
+ # @return [Yammer::Response]
43
+ # @param opts [Hash] A customizable set of options.
44
+ # @option opts [String] :email
45
+ # @option opts [String] :full_name
46
+ # @option opts [String] :guid
47
+ # @option opts [String] :job_title
48
+ # @option opts [String] :location
49
+ # @option opts [String] :im_provider
50
+ # @option opts [String] :im_username
51
+ # @option opts [String] :work_telephone
52
+ # @option opts [String] :work_extension
53
+ # @option opts [String] :mobile_telephone
54
+ # @option opts [String] :external_profiles
55
+ # @option opts [String] :significant_other
56
+ # @option opts [String] :kids_names
57
+ # @option opts [String] :interests
58
+ # @option opts [String] :summary
59
+ # @option opts [String] :expertise
60
+ # @option opts [String] :schools_csv
61
+ # @option opts [String] :previous_companies_csv
62
+ # @option opts [String] :preferred_my_feed
63
+ # @option opts [String] :sticky_my_feed
64
+ # @option opts [String] :prescribed_my_feed
65
+ # @example update info for a user with the email `thekev@yammer.com`
66
+ # Yammer.update_user(1, :job_title => 'software engineer')
67
+ def update_user(id, opts={})
68
+ put("/api/v1/users/#{id}", opts)
69
+ end
70
+
71
+ # @see https://developer.yammer.com/restapi/#rest-users
72
+ # @rate_limited Yes
73
+ # @authentication Requires user context
74
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
75
+ # @return [Yammer::Response]
76
+ # @param id [Integer, String] A Yammer user ID
77
+ # @example Delete user with ID 2
78
+ # Yammer.delete_user(2)
79
+ def delete_user(id)
80
+ delete("/api/v1/users/#{id}")
81
+ end
82
+
83
+ # @see https://developer.yammer.com/restapi/#rest-users
84
+ # @rate_limited Yes
85
+ # @authentication Requires user context
86
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
87
+ # @return [Yammer::Response]
88
+ # @param id [Integer, String] A Yammer user ID
89
+ # @example Fetch data user with ID 2
90
+ # Yammer.get_user(2)
91
+ def get_user(id)
92
+ get("/api/v1/users/#{id}")
93
+ end
94
+
95
+ # @see https://developer.yammer.com/restapi/#rest-users
96
+ # @rate_limited Yes
97
+ # @authentication Requires user context
98
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
99
+ # @return [Yammer::Response]
100
+ # @param email [Integer, String] A Yammer user ID
101
+ # @example Fetch data user with email `thekev@yammer.com`
102
+ # Yammer.get_user_by_email('thekev@yammer.com')
103
+ def get_user_by_email(email)
104
+ get("/api/v1/users/by_email", :email => email)
105
+ end
106
+
107
+ # @see https://developer.yammer.com/restapi/#rest-users
108
+ # @rate_limited Yes
109
+ # @authentication Requires user context
110
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
111
+ # @return [Yammer::Response]
112
+ # @example Fetch data for the authenticated user
113
+ # Yammer.current_user
114
+ def current_user
115
+ get("/api/v1/users/current")
116
+ end
117
+
118
+ # @see https://developer.yammer.com/restapi/#rest-users
119
+ # @rate_limited Yes
120
+ # @authentication Requires user context
121
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
122
+ # @return [Yammer::Response]
123
+ # @param opts [Hash] A customizable set of opts.
124
+ # @option opts [Integer] :page
125
+ # @example Fetch users from the autheticated user's network
126
+ # Yammer.all_users
127
+ def all_users(opts={})
128
+ get("/api/v1/users", opts)
129
+ end
130
+
131
+ # @rate_limited Yes
132
+ # @authentication Requires user context
133
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
134
+ # @return [Yammer::Response]
135
+ # @param opts [Hash] A customizable set of opts.
136
+ # @option opts [Boolean] :full
137
+ # @example Fetch users from the autheticated user's network
138
+ # Yammer.users_following(1)
139
+ def users_following(id, opts={})
140
+ get("/api/v1/users/following/", opts)
141
+ end
142
+
143
+ # @rate_limited Yes
144
+ # @authentication Requires user context
145
+ # @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
146
+ # @return [Yammer::Response]
147
+ # @param opts [Hash] A customizable set of opts.
148
+ # @option opts [Boolean] :full
149
+ # @example Fetch users from the autheticated user's network
150
+ # Yammer.users_following(1)
151
+ def users_followed(id, opts={})
152
+ get("/api/v1/users/followed_by", opts)
153
+ end
154
+ end
155
+ end
156
+ end