20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/hyperion/requestor.rb', line 20
def request(route, opts={}, &project)
Hyperion::Util.guard_param(route, 'a RestRoute', RestRoute)
Hyperion::Util.guard_param(opts, 'an options hash', Hash)
body = opts[:body]
= opts[:headers] || {}
additional_handler_hash = opts[:also_handle] || {}
timeout = opts[:timeout] || 0
render = opts[:render] || Proc.identity
project = project || Proc.identity
Hyperion.request(route, body: body, additional_headers: , timeout: timeout) do |result|
all_handlers = [hash_handler(additional_handler_hash),
handler_from_including_class,
built_in_handler(project, render)]
all_handlers.each { |handlers| handlers.call(result) }
fallthrough(result)
end
end
|