Sha256: 78f21f2290d710e20388412f86aa2ebc407c7256ed61c7b5d6881c4dbe3b6553
Contents?: true
Size: 812 Bytes
Versions: 6
Compression:
Stored size: 812 Bytes
Contents
require "hypernova/batch_renderer" require "hypernova/parsed_response" require "hypernova/plugin_helper" class Hypernova::RequestService include Hypernova::PluginHelper 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.to_i]) if resp["error"] end build_renderer(jobs).render(response_body) end def render_batch_blank(jobs) build_renderer(jobs).render_blank end private def build_error(error) { 'name' => error['name'], 'message' => error['message'], 'stack' => error['stack'], } end def build_renderer(jobs) Hypernova::BatchRenderer.new(jobs) end end
Version data entries
6 entries across 6 versions & 1 rubygems