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
@@ -0,0 +1,32 @@
|
|
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
|
+
class Version
|
17
|
+
MAJOR = 1 unless defined? Yammer::MAJOR
|
18
|
+
MINOR = 0 unless defined? Yammer::MINOR
|
19
|
+
PATCH = 0 unless defined? Yammer::PATCH
|
20
|
+
PRE = nil unless defined? Yammer::PRE
|
21
|
+
|
22
|
+
class << self
|
23
|
+
|
24
|
+
# @return [String]
|
25
|
+
def to_s
|
26
|
+
[MAJOR, MINOR, PATCH, PRE].compact.join('.')
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
1
3
|
# Copyright (c) Microsoft Corporation
|
2
4
|
# All rights reserved.
|
3
5
|
#
|
@@ -15,32 +17,25 @@
|
|
15
17
|
# See the Apache Version 2.0 License for specific language governing
|
16
18
|
# permissions and limitations under the License.
|
17
19
|
|
18
|
-
require '
|
19
|
-
|
20
|
-
module Yam
|
21
|
-
module Configuration
|
22
|
-
DEFAULT_ADAPTER = :net_http
|
23
|
-
DEFAULT_API_ENDPOINT = 'https://www.yammer.com/api/v1/'
|
24
|
-
DEFAULT_USER_AGENT = "Yam Ruby Gem #{Yam::VERSION}".freeze
|
25
|
-
VALID_OPTIONS_KEYS = [:adapter, :endpoint, :user_agent].freeze
|
20
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
26
21
|
|
27
|
-
|
22
|
+
describe Yammer::Api::Autocomplete do
|
28
23
|
|
29
|
-
|
30
|
-
|
31
|
-
|
24
|
+
before :all do
|
25
|
+
@client = Yammer::Client.new(
|
26
|
+
:site_url => 'https://www.yammer.com',
|
27
|
+
:client_id => 'PRbTcg9qjgKsp4jjpm1pw',
|
28
|
+
:client_secret => 'Xn7kp7Ly0TCY4GtZWkmSsqGEPg10DmMADyjWkf2U',
|
29
|
+
:access_token => 'TolNOFka9Uls2DxahNi78A'
|
30
|
+
)
|
31
|
+
end
|
32
32
|
|
33
|
-
|
34
|
-
options = {}
|
35
|
-
VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) }
|
36
|
-
options
|
37
|
-
end
|
33
|
+
subject { @client }
|
38
34
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
self
|
35
|
+
describe '#autocomplete' do
|
36
|
+
it 'should fetch autocomplete data' do
|
37
|
+
subject.should_receive(:get).with('/api/v1/autocomplete/ranked', { :prefix => 'alc' })
|
38
|
+
subject.autocomplete({ :prefix => 'alc' })
|
44
39
|
end
|
45
40
|
end
|
46
|
-
end
|
41
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
# Copyright (c) Microsoft Corporation
|
4
|
+
# All rights reserved.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
13
|
+
# ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
|
14
|
+
# IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR
|
15
|
+
# PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
16
|
+
#
|
17
|
+
# See the Apache Version 2.0 License for specific language governing
|
18
|
+
# permissions and limitations under the License.
|
19
|
+
|
20
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
21
|
+
|
22
|
+
describe Yammer::Api::GroupMembership do
|
23
|
+
|
24
|
+
before :all do
|
25
|
+
@client = Yammer::Client.new(
|
26
|
+
:site_url => 'https://www.yammer.com',
|
27
|
+
:client_id => 'PRbTcg9qjgKsp4jjpm1pw',
|
28
|
+
:client_secret => 'Xn7kp7Ly0TCY4GtZWkmSsqGEPg10DmMADyjWkf2U',
|
29
|
+
:access_token => 'TolNOFka9Uls2DxahNi78A'
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
subject { @client }
|
34
|
+
|
35
|
+
describe '#get_group_membership' do
|
36
|
+
it 'should fetch a group membership' do
|
37
|
+
subject.should_receive(:get).with('/api/v1/group_memberships/1')
|
38
|
+
subject.get_group_membership(1)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#create_group_membership' do
|
43
|
+
it 'should create a group membership' do
|
44
|
+
subject.should_receive(:post).with('/api/v1/group_memberships', { :group_id => 2 })
|
45
|
+
subject.create_group_membership(2)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
# Copyright (c) Microsoft Corporation
|
4
|
+
# All rights reserved.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
13
|
+
# ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
|
14
|
+
# IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR
|
15
|
+
# PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
16
|
+
#
|
17
|
+
# See the Apache Version 2.0 License for specific language governing
|
18
|
+
# permissions and limitations under the License.
|
19
|
+
|
20
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
21
|
+
|
22
|
+
describe Yammer::Api::Group do
|
23
|
+
|
24
|
+
before :all do
|
25
|
+
@client = Yammer::Client.new(
|
26
|
+
:site_url => 'https://www.yammer.com',
|
27
|
+
:client_id => 'PRbTcg9qjgKsp4jjpm1pw',
|
28
|
+
:client_secret => 'Xn7kp7Ly0TCY4GtZWkmSsqGEPg10DmMADyjWkf2U',
|
29
|
+
:access_token => 'TolNOFka9Uls2DxahNi78A'
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
subject { @client }
|
34
|
+
|
35
|
+
describe '#all_groups' do
|
36
|
+
it 'should fetch all groups in network' do
|
37
|
+
subject.should_receive(:get).with('/api/v1/groups', {})
|
38
|
+
subject.all_groups
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
describe '#groups_for_user' do
|
43
|
+
it 'should fetch all groups for user' do
|
44
|
+
subject.should_receive(:get).with('/api/v1/groups/for_user/2')
|
45
|
+
subject.groups_for_user(2)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe '#get_group' do
|
50
|
+
it 'should fetch a thread' do
|
51
|
+
subject.should_receive(:get).with('/api/v1/groups/1')
|
52
|
+
subject.get_group(1)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
describe '#create_group' do
|
57
|
+
it 'should fetch a thread' do
|
58
|
+
subject.should_receive(:post).with('/api/v1/groups', {
|
59
|
+
:name => 'my group',
|
60
|
+
:description => 'A test group',
|
61
|
+
:private => false
|
62
|
+
})
|
63
|
+
subject.create_group(:name => 'my group', :description => 'A test group', :private => false)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '#update_group' do
|
68
|
+
it 'should fetch a thread' do
|
69
|
+
subject.should_receive(:post).with('/api/v1/groups/2', {
|
70
|
+
:name => 'another group',
|
71
|
+
:description => 'A modified group description',
|
72
|
+
})
|
73
|
+
subject.update_group(2, :name => 'another group', :description => 'A modified group description')
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,60 @@
|
|
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 File.expand_path('../../spec_helper', __FILE__)
|
16
|
+
|
17
|
+
describe Yammer::Api::Search do
|
18
|
+
|
19
|
+
before :all do
|
20
|
+
@client = Yammer::Client.new(
|
21
|
+
:site_url => 'https://www.yammer.com',
|
22
|
+
:client_id => 'PRbTcg9qjgKsp4jjpm1pw',
|
23
|
+
:client_secret => 'Xn7kp7Ly0TCY4GtZWkmSsqGEPg10DmMADyjWkf2U',
|
24
|
+
:access_token => 'TolNOFka9Uls2DxahNi78A'
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
subject { @client }
|
29
|
+
|
30
|
+
describe '#invite' do
|
31
|
+
|
32
|
+
context 'with single email as string' do
|
33
|
+
it 'should invite users' do
|
34
|
+
subject.should_receive(:post).with('/api/v1/invitations', { :email => 'alice@yammer.com' })
|
35
|
+
subject.invite('alice@yammer.com ')
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'with single email as array' do
|
40
|
+
it 'should invite users' do
|
41
|
+
subject.should_receive(:post).with('/api/v1/invitations', { :email => 'bob@yammer.com' })
|
42
|
+
subject.invite(%w{bob@yammer.com})
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'with multiple emails as string' do
|
47
|
+
it 'should invite users' do
|
48
|
+
subject.should_receive(:post).with('/api/v1/invitations', { :email => 'bob@yammer.com,alice@yammer.com' })
|
49
|
+
subject.invite(' bob@yammer.com,alice@yammer.com ')
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
context 'with multiple emails as array' do
|
54
|
+
it 'should invite users' do
|
55
|
+
subject.should_receive(:post).with('/api/v1/invitations', { :email => 'bob@yammer.com,alice@yammer.com' })
|
56
|
+
subject.invite(%w{ bob@yammer.com alice@yammer.com })
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
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
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
16
|
+
|
17
|
+
describe Yammer::Api::Topic do
|
18
|
+
|
19
|
+
before :all do
|
20
|
+
@client = Yammer::Client.new(
|
21
|
+
:site_url => 'https://www.yammer.com',
|
22
|
+
:client_id => 'PRbTcg9qjgKsp4jjpm1pw',
|
23
|
+
:client_secret => 'Xn7kp7Ly0TCY4GtZWkmSsqGEPg10DmMADyjWkf2U',
|
24
|
+
:access_token => 'TolNOFka9Uls2DxahNi78A'
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
subject { @client }
|
29
|
+
|
30
|
+
describe '#likes' do
|
31
|
+
it 'should check if user likes open graph object' do
|
32
|
+
subject.should_receive(:get).with('/api/v1/likes/open_graph_object/1')
|
33
|
+
subject.likes_open_graph_object?(1)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should like open graph object' do
|
37
|
+
subject.should_receive(:post).with('/api/v1/likes', :id => 1, :type => 'OpenGraphObject')
|
38
|
+
subject.like('OpenGraphObject', 1)
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should unlike open graph object' do
|
42
|
+
subject.should_receive(:delete).with('/api/v1/likes/1')
|
43
|
+
subject.unlike(1)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,136 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
# Copyright (c) Microsoft Corporation
|
4
|
+
# All rights reserved.
|
5
|
+
#
|
6
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
|
+
# you may not use this file except in compliance with the License.
|
8
|
+
# You may obtain a copy of the License at
|
9
|
+
#
|
10
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
11
|
+
#
|
12
|
+
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
|
13
|
+
# ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY
|
14
|
+
# IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR
|
15
|
+
# PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
|
16
|
+
#
|
17
|
+
# See the Apache Version 2.0 License for specific language governing
|
18
|
+
# permissions and limitations under the License.
|
19
|
+
|
20
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
21
|
+
|
22
|
+
describe Yammer::Api::Message do
|
23
|
+
|
24
|
+
before :all do
|
25
|
+
@client = Yammer::Client.new(
|
26
|
+
:site_url => 'https://www.yammer.com',
|
27
|
+
:client_id => 'PRbTcg9qjgKsp4jjpm1pw',
|
28
|
+
:client_secret => 'Xn7kp7Ly0TCY4GtZWkmSsqGEPg10DmMADyjWkf2U',
|
29
|
+
:access_token => 'TolNOFka9Uls2DxahNi78A'
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
subject { @client }
|
34
|
+
|
35
|
+
describe '#all_messages' do
|
36
|
+
context 'with options' do
|
37
|
+
it 'should get_messages' do
|
38
|
+
params = { :page => 1 }
|
39
|
+
subject.should_receive(:get).with('/api/v1/messages', params)
|
40
|
+
subject.all_messages(params)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
context 'without options' do
|
45
|
+
it 'should return all messages viewable by a user' do
|
46
|
+
subject.should_receive(:get).with('/api/v1/messages', {})
|
47
|
+
subject.all_messages
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe '#create_message' do
|
53
|
+
it 'should create_message' do
|
54
|
+
message = 'Greetings, we come in peace'
|
55
|
+
subject.should_receive(:post).with('/api/v1/messages', :body => message)
|
56
|
+
subject.create_message(message)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
describe '#message' do
|
61
|
+
it 'should fetch a message' do
|
62
|
+
subject.should_receive(:get).with('/api/v1/messages/3')
|
63
|
+
subject.get_message(3)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
describe '#delete_message' do
|
68
|
+
it 'should delete a message' do
|
69
|
+
subject.should_receive(:delete).with('/api/v1/messages/4')
|
70
|
+
subject.delete_message(4)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
describe '#messages_sent' do
|
75
|
+
it 'should fetch messages sent by a user' do
|
76
|
+
subject.should_receive(:get).with('/api/v1/messages/sent', {})
|
77
|
+
subject.messages_sent
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
describe '#messages_received' do
|
82
|
+
it 'should fetch messages received by a user' do
|
83
|
+
subject.should_receive(:get).with('/api/v1/messages/received', {})
|
84
|
+
subject.messages_received
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
describe '#private_messages' do
|
89
|
+
it 'should fetch private messages' do
|
90
|
+
subject.should_receive(:get).with('/api/v1/messages/private', {})
|
91
|
+
subject.private_messages
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
describe '#followed_messages' do
|
96
|
+
it 'should fetch messages followed by a user' do
|
97
|
+
subject.should_receive(:get).with('/api/v1/messages/following', {})
|
98
|
+
subject.followed_messages
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
describe '#messages_from_user' do
|
103
|
+
it 'should fetch messages created by a user' do
|
104
|
+
subject.should_receive(:get).with('/api/v1/messages/from_user/14', {})
|
105
|
+
subject.messages_from_user(14)
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
describe '#messages_about_topic' do
|
110
|
+
it 'should fetch messages about a topic' do
|
111
|
+
subject.should_receive(:get).with('/api/v1/messages/about_topic/19', {})
|
112
|
+
subject.messages_about_topic(19)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
describe '#messages_in_group' do
|
117
|
+
it 'should fetch messages in group' do
|
118
|
+
subject.should_receive(:get).with('/api/v1/messages/in_group/26', {})
|
119
|
+
subject.messages_in_group(26)
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
describe '#messages_liked_by' do
|
124
|
+
it 'should fetch messages liked by user' do
|
125
|
+
subject.should_receive(:get).with('/api/v1/messages/liked_by/58', {})
|
126
|
+
subject.messages_liked_by(58)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
|
130
|
+
describe '#messages_in_thread' do
|
131
|
+
it 'should fetch messages in thread' do
|
132
|
+
subject.should_receive(:get).with('/api/v1/messages/in_thread/97', {})
|
133
|
+
subject.messages_in_thread(97)
|
134
|
+
end
|
135
|
+
end
|
136
|
+
end
|