Class: Cipr::PullRequest

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/cipr/pull_request.rb

Instance Method Summary collapse

Constructor Details

#initialize(repo, *args) ⇒ PullRequest

Returns a new instance of PullRequest.



4
5
6
7
# File 'lib/cipr/pull_request.rb', line 4

def initialize(repo, *args)
  @repo = repo
  super(*args)
end

Instance Method Details

#applyObject



42
43
44
# File 'lib/cipr/pull_request.rb', line 42

def apply
  @repo.apply_pull_request(self)
end

#checkoutObject



46
47
48
# File 'lib/cipr/pull_request.rb', line 46

def checkout
  @repo.checkout_pull_request(self)
end

#comment(body) ⇒ Object



9
10
11
# File 'lib/cipr/pull_request.rb', line 9

def comment(body)
  @repo.comment(self.number, body)
end

#merge_fromObject



29
30
31
# File 'lib/cipr/pull_request.rb', line 29

def merge_from
  head['ref']
end

#merge_toObject



25
26
27
# File 'lib/cipr/pull_request.rb', line 25

def merge_to
  base['ref']
end

#mergeable?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/cipr/pull_request.rb', line 13

def mergeable?
  mergeable
end

#merged?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/cipr/pull_request.rb', line 17

def merged?
  merged
end

#pull_repoObject



33
34
35
36
37
38
39
40
# File 'lib/cipr/pull_request.rb', line 33

def pull_repo
  auth = @repo.auth_string
  if auth && !auth.empty?
    head['repo']['clone_url'].sub("https://", "https://#{auth}@")
  else
    head['repo']['clone_url']
  end
end

#usernameObject



21
22
23
# File 'lib/cipr/pull_request.rb', line 21

def username
  head['user']['login']
end