Class: FrederickAPI::V2::Helpers::BackgroundableParser

Inherits:
JsonApiClient::Parsers::Parser
  • Object
show all
Defined in:
lib/frederick_api/v2/helpers/backgroundable_parser.rb

Overview

Custom Parser for parsing BackgroundJob resources for FrederickAPI V2

Class Method Summary collapse

Class Method Details

.parse(klass, response) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/frederick_api/v2/helpers/backgroundable_parser.rb', line 8

def self.parse(klass, response)
  result_set = super(klass, response)
  return result_set unless result_set&.first&.type == 'background_jobs'
  result_set = super(::FrederickAPI::V2::BackgroundJob, response)
  result_set&.first&.response = { headers: response.headers, status: response.status }
  result_set
end