Sha256: 5d0d941f87f93e4aa19f414441f0a80a2bae56395a87ce7df7dfdf457833e3d6
Contents?: true
Size: 1.07 KB
Versions: 3
Compression:
Stored size: 1.07 KB
Contents
require "cp8_cli/github/base" require "cp8_cli/repo" module Cp8Cli module Github class PullRequest < Base def self.create(attributes = {}) new(attributes).save end def initialize(from:, to:, title: nil, body: nil) @title = title @body = body @from = from @to = to end def open(expand: 1) query = base_query.merge(expand: expand) url = "#{base_url}?#{query.compact.to_query}" Command.open_url(url) end def save client.create_pull_request( repo.shorthand, to, from, title, body ) end private attr_reader :from, :to, :title, :body def base_url repo.url + "/compare/#{escape to}...#{escape from}" end def base_query { title: title, body: body, } end def escape(text) CGI.escape(text.to_s.strip) end def repo @_repo ||= Repo.current end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cp8_cli-6.0.1 | lib/cp8_cli/github/pull_request.rb |
cp8_cli-6.0.0 | lib/cp8_cli/github/pull_request.rb |
cp8_cli-5.0.0 | lib/cp8_cli/github/pull_request.rb |