Sha256: 28bc1bafbbd02d4e1e3d1a6e4784517f8fe49ce86dba684eddad80949c3c533c
Contents?: true
Size: 479 Bytes
Versions: 6
Compression:
Stored size: 479 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] } rescue MultiJson::ParseError => exception { error: exception.cause } 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
6 entries across 6 versions & 1 rubygems