Sha256: 680bba796540be12bbf969229d1c410dda9d3d3bc0d16c41c5c952cf726f4262
Contents?: true
Size: 532 Bytes
Versions: 12
Compression:
Stored size: 532 Bytes
Contents
# Set up dummy api class JSONParser < Faraday::Response::Middleware def parse(body) json = MultiJson.load(body, symbolize_keys: true) { data: json[:result], metadata: json[:metadata], errors: json[:errors] } rescue MultiJson::ParseError => exception { errors: { base: [ error: exception.message ] } } end end Spyke::Config.connection = Faraday.new(url: 'http://sushi.com') do |faraday| faraday.request :json faraday.use JSONParser faraday.adapter Faraday.default_adapter end
Version data entries
12 entries across 12 versions & 1 rubygems