17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/hyperion/requestor.rb', line 17
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] || {}
render = opts[:render] || Proc.identity
project = project || Proc.identity
Hyperion.request(route, body, ) 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
|