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

Version Path
spyke-1.8.11 test/support/api.rb
spyke-1.8.10 test/support/api.rb
spyke-1.8.9 test/support/api.rb
spyke-1.8.8 test/support/api.rb
spyke-1.8.7 test/support/api.rb
spyke-1.8.6 test/support/api.rb
spyke-1.8.5 test/support/api.rb
spyke-1.8.4 test/support/api.rb
spyke-1.8.3 test/support/api.rb
spyke-1.8.2 test/support/api.rb
spyke-1.8.1 test/support/api.rb
spyke-1.8.0 test/support/api.rb