Sha256: 0eb477b61971334074651919091c0db750b3e9256413b5329b3dce3e25d38c41
Contents?: true
Size: 605 Bytes
Versions: 5
Compression:
Stored size: 605 Bytes
Contents
module Georeferencer class Parser < Faraday::Response::Middleware def on_complete(env) json = Oj.load(env[:body], symbolize_keys: true) if json.has_key?("@list") start = nil if json["next"].present? query = URI.parse(json["next"]).query start = query.scan(/start=([^$]+)/).flatten.first end body = { data: json["@list"] } body.merge!({metadata: {start: start}}) env[:body] = body else env[:body] = { data: json.with_indifferent_access } end end end end
Version data entries
5 entries across 5 versions & 1 rubygems