class Github::Client::Orgs

Organizations API

Public Instance Methods

all(*args)
Alias for: list
edit(*args) click to toggle source

Edit organization

@see developer.github.com/v3/orgs/#edit-an-organization

@param [Hash] params @option params [String] :billing_email

Billing email address. This address is not publicized.

@option params [String] :company

The company name

@option params [String] :email

The publicly visible email address

@option params [String] :location

The location

@option params [String] :name

The shorthand name of the company.

@option params [String] :description

The description of the company.

@example

github = Github.new oauth_token: '...'
github.orgs.edit 'github',
  billing_email: "support@github.com",
  blog: "https://github.com/blog",
  company: "GitHub",
  email: "support@github.com",
  location: "San Francisco",
  name: "github"

@api public

# File lib/github_api/client/orgs.rb, line 121
def edit(*args)
  arguments(args, required: [:org_name])

  patch_request("/orgs/#{arguments.org_name}", arguments.params)
end
find(*args)
Alias for: get
get(*args) click to toggle source

Get properties for a single organization

@see developer.github.com/v3/orgs/#get-an-organization

@example

github = Github.new
github.orgs.get 'github'

@api public

# File lib/github_api/client/orgs.rb, line 85
def get(*args)
  arguments(args, required: [:org_name])

  get_request("/orgs/#{arguments.org_name}", arguments.params)
end
Also aliased as: find
list(*args) { |el| ... } click to toggle source

List all organizations

Lists all organizations, in the order that they were created on GitHub.

@see developer.github.com/v3/orgs/#list-all-organizations

@param [Hash] params @option params [String] :since

The integer ID of the last Organization that you've seen.

@example

github = Github.new
github.orgs.list :every

List all public organizations for a user.

@see developer.github.com/v3/orgs/#list-user-organizations

@example

github = Github.new
github.orgs.list user: 'user-name'

List public and private organizations for the authenticated user.

@example

github = Github.new oauth_token: '..'
github.orgs.list

@api public

# File lib/github_api/client/orgs.rb, line 60
def list(*args)
  params = arguments(args).params

  if (user_name = params.delete('user'))
    response = get_request("/users/#{user_name}/orgs", params)
  elsif args.map(&:to_s).include?('every')
    response = get_request('/organizations', params)
  else
    # For the authenticated user
    response = get_request('/user/orgs', params)
  end
  return response unless block_given?
  response.each { |el| yield el }
end
Also aliased as: all