Sha256: 62c2bc6ed6a2574789e7f9ef275a21ffe25b37c7e0843e9f1d5bf7f998457d0d

Contents?: true

Size: 1.56 KB

Versions: 50

Compression:

Stored size: 1.56 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.repository_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

50 entries across 33 versions & 2 rubygems

Version Path
octokit-4.24.0 lib/octokit/client/licenses.rb
tdiary-5.2.2 vendor/bundle/ruby/3.1.0/gems/octokit-4.23.0/lib/octokit/client/licenses.rb
octokit-4.23.0 lib/octokit/client/licenses.rb
tdiary-5.2.1 vendor/bundle/ruby/3.1.0/gems/octokit-4.22.0/lib/octokit/client/licenses.rb
octokit-4.22.0 lib/octokit/client/licenses.rb
tdiary-5.2.0 vendor/bundle/ruby/2.7.0/gems/octokit-4.21.0/lib/octokit/client/licenses.rb
tdiary-5.2.0 vendor/bundle/ruby/3.0.0/gems/octokit-4.21.0/lib/octokit/client/licenses.rb
tdiary-5.1.7 vendor/bundle/ruby/3.0.0/gems/octokit-4.21.0/lib/octokit/client/licenses.rb
tdiary-5.1.7 vendor/bundle/ruby/2.7.0/gems/octokit-4.21.0/lib/octokit/client/licenses.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/octokit-4.19.0/lib/octokit/client/licenses.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/octokit-4.20.0/lib/octokit/client/licenses.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/octokit-4.21.0/lib/octokit/client/licenses.rb
tdiary-5.1.6 vendor/bundle/ruby/3.0.0/gems/octokit-4.21.0/lib/octokit/client/licenses.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/octokit-4.20.0/lib/octokit/client/licenses.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/octokit-4.19.0/lib/octokit/client/licenses.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/octokit-4.20.0/lib/octokit/client/licenses.rb
octokit-4.21.0 lib/octokit/client/licenses.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/octokit-4.19.0/lib/octokit/client/licenses.rb
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/octokit-4.20.0/lib/octokit/client/licenses.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/octokit-4.20.0/lib/octokit/client/licenses.rb