blob: 2fa852c9fdc4c6ccd4a73f57912d919ee422c1bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
module Github
class Response
attr_reader :headers, :body, :status
def initialize(headers, body, status)
@headers = headers
@body = Oj.load(body, class_cache: false, mode: :compat)
@status = status
end
def rels
links = headers['Link'].to_s.split(', ').map do |link|
href, name = link.match(/<(.*?)>; rel="(\w+)"/).captures
[name.to_sym, href]
end
Hash[*links.flatten]
end
end
end
|