Sha256: 43e78154075bd42a23b798c53160c3595473f544131dbf1427daed63a622a9a0

Contents?: true

Size: 1.35 KB

Versions: 14

Compression:

Stored size: 1.35 KB

Contents

# encoding: utf-8

module Github
  # The Repo Merging API supports merging branches in a repository. This
  # accomplishes essentially the same thing as merging one branch into another
  # in a local repository and then pushing to GitHub.
  class Repos::Merging < API

    VALID_MERGE_PARAM_NAMES = %w[
      base
      head
      commit_message
    ].freeze # :nodoc:

    REQUIRED_MERGE_PARAMS = %w[ base head ].freeze # :nodoc:

    # Perform a merge
    #
    # = Inputs
    # * <tt>:base</tt> - Required String - The name of the base branch that the head will be merged into.
    # * <tt>:head</tt> - Required String - The head to merge. This can be a branch name or a commit SHA1.
    # * <tt>:commit_message</tt> - Optional String - Commit message to use for the merge commit. If omitted, a default message will be used.
    #
    # = Examples
    #  github = Github.new
    #  github.repos.merging.merge 'user', 'repo',
    #    "base": "master",
    #    "head": "cool_feature",
    #    "commit_message": "Shipped cool_feature!"
    #
    def merge(user_name, repo_name, params={})
      set :user => user_name, :repo => repo_name
      normalize! params
      filter! VALID_MERGE_PARAM_NAMES, params
      assert_required_keys REQUIRED_MERGE_PARAMS, params

      post_request("/repos/#{user_name}/#{repo_name}/merges", params)
    end

  end # Repos::Merging
end # Github

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
github_api-0.9.0 lib/github_api/repos/merging.rb
github_api-0.8.11 lib/github_api/repos/merging.rb
github_api-0.8.10 lib/github_api/repos/merging.rb
github_api-0.8.9 lib/github_api/repos/merging.rb
github_api-0.8.8 lib/github_api/repos/merging.rb
github_api-0.8.7 lib/github_api/repos/merging.rb
github_api-0.8.6 lib/github_api/repos/merging.rb
github_api-0.8.5 lib/github_api/repos/merging.rb
github_api-0.8.4 lib/github_api/repos/merging.rb
github_api-0.8.3 lib/github_api/repos/merging.rb
github_api-0.8.2 lib/github_api/repos/merging.rb
github_api-0.8.1 lib/github_api/repos/merging.rb
github_api-0.8.0 lib/github_api/repos/merging.rb
github_api-0.7.2 lib/github_api/repos/merging.rb