Skip to content

Commit

Permalink
Merge pull request #35 from wilkenm/master
Browse files Browse the repository at this point in the history
Add access the the /user/in_group method from the REST API
  • Loading branch information
tiabas committed Nov 10, 2014
2 parents be2a7f7 + 419a4c2 commit 378acd0
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/yammer/api/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,19 @@ def users_following(id)
def users_followed_by(id)
get("/api/v1/users/followed_by/#{id}")
end

# @rate_limited Yes
# @authentication Requires user context
# @raise [Yammer::Error::Unauthorized] Error raised when supplied user credentials are not valid.
# @return [Yammer::ApiResponse]
# @param id [Integer] the ID of the group for which you want to get the members of
# @param opts [Hash] A customizable set of opts.
# @option opts [Integer] :page
# @example Fetch users in a group that the authenticated user is in
# Yammer.users_in_group(1)
def users_in_group(id, opts={})
get("/api/v1/users/in_group/#{id}", opts)
end
end
end
end
end
12 changes: 12 additions & 0 deletions spec/api/user_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,16 @@
@client.users_followed_by(4)
end
end

describe 'users_in_group' do
it 'makes an http request without' do
@client.should_receive(:get).with('/api/v1/users/in_group/5', {})
@client.users_in_group(5)
end

it 'makes an http request with optional parameters' do
@client.should_receive(:get).with('/api/v1/users/in_group/5', {:page => 2})
@client.users_in_group(5, {:page => 2})
end
end
end

0 comments on commit 378acd0

Please sign in to comment.