yam 0.0.6 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/.travis.yml +5 -0
- data/.yardopts +10 -0
- data/AUTHORS +1 -0
- data/CHANGELOG.md +7 -0
- data/CONTRIBUTING.md +0 -7
- data/Gemfile +27 -1
- data/README.md +190 -67
- data/Rakefile +9 -3
- data/certs/public.pem +20 -0
- data/lib/yammer.rb +47 -0
- data/lib/yammer/api.rb +29 -0
- data/lib/yammer/api/autocomplete.rb +39 -0
- data/lib/yammer/api/group.rb +92 -0
- data/lib/yammer/api/group_membership.rb +46 -0
- data/lib/yammer/api/invitation.rb +39 -0
- data/lib/yammer/api/like.rb +57 -0
- data/lib/yammer/api/message.rb +227 -0
- data/lib/yammer/api/network.rb +35 -0
- data/lib/yammer/api/notification.rb +32 -0
- data/lib/yammer/api/open_graph_object.rb +92 -0
- data/lib/yammer/api/pending_attachment.rb +64 -0
- data/lib/yammer/api/search.rb +42 -0
- data/lib/yammer/api/subscription.rb +32 -0
- data/lib/yammer/api/thread.rb +37 -0
- data/lib/yammer/api/topic.rb +37 -0
- data/lib/yammer/api/user.rb +168 -0
- data/lib/yammer/api_handler.rb +27 -0
- data/lib/yammer/api_response.rb +57 -0
- data/lib/yammer/base.rb +208 -0
- data/lib/yammer/client.rb +100 -0
- data/lib/yammer/configurable.rb +81 -0
- data/lib/yammer/error.rb +75 -0
- data/lib/yammer/group.rb +27 -0
- data/lib/yammer/group_membership.rb +25 -0
- data/lib/yammer/http_adapter.rb +100 -0
- data/lib/yammer/identity_map.rb +56 -0
- data/lib/yammer/message.rb +32 -0
- data/lib/yammer/message_body.rb +27 -0
- data/lib/yammer/pending_attachment.rb +19 -0
- data/lib/yammer/thread.rb +58 -0
- data/lib/yammer/user.rb +66 -0
- data/lib/yammer/version.rb +32 -0
- data/{lib/yam/configuration.rb → spec/api/autocomplete_spec.rb} +18 -23
- data/spec/api/group_membership_spec.rb +48 -0
- data/spec/api/group_spec.rb +76 -0
- data/spec/api/invitation_spec.rb +60 -0
- data/spec/api/like_spec.rb +46 -0
- data/spec/api/message_spec.rb +136 -0
- data/spec/api/network_spec.rb +41 -0
- data/{lib/yam/client.rb → spec/api/notification_spec.rb} +22 -4
- data/spec/api/open_graph_object_spec.rb +67 -0
- data/spec/api/pending_attachment_spec.rb +56 -0
- data/{lib/yam/constants.rb → spec/api/search_spec.rb} +21 -8
- data/spec/api/subscription_spec.rb +41 -0
- data/{lib/yam.rb → spec/api/thread_spec.rb} +19 -12
- data/{lib/yam/request.rb → spec/api/topic_spec.rb} +19 -15
- data/spec/api/user_spec.rb +108 -0
- data/spec/api_response.rb +86 -0
- data/spec/client_spec.rb +364 -0
- data/spec/error_spec.rb +88 -0
- data/spec/fixtures/group.json +1 -0
- data/spec/fixtures/message.json +1 -0
- data/spec/fixtures/messages_in_thread.json +1 -0
- data/spec/fixtures/portal_thread.json +1 -0
- data/spec/fixtures/private_thread.json +1 -0
- data/spec/fixtures/public_thread.json +1 -0
- data/spec/fixtures/user.json +1 -0
- data/spec/fixtures/users_followed.json +1 -0
- data/spec/fixtures/users_following.json +1 -0
- data/spec/http_adapter_spec.rb +109 -0
- data/spec/identity_map_spec.rb +127 -0
- data/spec/mocks/attachment.txt +1 -0
- data/spec/model/base_spec.rb +196 -0
- data/spec/model/group_membership_spec.rb +57 -0
- data/spec/model/group_spec.rb +73 -0
- data/spec/model/message_spec.rb +74 -0
- data/spec/model/thread_spec.rb +91 -0
- data/spec/model/user_spec.rb +222 -0
- data/spec/spec_helper.rb +39 -14
- data/yam.gemspec +50 -28
- metadata +270 -187
- metadata.gz.sig +0 -0
- data/lib/yam/api.rb +0 -53
- data/lib/yam/connection.rb +0 -57
- data/lib/yam/version.rb +0 -20
- data/spec/yam/client_spec.rb +0 -50
- data/spec/yam_spec.rb +0 -87
data/lib/yammer.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# Copyright (c) Microsoft Corporation
|
2
|
+
# All rights reserved.
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
|
8
|
+
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
|
9
|
+
# WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
11
|
+
|
12
|
+
# See the Apache Version 2.0 License for specific language governing
|
13
|
+
# permissions and limitations under the License.
|
14
|
+
|
15
|
+
require 'yammer/version'
|
16
|
+
require 'yammer/error'
|
17
|
+
require 'yammer/configurable'
|
18
|
+
require 'yammer/api'
|
19
|
+
require 'yammer/http_adapter'
|
20
|
+
require 'yammer/client'
|
21
|
+
require 'yammer/api_handler'
|
22
|
+
require 'yammer/api_response'
|
23
|
+
require 'yammer/identity_map'
|
24
|
+
require 'yammer/base'
|
25
|
+
require 'yammer/user'
|
26
|
+
require 'yammer/group'
|
27
|
+
require 'yammer/group_membership'
|
28
|
+
require 'yammer/message'
|
29
|
+
require 'yammer/thread'
|
30
|
+
|
31
|
+
module Yammer
|
32
|
+
class << self
|
33
|
+
include Configurable
|
34
|
+
include ApiHandler
|
35
|
+
|
36
|
+
def to_s
|
37
|
+
"<#{self.name}: #{self.options.inspect}>"
|
38
|
+
end
|
39
|
+
|
40
|
+
private
|
41
|
+
def method_missing(method_name, *args, &block)
|
42
|
+
return super unless api_handler.respond_to?(method_name)
|
43
|
+
api_handler.send(method_name, *args, &block)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
Yammer.reset!
|
data/lib/yammer/api.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# Copyright (c) Microsoft Corporation
|
2
|
+
# All rights reserved.
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
|
8
|
+
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
|
9
|
+
# WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
11
|
+
|
12
|
+
# See the Apache Version 2.0 License for specific language governing
|
13
|
+
# permissions and limitations under the License.
|
14
|
+
|
15
|
+
require 'yammer/api/user'
|
16
|
+
require 'yammer/api/group'
|
17
|
+
require 'yammer/api/group_membership'
|
18
|
+
require 'yammer/api/message'
|
19
|
+
require 'yammer/api/thread'
|
20
|
+
require 'yammer/api/search'
|
21
|
+
require 'yammer/api/topic'
|
22
|
+
require 'yammer/api/like'
|
23
|
+
require 'yammer/api/autocomplete'
|
24
|
+
require 'yammer/api/network'
|
25
|
+
require 'yammer/api/notification'
|
26
|
+
require 'yammer/api/pending_attachment'
|
27
|
+
require 'yammer/api/invitation'
|
28
|
+
require 'yammer/api/subscription'
|
29
|
+
require 'yammer/api/open_graph_object'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright (c) Microsoft Corporation
|
2
|
+
# All rights reserved.
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
|
8
|
+
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
|
9
|
+
# WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
11
|
+
|
12
|
+
# See the Apache Version 2.0 License for specific language governing
|
13
|
+
# permissions and limitations under the License.
|
14
|
+
|
15
|
+
module Yammer
|
16
|
+
module Api
|
17
|
+
module Autocomplete
|
18
|
+
|
19
|
+
# @see https://developer.yammer.com/restapi/#rest-search
|
20
|
+
# @api_path /api/v1/autocomplete/ranked
|
21
|
+
# @rate_limited Yes
|
22
|
+
# @authentication authenticated user context
|
23
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
24
|
+
# @return [Yammer::ApiResponse]
|
25
|
+
# @param [Hash] opts the options to fetch a thread with
|
26
|
+
# @option opts [String] :prefix
|
27
|
+
# @option opts [String] :models
|
28
|
+
# @option opts [Integer] :network_id
|
29
|
+
# @option opts [Integer] :include_site_actions
|
30
|
+
# @option opts [Boolean] :extended]
|
31
|
+
# @option opts [Boolean] :include_network_domainss
|
32
|
+
# @example Fetch data for the thread
|
33
|
+
# Yammer.search(:prefix => 'pizza', :models => 'user:3,group:8,topic:10')
|
34
|
+
def autocomplete(opts={})
|
35
|
+
get('/api/v1/autocomplete/ranked', opts)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,92 @@
|
|
1
|
+
# Copyright (c) Microsoft Corporation
|
2
|
+
# All rights reserved.
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
|
8
|
+
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
|
9
|
+
# WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
11
|
+
|
12
|
+
# See the Apache Version 2.0 License for specific language governing
|
13
|
+
# permissions and limitations under the License.
|
14
|
+
|
15
|
+
module Yammer
|
16
|
+
module Api
|
17
|
+
module Group
|
18
|
+
|
19
|
+
# @see https://developer.yammer.com/restapi/#rest-groups
|
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::ApiResponse]
|
24
|
+
# @param [Hash] opts the opts to fetch a thread with
|
25
|
+
# @option opts [Integer] :page
|
26
|
+
# @option opts [String] :sort_by sort groups by created_on, creator, name default order is by number of messages
|
27
|
+
# @option opts [String] :letter groups starting with letter
|
28
|
+
# @example Fetch all groups for authenticated user's network
|
29
|
+
# Yammer.all_groups
|
30
|
+
def all_groups(opts={})
|
31
|
+
get("/api/v1/groups", opts)
|
32
|
+
end
|
33
|
+
|
34
|
+
# @see https://developer.yammer.com/restapi/#rest-groups
|
35
|
+
# @rate_limited Yes
|
36
|
+
# @authentication Requires user context
|
37
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
38
|
+
# @return [Yammer::ApiResponse]
|
39
|
+
# @param id [Integer] the group ID
|
40
|
+
# @example Fetch data for specified group
|
41
|
+
# Yammer.get_group(74)
|
42
|
+
def get_group(id)
|
43
|
+
get("/api/v1/groups/#{id}")
|
44
|
+
end
|
45
|
+
|
46
|
+
# @see https://developer.yammer.com/restapi/#rest-groups
|
47
|
+
# @rate_limited Yes
|
48
|
+
# @authentication Requires user context
|
49
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
50
|
+
# @return [Yammer::ApiResponse]
|
51
|
+
# @param [Hash] opts the opts to fetch a thread with
|
52
|
+
# @option opts [String] :name
|
53
|
+
# @option opts [String] :description
|
54
|
+
# @option opts [Boolean] :private
|
55
|
+
# @option opts [Boolean] :show_in_directory
|
56
|
+
# @example Create a new public group
|
57
|
+
# Yammer.create_group(:name => "new group name", :private => "false")
|
58
|
+
def create_group(opts={})
|
59
|
+
post("/api/v1/groups", opts)
|
60
|
+
end
|
61
|
+
|
62
|
+
# @see https://developer.yammer.com/restapi/#rest-groups
|
63
|
+
# @rate_limited Yes
|
64
|
+
# @authentication Requires user context
|
65
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
66
|
+
# @return [Yammer::ApiResponse]
|
67
|
+
# @param id [Integer] the group ID
|
68
|
+
# @param [Hash] opts
|
69
|
+
# @option opts [String] :name
|
70
|
+
# @option opts [String] :description
|
71
|
+
# @option opts [Boolean] :private
|
72
|
+
# @option opts [Boolean] :show_in_directory
|
73
|
+
# @example Update data for a given group
|
74
|
+
# Yammer.update_group(74, :name => "new group name")
|
75
|
+
def update_group(id, opts={})
|
76
|
+
post("/api/v1/groups/#{id}", opts)
|
77
|
+
end
|
78
|
+
|
79
|
+
# @see https://developer.yammer.com/restapi/#rest-groups
|
80
|
+
# @rate_limited Yes
|
81
|
+
# @authentication Requires user context
|
82
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
83
|
+
# @return [Yammer::ApiResponse]
|
84
|
+
# @param id [Integer] the user ID
|
85
|
+
# @example Fetch groups for a given user
|
86
|
+
# Yammer.groups_for_user(74)
|
87
|
+
def groups_for_user(id)
|
88
|
+
get("/api/v1/groups/for_user/#{id}")
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Copyright (c) Microsoft Corporation
|
2
|
+
# All rights reserved.
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
|
8
|
+
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
|
9
|
+
# WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
11
|
+
|
12
|
+
# See the Apache Version 2.0 License for specific language governing
|
13
|
+
# permissions and limitations under the License.
|
14
|
+
|
15
|
+
module Yammer
|
16
|
+
module Api
|
17
|
+
module GroupMembership
|
18
|
+
|
19
|
+
# @see https://developer.yammer.com/restapi/#rest-group_memberships
|
20
|
+
# @api_path /api/v1/group_memberships/id
|
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::ApiResponse]
|
25
|
+
# @param id [Integer] the group membership ID
|
26
|
+
# @example Fetch data for the thread
|
27
|
+
# Yammer.get_group_membership(7)
|
28
|
+
def get_group_membership(id)
|
29
|
+
get("/api/v1/group_memberships/#{id}")
|
30
|
+
end
|
31
|
+
|
32
|
+
# @see https://developer.yammer.com/restapi/#rest-groups
|
33
|
+
# @api_path /api/v1/group_memberships
|
34
|
+
# @rate_limited Yes
|
35
|
+
# @authentication Requires user context
|
36
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
37
|
+
# @return [Yammer::ApiResponse]
|
38
|
+
# @param id [Integer] the group ID
|
39
|
+
# @example Fetch data for the thread
|
40
|
+
# Yammer.create_group_membership(74)
|
41
|
+
def create_group_membership(id)
|
42
|
+
post("/api/v1/group_memberships", :group_id => id)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Copyright (c) Microsoft Corporation
|
2
|
+
# All rights reserved.
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
|
8
|
+
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
|
9
|
+
# WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
11
|
+
|
12
|
+
# See the Apache Version 2.0 License for specific language governing
|
13
|
+
# permissions and limitations under the License.
|
14
|
+
|
15
|
+
|
16
|
+
module Yammer
|
17
|
+
module Api
|
18
|
+
module Invitation
|
19
|
+
|
20
|
+
# @see https://developer.yammer.com/restapi/#rest-invitations
|
21
|
+
# @api_path /api/v1/invitations
|
22
|
+
# @rate_limited Yes
|
23
|
+
# @authentication Requires user context
|
24
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
25
|
+
# @return [Yammer::ApiResponse]
|
26
|
+
# @param [String, Array] email or list of email addresses to send invitations to
|
27
|
+
# @example Fetch data for the thread
|
28
|
+
#
|
29
|
+
# Yammer.invite(%{ bob@yammer.com alice@yammer.com })
|
30
|
+
#
|
31
|
+
# Yammer.invite('bob@yammer.com, alice@yammer.com')
|
32
|
+
def invite(email)
|
33
|
+
email = email.strip if email.is_a?(String)
|
34
|
+
email = email.join(',') if email.is_a?(Array)
|
35
|
+
post('/api/v1/invitations', :email => email)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
# Copyright (c) Microsoft Corporation
|
2
|
+
# All rights reserved.
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
|
8
|
+
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
|
9
|
+
# WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
11
|
+
|
12
|
+
# See the Apache Version 2.0 License for specific language governing
|
13
|
+
# permissions and limitations under the License.
|
14
|
+
|
15
|
+
module Yammer
|
16
|
+
module Api
|
17
|
+
module Like
|
18
|
+
|
19
|
+
# Delivers a ‘like’ action to the activity stream
|
20
|
+
# @see https://developer.yammer.com/
|
21
|
+
# @api_path /api/v1/likes
|
22
|
+
# @rate_limited Yes
|
23
|
+
# @authentication Requires user context
|
24
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
25
|
+
# @return [Yammer::ApiResponse]
|
26
|
+
# @param [Integer] id
|
27
|
+
# @param [String] type
|
28
|
+
def like(type, id)
|
29
|
+
post('/api/v1/likes', :id => id, :type => type)
|
30
|
+
end
|
31
|
+
|
32
|
+
# Unlike
|
33
|
+
# @see https://developer.yammer.com/
|
34
|
+
# @api_path /api/v1/likes
|
35
|
+
# @rate_limited Yes
|
36
|
+
# @authentication Requires user context
|
37
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
38
|
+
# @return [Yammer::ApiResponse]
|
39
|
+
# @param [Integer] id
|
40
|
+
def unlike(id)
|
41
|
+
delete("/api/v1/likes/#{id}")
|
42
|
+
end
|
43
|
+
|
44
|
+
# Used to determine if current user likes ogo
|
45
|
+
# @see https://developer.yammer.com/
|
46
|
+
# @api_path /api/v1/likes
|
47
|
+
# @rate_limited Yes
|
48
|
+
# @authentication Requires user context
|
49
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
50
|
+
# @return [Yammer::ApiResponse]
|
51
|
+
# @param [Integer] id
|
52
|
+
def likes_open_graph_object?(id)
|
53
|
+
get("/api/v1/likes/open_graph_object/#{id}")
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,227 @@
|
|
1
|
+
# Copyright (c) Microsoft Corporation
|
2
|
+
# All rights reserved.
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
|
6
|
+
#
|
7
|
+
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR
|
8
|
+
# CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
|
9
|
+
# WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE,
|
10
|
+
# FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
11
|
+
|
12
|
+
# See the Apache Version 2.0 License for specific language governing
|
13
|
+
# permissions and limitations under the License.
|
14
|
+
|
15
|
+
module Yammer
|
16
|
+
module Api
|
17
|
+
module Message
|
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::ApiResponse]
|
25
|
+
# @param body [String] Message body
|
26
|
+
# @param [Hash] opts the options to create a message with
|
27
|
+
# @option opts [Integer] :cc
|
28
|
+
# @option opts [Integer] :replied_to_id
|
29
|
+
# @option opts [Integer] :group_id
|
30
|
+
# @option opts [Array<Integer>] :direct_to_user_ids
|
31
|
+
# @option opts [Array<Integer>] :pending_attachment_ids
|
32
|
+
# @example Create a new message
|
33
|
+
# msg1 = Yammer.create_message('what are you workings on?')
|
34
|
+
#
|
35
|
+
# msg2 = Yammer.create_message('building a yammer client', :replied_to_id => msg.id)
|
36
|
+
def create_message(body, opts={})
|
37
|
+
opts[:body] = body
|
38
|
+
post("/api/v1/messages", opts)
|
39
|
+
end
|
40
|
+
|
41
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
42
|
+
# @api_path /api/v1/messages
|
43
|
+
# @rate_limited Yes
|
44
|
+
# @authentication Requires user context
|
45
|
+
# @raise [Yammer::Error::BadRequest] Error raised when you try to delete a message that
|
46
|
+
# you did not create
|
47
|
+
# @return [Yammer::ApiResponse]
|
48
|
+
# @param id [Integer] the thread ID
|
49
|
+
# @example Delete an existing message
|
50
|
+
# result = Yammer.delete_message(1)
|
51
|
+
def delete_message(id)
|
52
|
+
delete("/api/v1/messages/#{id}")
|
53
|
+
end
|
54
|
+
|
55
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
56
|
+
# @api_path /api/v1/messages
|
57
|
+
# @rate_limited Yes
|
58
|
+
# @authentication Requires user context
|
59
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
60
|
+
# @return [Yammer::ApiResponse]
|
61
|
+
# @param id [Integer] the ID of the message to be fetched
|
62
|
+
# @example Fetch an existing message
|
63
|
+
# msg = Yammer.get_message(3)
|
64
|
+
def get_message(id)
|
65
|
+
get("/api/v1/messages/#{id}")
|
66
|
+
end
|
67
|
+
|
68
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
69
|
+
# @api_path /api/v1/messages
|
70
|
+
# @rate_limited Yes
|
71
|
+
# @authentication Requires user context
|
72
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
73
|
+
# @return [Yammer::ApiResponse]
|
74
|
+
# @param [Hash] opts the options to fetch the messages with
|
75
|
+
# @option opts [Integer] :newer_than
|
76
|
+
# @example Fetch a list of messages from the company feed
|
77
|
+
# msgs = Yammer.all_messages
|
78
|
+
def all_messages(opts={})
|
79
|
+
get("/api/v1/messages", opts)
|
80
|
+
end
|
81
|
+
|
82
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
83
|
+
# @api_path /api/v1/messages
|
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::ApiResponse]
|
88
|
+
# @param [Hash] opts the options to fetch the messages with
|
89
|
+
# @option opts [Integer] :newer_than
|
90
|
+
# @example Fetch list messages sent by authenticated user
|
91
|
+
# msgs = Yammer.messages_sent
|
92
|
+
def messages_sent(opts={})
|
93
|
+
get("/api/v1/messages/sent", opts)
|
94
|
+
end
|
95
|
+
|
96
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
97
|
+
# @api_path /api/v1/messages
|
98
|
+
# @rate_limited Yes
|
99
|
+
# @authentication Requires user context
|
100
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
101
|
+
# @return [Yammer::ApiResponse]
|
102
|
+
# @param [Hash] opts the options to fetch the messages with
|
103
|
+
# @option opts [Integer] :newer_than
|
104
|
+
# @example Fetch list of messages sent to authenitcated user
|
105
|
+
# msgs = Yammer.messages_received
|
106
|
+
def messages_received(opts={})
|
107
|
+
get("/api/v1/messages/received", opts)
|
108
|
+
end
|
109
|
+
|
110
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
111
|
+
# @api_path /api/v1/messages
|
112
|
+
# @rate_limited Yes
|
113
|
+
# @authentication Requires user context
|
114
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
115
|
+
# @return [Yammer::ApiResponse]
|
116
|
+
# @param [Hash] opts the options to fetch the messages with
|
117
|
+
# @option opts [Integer] :newer_than
|
118
|
+
# @example Fetch a list of private messages sent to authenitcated user
|
119
|
+
# msgs = Yammer.private_messages
|
120
|
+
def private_messages(opts={})
|
121
|
+
get("/api/v1/messages/private", opts)
|
122
|
+
end
|
123
|
+
|
124
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
125
|
+
# @api_path /api/v1/messages
|
126
|
+
# @rate_limited Yes
|
127
|
+
# @authentication Requires user context
|
128
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
129
|
+
# @return [Yammer::ApiResponse]
|
130
|
+
# @param [Hash] opts the options to fetch the messages with
|
131
|
+
# @option opts [Integer] :newer_than
|
132
|
+
# @example Fetch a list of messages being followed by authenitcated user
|
133
|
+
# msgs = Yammer.followed_messages
|
134
|
+
def followed_messages(opts={})
|
135
|
+
get("/api/v1/messages/following", opts)
|
136
|
+
end
|
137
|
+
|
138
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
139
|
+
# @api_path /api/v1/messages
|
140
|
+
# @rate_limited Yes
|
141
|
+
# @authentication Requires user context
|
142
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
143
|
+
# @return [Yammer::ApiResponse]
|
144
|
+
# @param id [Integer] the ID of the user whose public messages we want to look at
|
145
|
+
# @param [Hash] opts the options to fetch the messages with
|
146
|
+
# @option opts [Integer] :newer_than
|
147
|
+
# @example Fetch a list of messages sent by a user in the authenticated user's network
|
148
|
+
# msgs = Yammer.messages_from_user(8)
|
149
|
+
def messages_from_user(id, opts={})
|
150
|
+
get("/api/v1/messages/from_user/#{id}", opts)
|
151
|
+
end
|
152
|
+
|
153
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
154
|
+
# @api_path /api/v1/messages
|
155
|
+
# @rate_limited Yes
|
156
|
+
# @authentication Requires user context
|
157
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
158
|
+
# @return [Yammer::ApiResponse]
|
159
|
+
# @param id [Integer] the topic ID
|
160
|
+
# @param [Hash] opts the options to fetch the messages with
|
161
|
+
# @option opts [Integer] :newer_than
|
162
|
+
# @example Fetch messages that have been tagged with a given topic
|
163
|
+
# msgs = Yammer.messages_about_topic(1)
|
164
|
+
def messages_about_topic(id, opts={})
|
165
|
+
get("/api/v1/messages/about_topic/#{id}", opts)
|
166
|
+
end
|
167
|
+
|
168
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
169
|
+
# @api_path /api/v1/messages
|
170
|
+
# @rate_limited Yes
|
171
|
+
# @authentication Requires user context
|
172
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
173
|
+
# @return [Yammer::ApiResponse]
|
174
|
+
# @param id [Integer] the ID of the group whose messages you wish to fetch
|
175
|
+
# @param [Hash] opts the options to fetch the messages with
|
176
|
+
# @option opts [Integer] :newer_than
|
177
|
+
# @example Fetch a list of messages in a given group
|
178
|
+
# msgs = Yammer.messages_in_group(38)
|
179
|
+
def messages_in_group(id, opts={})
|
180
|
+
get("/api/v1/messages/in_group/#{id}", opts)
|
181
|
+
end
|
182
|
+
|
183
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
184
|
+
# @api_path /api/v1/messages
|
185
|
+
# @rate_limited Yes
|
186
|
+
# @authentication Requires user context
|
187
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
188
|
+
# @return [Yammer::ApiResponse]
|
189
|
+
# @param id [Integer] the ID of the user for whom you wish to get a list of messages they have liked
|
190
|
+
# @param [Hash] opts the options to fetch the messages with
|
191
|
+
# @option opts [Integer] :newer_than
|
192
|
+
# @example Fetch a list of messages liked by a given user
|
193
|
+
# msgs = Yammer.messages_liked_by(4)
|
194
|
+
def messages_liked_by(id, opts={})
|
195
|
+
get("/api/v1/messages/liked_by/#{id}", opts)
|
196
|
+
end
|
197
|
+
|
198
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
199
|
+
# @api_path /api/v1/messages
|
200
|
+
# @rate_limited Yes
|
201
|
+
# @authentication Requires user context
|
202
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
203
|
+
# @return [Yammer::ApiResponse]
|
204
|
+
# @param id [Integer] the thread ID
|
205
|
+
# @param [Hash] opts the options to fetch the messages with
|
206
|
+
# @option opts [Integer] :newer_than
|
207
|
+
# @example Fetch a list of messages in a given thread
|
208
|
+
# msgs = Yammer.messages_in_thread(10)
|
209
|
+
def messages_in_thread(id, opts={})
|
210
|
+
get("/api/v1/messages/in_thread/#{id}", opts)
|
211
|
+
end
|
212
|
+
|
213
|
+
# @see https://developer.yammer.com/restapi/#rest-messages
|
214
|
+
# @api_path /api/v1/messages/open_graph_objects
|
215
|
+
# @rate_limited Yes
|
216
|
+
# @authentication Requires user context
|
217
|
+
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
|
218
|
+
# @return [Yammer::ApiResponse]
|
219
|
+
# @param id [Integer] the thread ID
|
220
|
+
# @example Fetch a list of messages in a given thread
|
221
|
+
# msgs = Yammer.messages_for_open_graph_pbject(10)
|
222
|
+
def messages_for_open_graph_object(id)
|
223
|
+
get("/api/v1/messages/messages/open_graph_objects/#{id}")
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
227
|
+
end
|