class GitHubV3API::OrgsAPI
Provides access to the GitHub Orgs API (developer.github.com/v3/orgs/)
example:
api = GitHubV3API.new(ACCESS_TOKEN) # get list of all orgs to which the user belongs orgs = api.orgs.list #=> returns an array of GitHubV3API::Org instances an_org = api.orgs.get('github') #=> returns an instance of GitHubV3API::Org an_org.name #=> 'GitHub'
Public Class Methods
Typically not used directly. Use GitHubV3API#orgs
instead.
connection
-
an instance of
GitHubV3API
# File lib/github_v3_api/orgs_api.rb, line 23 def initialize(connection) @connection = connection end
Public Instance Methods
Returns a GitHubV3API::Org
instance for the specified org_login
.
org_login
-
the string ID of the organization, e.g. “github”
# File lib/github_v3_api/orgs_api.rb, line 38 def get(org_login) org_data = @connection.get("/orgs/#{org_login}") GitHubV3API::Org.new_with_all_data(self, org_data) end
Returns an array of GitHubV3API::Org
instances representing the public and private orgs to which the current user belongs.
# File lib/github_v3_api/orgs_api.rb, line 29 def list @connection.get('/user/orgs').map do |org_data| GitHubV3API::Org.new(self, org_data) end end
Returns an array of GitHubV3API::User
instances representing the members who belong to the specified organization.
org_login
-
the string ID of the organization, e.g. “github”
# File lib/github_v3_api/orgs_api.rb, line 57 def list_members(org_login) @connection.get("/orgs/#{org_login}/members").map do |user_data| GitHubV3API::User.new(@connection.users, user_data) end end
Returns an array of GitHubV3API::User
instances representing the members who belong to the specified organization who have publicly identified themselves as members of this organization.
org_login
-
the string ID of the organization, e.g. “github”
# File lib/github_v3_api/orgs_api.rb, line 68 def list_public_members(org_login) @connection.get("/orgs/#{org_login}/public_members").map do |user_data| GitHubV3API::User.new(@connection.users, user_data) end end
Returns an array of GitHubV3API::Repo
instances representing the repos that belong to the specified org.
org_login
-
the string ID of the organization, e.g. “github”
# File lib/github_v3_api/orgs_api.rb, line 47 def list_repos(org_login) @connection.get("/orgs/#{org_login}/repos").map do |repo_data| GitHubV3API::Repo.new(@connection.repos, repo_data) end end