Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add .all_repositories

.all_repositories hits the new /repositories api endpoint that lists all the
repositories on GitHub.

http://developer.github.com/v3/repos/#list-all-repositories
  • Loading branch information...
commit 87ffe42308e90cb17e31066b16167d3995c61b02 1 parent 7dd393f
@joeyw joeyw authored
View
16 lib/octokit/client/repositories.rb
@@ -62,6 +62,22 @@ def repositories(username=nil, options={})
alias :list_repos :repositories
alias :repos :repositories
+ # List all repositories
+ #
+ # This provides a dump of every repository, in the order that they were
+ # created.
+ #
+ # @see http://developer.github.com/v3/repos/#list-all-repositories
+ #
+ # @param options [Hash] Optional options
+ # @option options [Integer] :since The integer ID of the last Repository
+ # that you’ve seen.
+ #
+ # @return [Array] List of repositories.
+ def all_repositories(options={})
+ get '/repositories', options
+ end
+
# Star a repository
#
# @param repo [String, Hash, Repository] A GitHub repository
View
122 spec/fixtures/all_repositories.json
@@ -0,0 +1,122 @@
+[
+ {
+ "archive_url": "https://api.github.com/repos/mojombo/grit/{archive_format}{/ref}",
+ "issue_comment_url": "https://api.github.com/repos/mojombo/grit/issues/comments/{number}",
+ "branches_url": "https://api.github.com/repos/mojombo/grit/branches{/branch}",
+ "full_name": "mojombo/grit",
+ "notifications_url": "https://api.github.com/repos/mojombo/grit/notifications{?since,all,participating}",
+ "compare_url": "https://api.github.com/repos/mojombo/grit/compare/{base}...{head}",
+ "subscribers_url": "https://api.github.com/repos/mojombo/grit/subscribers",
+ "stargazers_url": "https://api.github.com/repos/mojombo/grit/stargazers",
+ "collaborators_url": "https://api.github.com/repos/mojombo/grit/collaborators{/collaborator}",
+ "html_url": "https://github.com/mojombo/grit",
+ "owner": {
+ "login": "mojombo",
+ "starred_url": "https://api.github.com/users/mojombo/starred{/owner}{/repo}",
+ "gists_url": "https://api.github.com/users/mojombo/gists{/gist_id}",
+ "organizations_url": "https://api.github.com/users/mojombo/orgs",
+ "followers_url": "https://api.github.com/users/mojombo/followers",
+ "url": "https://api.github.com/users/mojombo",
+ "repos_url": "https://api.github.com/users/mojombo/repos",
+ "following_url": "https://api.github.com/users/mojombo/following",
+ "avatar_url": "https://secure.gravatar.com/avatar/25c7c18223fb42a4c6ae1c8db6f50f9b?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
+ "gravatar_id": "25c7c18223fb42a4c6ae1c8db6f50f9b",
+ "received_events_url": "https://api.github.com/users/mojombo/received_events",
+ "subscriptions_url": "https://api.github.com/users/mojombo/subscriptions",
+ "id": 1,
+ "events_url": "https://api.github.com/users/mojombo/events{/privacy}"
+ },
+ "labels_url": "https://api.github.com/repos/mojombo/grit/labels{/name}",
+ "pulls_url": "https://api.github.com/repos/mojombo/grit/pulls{/number}",
+ "contributors_url": "https://api.github.com/repos/mojombo/grit/contributors",
+ "blobs_url": "https://api.github.com/repos/mojombo/grit/git/blobs{/sha}",
+ "issues_url": "https://api.github.com/repos/mojombo/grit/issues{/number}",
+ "comments_url": "https://api.github.com/repos/mojombo/grit/comments{/number}",
+ "subscription_url": "https://api.github.com/repos/mojombo/grit/subscription",
+ "teams_url": "https://api.github.com/repos/mojombo/grit/teams",
+ "keys_url": "https://api.github.com/repos/mojombo/grit/keys{/key_id}",
+ "milestones_url": "https://api.github.com/repos/mojombo/grit/milestones{/number}",
+ "downloads_url": "https://api.github.com/repos/mojombo/grit/downloads",
+ "git_tags_url": "https://api.github.com/repos/mojombo/grit/git/tags{/sha}",
+ "git_commits_url": "https://api.github.com/repos/mojombo/grit/git/commits{/sha}",
+ "hooks_url": "https://api.github.com/repos/mojombo/grit/hooks",
+ "description": "Grit gives you object oriented read/write access to Git repositories via Ruby.",
+ "git_refs_url": "https://api.github.com/repos/mojombo/grit/git/refs{/sha}",
+ "url": "https://api.github.com/repos/mojombo/grit",
+ "contents_url": "https://api.github.com/repos/mojombo/grit/contents/{+path}",
+ "tags_url": "https://api.github.com/repos/mojombo/grit/tags{/tag}",
+ "issue_events_url": "https://api.github.com/repos/mojombo/grit/issues/events{/number}",
+ "fork": false,
+ "commits_url": "https://api.github.com/repos/mojombo/grit/commits{/sha}",
+ "trees_url": "https://api.github.com/repos/mojombo/grit/git/trees{/sha}",
+ "name": "grit",
+ "merges_url": "https://api.github.com/repos/mojombo/grit/merges",
+ "languages_url": "https://api.github.com/repos/mojombo/grit/languages",
+ "assignees_url": "https://api.github.com/repos/mojombo/grit/assignees{/user}",
+ "private": false,
+ "id": 1,
+ "statuses_url": "https://api.github.com/repos/mojombo/grit/statuses/{sha}",
+ "events_url": "https://api.github.com/repos/mojombo/grit/events",
+ "forks_url": "https://api.github.com/repos/mojombo/grit/forks"
+ },
+ {
+ "archive_url": "https://api.github.com/repos/wycats/merb-core/{archive_format}{/ref}",
+ "issue_comment_url": "https://api.github.com/repos/wycats/merb-core/issues/comments/{number}",
+ "branches_url": "https://api.github.com/repos/wycats/merb-core/branches{/branch}",
+ "full_name": "wycats/merb-core",
+ "notifications_url": "https://api.github.com/repos/wycats/merb-core/notifications{?since,all,participating}",
+ "compare_url": "https://api.github.com/repos/wycats/merb-core/compare/{base}...{head}",
+ "subscribers_url": "https://api.github.com/repos/wycats/merb-core/subscribers",
+ "stargazers_url": "https://api.github.com/repos/wycats/merb-core/stargazers",
+ "collaborators_url": "https://api.github.com/repos/wycats/merb-core/collaborators{/collaborator}",
+ "html_url": "https://github.com/wycats/merb-core",
+ "owner": {
+ "login": "wycats",
+ "starred_url": "https://api.github.com/users/wycats/starred{/owner}{/repo}",
+ "gists_url": "https://api.github.com/users/wycats/gists{/gist_id}",
+ "organizations_url": "https://api.github.com/users/wycats/orgs",
+ "followers_url": "https://api.github.com/users/wycats/followers",
+ "url": "https://api.github.com/users/wycats",
+ "repos_url": "https://api.github.com/users/wycats/repos",
+ "following_url": "https://api.github.com/users/wycats/following",
+ "avatar_url": "https://secure.gravatar.com/avatar/428167a3ec72235ba971162924492609?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-user-420.png",
+ "gravatar_id": "428167a3ec72235ba971162924492609",
+ "received_events_url": "https://api.github.com/users/wycats/received_events",
+ "subscriptions_url": "https://api.github.com/users/wycats/subscriptions",
+ "id": 4,
+ "events_url": "https://api.github.com/users/wycats/events{/privacy}"
+ },
+ "labels_url": "https://api.github.com/repos/wycats/merb-core/labels{/name}",
+ "pulls_url": "https://api.github.com/repos/wycats/merb-core/pulls{/number}",
+ "contributors_url": "https://api.github.com/repos/wycats/merb-core/contributors",
+ "blobs_url": "https://api.github.com/repos/wycats/merb-core/git/blobs{/sha}",
+ "issues_url": "https://api.github.com/repos/wycats/merb-core/issues{/number}",
+ "comments_url": "https://api.github.com/repos/wycats/merb-core/comments{/number}",
+ "subscription_url": "https://api.github.com/repos/wycats/merb-core/subscription",
+ "teams_url": "https://api.github.com/repos/wycats/merb-core/teams",
+ "keys_url": "https://api.github.com/repos/wycats/merb-core/keys{/key_id}",
+ "milestones_url": "https://api.github.com/repos/wycats/merb-core/milestones{/number}",
+ "downloads_url": "https://api.github.com/repos/wycats/merb-core/downloads",
+ "git_tags_url": "https://api.github.com/repos/wycats/merb-core/git/tags{/sha}",
+ "git_commits_url": "https://api.github.com/repos/wycats/merb-core/git/commits{/sha}",
+ "hooks_url": "https://api.github.com/repos/wycats/merb-core/hooks",
+ "description": "Merb Core: All you need. None you don't.",
+ "git_refs_url": "https://api.github.com/repos/wycats/merb-core/git/refs{/sha}",
+ "url": "https://api.github.com/repos/wycats/merb-core",
+ "contents_url": "https://api.github.com/repos/wycats/merb-core/contents/{+path}",
+ "tags_url": "https://api.github.com/repos/wycats/merb-core/tags{/tag}",
+ "issue_events_url": "https://api.github.com/repos/wycats/merb-core/issues/events{/number}",
+ "fork": false,
+ "commits_url": "https://api.github.com/repos/wycats/merb-core/commits{/sha}",
+ "trees_url": "https://api.github.com/repos/wycats/merb-core/git/trees{/sha}",
+ "name": "merb-core",
+ "merges_url": "https://api.github.com/repos/wycats/merb-core/merges",
+ "languages_url": "https://api.github.com/repos/wycats/merb-core/languages",
+ "assignees_url": "https://api.github.com/repos/wycats/merb-core/assignees{/user}",
+ "private": false,
+ "id": 26,
+ "statuses_url": "https://api.github.com/repos/wycats/merb-core/statuses/{sha}",
+ "events_url": "https://api.github.com/repos/wycats/merb-core/events",
+ "forks_url": "https://api.github.com/repos/wycats/merb-core/forks"
+ }
+]
View
11 spec/octokit/client/repositories_spec.rb
@@ -68,6 +68,17 @@
end
+ describe ".all_repositories" do
+
+ it "returns all repositories on github" do
+ stub_get("/repositories").
+ to_return(json_response("all_repositories.json"))
+ repositories = @client.all_repositories
+ expect(repositories.first.name).to eq("grit")
+ end
+
+ end
+
describe ".star" do
it "stars a repository" do
Please sign in to comment.
Something went wrong with that request. Please try again.