Sha256: bc2e54637068848cb1eeb1135d44339d9202f223deeb0ee17ffeb08639742225

Contents?: true

Size: 1.97 KB

Versions: 10

Compression:

Stored size: 1.97 KB

Contents

module Octokit
  class Client

    # Methods for the Commit Statuses API
    #
    # @see https://developer.github.com/v3/repos/statuses/
    module Statuses

      # List all statuses for a given commit
      #
      # @param repo [Integer, String, Repository, Hash] A GitHub repository
      # @param sha [String] The SHA1 for the commit
      # @return [Array<Sawyer::Resource>] A list of statuses
      # @see https://developer.github.com/v3/repos/statuses/#list-statuses-for-a-specific-ref
      def statuses(repo, sha, options = {})
        get "#{Repository.path repo}/statuses/#{sha}", options
      end
      alias :list_statuses :statuses

      # Get the combined status for a ref
      #
      # @param repo [Integer, String, Repository, Hash] a GitHub repository
      # @param ref  [String] A Sha or Ref to fetch the status of
      # @return [Sawyer::Resource] The combined status for the commit
      # @see https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref
      def combined_status(repo, ref, options = {})
        get "#{Repository.path repo}/commits/#{ref}/status", options
      end
      alias :status :combined_status

      # Create status for a commit
      #
      # @param repo [Integer, String, Repository, Hash] A GitHub repository
      # @param sha [String] The SHA1 for the commit
      # @param state [String] The state: pending, success, failure, error
      # @option options [String] :context A context to differentiate this status from others
      # @option options [String] :target_url A link to more details about this status
      # @option options [String] :description A short human-readable description of this status
      # @return [Sawyer::Resource] A status
      # @see https://developer.github.com/v3/repos/statuses/#create-a-status
      def create_status(repo, sha, state, options = {})
        options = options.merge(:state => state)
        post "#{Repository.path repo}/statuses/#{sha}", options
      end
    end
  end
end

Version data entries

10 entries across 8 versions & 2 rubygems

Version Path
tdiary-5.0.9 vendor/bundle/gems/octokit-4.9.0/lib/octokit/client/statuses.rb
octokit-4.9.0 lib/octokit/client/statuses.rb
tdiary-5.0.8 vendor/bundle/gems/octokit-4.8.0/lib/octokit/client/statuses.rb
tdiary-5.0.8 vendor/bundle/ruby/2.5.0/gems/octokit-4.8.0/lib/octokit/client/statuses.rb
tdiary-5.0.8 vendor/bundle/gems/tdiary-5.0.7/vendor/bundle/gems/octokit-4.8.0/lib/octokit/client/statuses.rb
tdiary-5.0.7 vendor/bundle/gems/octokit-4.8.0/lib/octokit/client/statuses.rb
octokit-4.8.0 lib/octokit/client/statuses.rb
tdiary-5.0.6 vendor/bundle/gems/octokit-4.7.0/lib/octokit/client/statuses.rb
tdiary-5.0.5 vendor/bundle/gems/octokit-4.7.0/lib/octokit/client/statuses.rb
octokit-4.7.0 lib/octokit/client/statuses.rb