Class: Nova::API::ListResponse
Constant Summary
Utils::BaseStruct::DATE_REGEX
Class Method Summary
collapse
#allowed_attributes
Class Method Details
.build(response, klass) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/nova/api/list_response.rb', line 13
def self.build(response, klass)
success = response.success?
status = response.code
parsed_response = response.parsed_response
records = nil
if parsed_response.is_a?(Array)
records = build_records(klass, parsed_response)
else
parsed_response = parsed_response.to_h
errors = ('error', parsed_response)
errors ||= ('errors', parsed_response)
end
errors ||= []
new(success: success, errors: errors, records: records, status: status)
end
|