123456789_123456789_123456789_123456789_123456789_

Module: Octokit::Client::Licenses

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/octokit/client/licenses.rb

Overview

Methods for licenses API

Instance Method Summary

Instance Method Details

#license(license_name, options = {}) ⇒ Sawyer::Resource

List an individual license

Examples:

Octokit.license 'mit'

Parameters:

  • license_name (String)

    The license name

Returns:

  • (Sawyer::Resource)

    An individual license

See Also:

[ GitHub ]

  
# 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 = {}) ⇒ Array<Sawyer::Resource>

List all licenses

Examples:

Octokit.licenses

Returns:

  • (Array<Sawyer::Resource>)

    A list of licenses

See Also:

[ GitHub ]

  
# 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 = {}) ⇒ Sawyer::Resource

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

Examples:

Octokit.repository_license_contents 'benbalter/licensee'

Parameters:

  • repo (Integer, String, Repository, Hash)

    A GitHub repository

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :ref (String)

    name of the Commit/Branch/Tag. Defaults to 'master'.

Returns:

  • (Sawyer::Resource)

    The detail of the license file

See Also:

[ GitHub ]

  
# 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