module Octokit::Client::Licenses

Methods for licenses API

Public Instance Methods

license(license_name, options = {}) click to toggle source

List an individual license

@see developer.github.com/v3/licenses/#get-an-individual-license @param license_name [String] The license name @return <Sawyer::Resource> An individual license @example

Octokit.license 'mit'
# File lib/octokit/client/licenses.rb, line 26
def license(license_name, options = {})
  options = ensure_api_media_type(:licenses, options)
  get "licenses/#{license_name}", options
end
licenses(options = {}) click to toggle source

List all licenses

@see developer.github.com/v3/licenses/#list-all-licenses @return [Array<Sawyer::Resource>] A list of licenses @example

Octokit.licenses
# File lib/octokit/client/licenses.rb, line 14
def licenses(options = {})
  options = ensure_api_media_type(:licenses, options)
  paginate "licenses", options
end
repository_license_contents(repo, options = {}) click to toggle source

Returns the contents of the repository’s license file, if one is detected.

@see developer.github.com/v3/licenses/#get-the-contents-of-a-repositorys-license @param repo [Integer, String, Repository, Hash] A GitHub repository @option options [String] :ref name of the Commit/Branch/Tag. Defaults to 'master'. @return [Sawyer::Resource] The detail of the license file @example

Octokit.repository_license_contents 'benbalter/licensee'
# File lib/octokit/client/licenses.rb, line 39
def repository_license_contents(repo, options = {})
  options = ensure_api_media_type(:licenses, options)
  get "#{Repository.path repo}/license", options
end