Class: Hypernova::RequestService

Inherits:
Object
  • Object
show all
Includes:
PluginHelper
Defined in:
lib/hypernova/request_service.rb

Instance Method Summary collapse

Methods included from PluginHelper

#after_response, #get_view_data, #on_error, #on_success, #prepare_request, #send_request?, #will_send_request

Instance Method Details

#render_batch(jobs) ⇒ Object



8
9
10
11
12
13
14
15
# File 'lib/hypernova/request_service.rb', line 8

def render_batch(jobs)
  return render_batch_blank(jobs) if jobs.empty?
  response_body = Hypernova::ParsedResponse.new(jobs).body
  response_body.each do |index_string, resp|
    on_error(build_error(resp["error"]), jobs[index_string]) if resp["error"]
  end
  build_renderer(jobs).render(response_body)
end

#render_batch_blank(jobs) ⇒ Object



17
18
19
# File 'lib/hypernova/request_service.rb', line 17

def render_batch_blank(jobs)
  build_renderer(jobs).render_blank
end