Skip to content

Commit

Permalink
Merge pull request octokit#91 from hsbt/received_events
Browse files Browse the repository at this point in the history
Initial received_events API
  • Loading branch information
pengwynn committed May 18, 2012
2 parents f0e1b4c + 031a511 commit 8cfad62
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
10 changes: 10 additions & 0 deletions lib/octokit/client/events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ def user_events(user, options={})
get("/users/#{user}/events", options, 3)
end

# List events that a user has received
#
# @return [Array] A list of all user received events
# @see http://developer.github.com/v3/received_events
# @example List all user received events
# Octokit.received_events("sferik")
def received_events(user, options={})
get("/users/#{user}/received_events", options, 3)
end

# List events for a repository
#
# @param repo [String, Repository, Hash] A GitHub repository
Expand Down
11 changes: 10 additions & 1 deletion spec/octokit/client/events_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public_events.first.id.should == '1513284759'
end
end

describe ".user_events" do
it "should return all user events" do
stub_get("/users/sferik/events").
Expand All @@ -24,6 +24,15 @@
end
end

describe ".received_events" do
it "should return all user received events" do
stub_get("/users/sferik/received_events").
to_return(:body => fixture("v3/user_events.json"))
received_events = @client.received_events('sferik')
received_events.first.type.should == 'PushEvent'
end
end

describe ".repository_events" do
it "should return events for a repository" do
stub_get("/repos/sferik/rails_admin/events").
Expand Down

0 comments on commit 8cfad62

Please sign in to comment.