Sha256: f8923f8fec85bf5d5dd24c3490141d69b43fb84eee3353651ba34a45fc1cf19b

Contents?: true

Size: 1.55 KB

Versions: 15

Compression:

Stored size: 1.55 KB

Contents

module Octokit
  class Client

    # Methods for licenses API
    #
    module Licenses

      # List all licenses
      #
      # @see https://developer.github.com/v3/licenses/#list-all-licenses
      # @return [Array<Sawyer::Resource>] A list of licenses
      # @example
      #   Octokit.licenses
      def licenses(options = {})
        options = ensure_api_media_type(:licenses, options)
        paginate "licenses", options
      end

      # List an individual license
      #
      # @see https://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'
      def license(license_name, options = {})
        options = ensure_api_media_type(:licenses, options)
        get "licenses/#{license_name}", options
      end

      # Returns the contents of the repository’s license file, if one is detected.
      #
      # @see https://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.license_contents 'benbalter/licensee'
      def repository_license_contents(repo, options = {})
        options = ensure_api_media_type(:licenses, options)
        get "#{Repository.path repo}/license", options
      end
    end
  end
end

Version data entries

15 entries across 13 versions & 3 rubygems

Version Path
tdiary-5.0.6 vendor/bundle/gems/octokit-4.7.0/lib/octokit/client/licenses.rb
tdiary-5.0.5 vendor/bundle/gems/tdiary-5.0.4/vendor/bundle/gems/octokit-4.6.2/lib/octokit/client/licenses.rb
tdiary-5.0.5 vendor/bundle/gems/octokit-4.6.2/lib/octokit/client/licenses.rb
tdiary-5.0.5 vendor/bundle/gems/octokit-4.7.0/lib/octokit/client/licenses.rb
octokit-4.7.0 lib/octokit/client/licenses.rb
octodoggy-4.6.2 lib/octokit/client/licenses.rb
tdiary-5.0.4 vendor/bundle/gems/octokit-4.6.2/lib/octokit/client/licenses.rb
octokit-4.6.2 lib/octokit/client/licenses.rb
octokit-4.6.1 lib/octokit/client/licenses.rb
octokit-4.6.0 lib/octokit/client/licenses.rb
octokit-4.4.1 lib/octokit/client/licenses.rb
octokit-4.4.0 lib/octokit/client/licenses.rb
tdiary-5.0.2 vendor/bundle/gems/octokit-4.3.0/lib/octokit/client/licenses.rb
tdiary-5.0.1 vendor/bundle/gems/octokit-4.3.0/lib/octokit/client/licenses.rb
octokit-4.3.0 lib/octokit/client/licenses.rb