7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/pdc/http/response/pagination.rb', line 7
def parse(json)
logger.debug "\n.....paginate json ....................................."
metadata = json[:metadata]
logger.debug metadata
return json unless paginated?(metadata)
metadata[PDC::Resource::PAGINATION] = {
resource_count: metadata.delete(:count),
next_page: request_uri(metadata.delete(:next)),
previous_page: request_uri(metadata.delete(:previous))
}
logger.debug '... after parsing pagination data:'
logger.debug metadata
json
end
|