Sha256: 6a78cca323f070c74c5a6a06e4f95a6d1b2093b464475f219b8ed0ef9406ee9f
Contents?: true
Size: 514 Bytes
Versions: 8
Compression:
Stored size: 514 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[:message]] } rescue MultiJson::ParseError => exception { errors: [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
8 entries across 8 versions & 1 rubygems