Skip to content
This repository has been archived by the owner on Apr 2, 2020. It is now read-only.

Commit

Permalink
Add gist support to GithubRepositoryCollection
Browse files Browse the repository at this point in the history
- #gists
- #starred_gists
  • Loading branch information
garethrees committed Sep 8, 2015
1 parent c7d4d44 commit e89eeda
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions lib/github-backup/github_repository_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,28 @@ def repos(username)
all(first_page).map { |r| GithubBackup::Repository.new(r) }
end

def gists(username)
first_page =
if username_is_authenticated_user?(username)
client.gists
else
client.gists(username)
end

all(first_page).map { |r| GithubBackup::Gist.new(r) }
end

def starred_gists(username)
first_page =
if username_is_authenticated_user?(username)
client.starred_gists
else
client.starred_gists(username)
end

all(first_page).map { |r| GithubBackup::Gist.new(r) }
end

private

def all(first_page)
Expand Down

0 comments on commit e89eeda

Please sign in to comment.