Skip to content

Commit

Permalink
Enable gist listing
Browse files Browse the repository at this point in the history
  • Loading branch information
diogenes committed Oct 7, 2011
1 parent bff492a commit b44bc60
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/github/dsl.rb
Expand Up @@ -64,10 +64,15 @@ def organization_public_members(organization_name)
h.map {|u| User.from_hash(u) }
end

def gists(login)
h = json("/users/#{login}/gists")
h.map {|g| Gist.from_hash(g) }
end

private

def json(path)
HTTParty.get('https://api.github.com' << path).parsed_response
end
end # Finders
end # GitHub
end
end
9 changes: 9 additions & 0 deletions lib/github/models/gist.rb
@@ -0,0 +1,9 @@
require 'github/models/base_model'

module GitHub
class Gist < BaseModel
def owner
@owner ||= GitHub::User.new(@table[:user])
end
end
end
4 changes: 4 additions & 0 deletions spec/github/github_spec.rb
Expand Up @@ -40,4 +40,8 @@
it "should be able to find a commit" do
subject.should respond_to(:commit)
end

it "should be able to find gists of an user" do
subject.should respond_to(:gists)
end
end

0 comments on commit b44bc60

Please sign in to comment.