Skip to content

Commit 305f6fe

Browse files
committed
Change interface to listing unauthenticated user issues.
1 parent 476e89d commit 305f6fe

2 files changed

Lines changed: 11 additions & 12 deletions

File tree

lib/github_api/gists.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ def comments
2929
# List a user's gists.
3030
#
3131
# = Examples
32-
# github = Github.new :user => 'user-name'
33-
# github.gists.list
32+
# github = Github.new
33+
# github.gists.list user: 'user-name'
3434
#
3535
# List the authenticated user’s gists or if called anonymously,
3636
# this will returns all public gists
@@ -39,11 +39,10 @@ def comments
3939
# github = Github.new :oauth_token => '...'
4040
# github.gists.list
4141
#
42-
def list(user_name=nil, params={})
43-
_update_user_repo_params(user_name)
44-
process_params do
45-
normalize params
46-
end
42+
def list(params={})
43+
_normalize_params_keys(params)
44+
45+
user = params.delete('user')
4746

4847
response = if user
4948
get_request("/users/#{user}/gists", params)

spec/github/gists_spec.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,23 @@
2121
end
2222

2323
it "should get the resources" do
24-
github.gists.list user
24+
github.gists.list :user => user
2525
a_get("/users/#{user}/gists").should have_been_made
2626
end
2727

2828
it "should return array of resources" do
29-
gists = github.gists.list user
29+
gists = github.gists.list :user => user
3030
gists.should be_an Array
3131
gists.should have(1).items
3232
end
3333

3434
it "should be a mash type" do
35-
gists = github.gists.list user
35+
gists = github.gists.list :user => user
3636
gists.first.should be_a Hashie::Mash
3737
end
3838

3939
it "should get gist information" do
40-
gists = github.gists.list user
40+
gists = github.gists.list :user => user
4141
gists.first.user.login.should == 'octocat'
4242
end
4343

@@ -55,7 +55,7 @@
5555

5656
it "should return 404 with a message 'Not Found'" do
5757
expect {
58-
github.gists.list user
58+
github.gists.list :user => user
5959
}.to raise_error(Github::Error::NotFound)
6060
end
6161
end

0 commit comments

Comments
 (0)