UNCOV
1
|
class GithubPullRequestFetcher |
× |
UNCOV
2
|
require 'http_request'
|
× |
3 |
|
|
UNCOV
4
|
class << self |
× |
UNCOV
5
|
def supports_url?(url) |
× |
UNCOV
6
|
lower_case_url = url.downcase |
× |
UNCOV
7
|
(HttpRequest.valid_url?(url) &&
|
× |
UNCOV
8
|
(lower_case_url.include? 'github') &&
|
× |
UNCOV
9
|
!%r{/pull/[0-9]+$}.match(lower_case_url).nil?)
|
× |
UNCOV
10
|
end
|
× |
UNCOV
11
|
end
|
× |
12 |
|
|
UNCOV
13
|
def initialize(params) |
× |
UNCOV
14
|
@url = params['url'] |
× |
UNCOV
15
|
end
|
× |
16 |
|
|
UNCOV
17
|
def fetch_content |
× |
UNCOV
18
|
url = @url + '.diff' |
× |
UNCOV
19
|
res = HttpRequest.get(url)
|
× |
20 |
|
|
UNCOV
21
|
if res.is_a? Net::HTTPSuccess |
× |
UNCOV
22
|
res.body |
× |
UNCOV
23
|
else
|
× |
UNCOV
24
|
''
|
× |
UNCOV
25
|
end
|
× |
UNCOV
26
|
end
|
× |
UNCOV
27
|
end
|
× |