Sha256: d22ae67d471b333befd65e8f72bff41e8f0ab55bde5fee2147f2928745d838c0

Contents?: true

Size: 1.41 KB

Versions: 19

Compression:

Stored size: 1.41 KB

Contents

# frozen_string_literal: true

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 = {})
        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 = {})
        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.repository_license_contents 'benbalter/licensee'
      def repository_license_contents(repo, options = {})
        get "#{Repository.path repo}/license", options
      end
    end
  end
end

Version data entries

19 entries across 19 versions & 2 rubygems

Version Path
octokit-9.2.0 lib/octokit/client/licenses.rb
octokit-9.1.0 lib/octokit/client/licenses.rb
octokit-9.0.0 lib/octokit/client/licenses.rb
octokit-8.1.0 lib/octokit/client/licenses.rb
octokit-8.0.0 lib/octokit/client/licenses.rb
octokit-7.2.0 lib/octokit/client/licenses.rb
octokit-7.1.0 lib/octokit/client/licenses.rb
octokit-7.0.0 lib/octokit/client/licenses.rb
octokit-6.1.1 lib/octokit/client/licenses.rb
octokit-6.1.0 lib/octokit/client/licenses.rb
octokit-6.0.1 lib/octokit/client/licenses.rb
octokit-6.0.0 lib/octokit/client/licenses.rb
octokit-5.6.1 lib/octokit/client/licenses.rb
octokit-5.6.0 lib/octokit/client/licenses.rb
octokit-5.5.0 lib/octokit/client/licenses.rb
octokit-5.4.0 lib/octokit/client/licenses.rb
tdiary-5.2.3 vendor/bundle/ruby/3.1.0/gems/octokit-5.3.0/lib/octokit/client/licenses.rb
octokit-5.3.0 lib/octokit/client/licenses.rb
octokit-5.2.0 lib/octokit/client/licenses.rb