8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/zendesk_api/sideloading.rb', line 8
def set_includes(resource_or_resources, includes, body)
@included = {}
includes.each do |side_load|
unless body.key?(side_load.to_s)
@client.config.logger.warn "Missing #{side_load} key in response -- cannot side load"
end
end
resources = to_array(resource_or_resources)
resource_class = resources.first.class
return if resources.empty?
body.keys.each do |name|
@included[name] = body[name]
_side_load(name, resource_class, resources)
end
end
|