Sha256: b84c596cee2da1659bc53406e791727df44ef9636816d99b21a6e6837ea81b88

Contents?: true

Size: 583 Bytes

Versions: 1

Compression:

Stored size: 583 Bytes

Contents

require 'sinatra/base'

class FakeMarvelApi < Sinatra::Base
  get '/v1/public/:resources' do
    json_response 200, "#{params['resources']}/list.json"
  end

  get '/v1/public/:resources/:id/:nested_resources' do
    json_response 200, "#{params['nested_resources']}/list.json"
  end

  get '/v1/public/:resources/:id' do
    json_response 200, "#{params['resources']}/show.json"
  end

private

  def json_response(response_code, file_name)
    content_type :json
    status response_code
    File.open(File.dirname(__FILE__) + '/fake_marvel_api/' + file_name, 'rb').read
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
uatu-marvel-0.1.0 spec/support/fake_marvel_api.rb