Permalink
Browse files

Enable gist listing

  • Loading branch information...
diogenes committed Oct 7, 2011
1 parent bff492a commit b44bc607ec11182d7dbf3cddfae50ece7cae1384
Showing with 20 additions and 2 deletions.
  1. +7 −2 lib/github/dsl.rb
  2. +9 −0 lib/github/models/gist.rb
  3. +4 −0 spec/github/github_spec.rb
View
@@ -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
@@ -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
@@ -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.