summaryrefslogtreecommitdiff
path: root/spec/support/artifice/endpoint_extra_api.rb
blob: d6d1c5a1b4375c4141624860312536d3dfe2484d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require File.expand_path("../endpoint", __FILE__)

Artifice.deactivate

class EndpointExtraApi < Endpoint
  get "/extra/api/v1/dependencies" do
    deps = dependencies_for(params[:gems], gem_repo4)
    Marshal.dump(deps)
  end

  get "/extra/specs.4.8.gz" do
    File.read("#{gem_repo4}/specs.4.8.gz")
  end

  get "/extra/prerelease_specs.4.8.gz" do
    File.read("#{gem_repo4}/prerelease_specs.4.8.gz")
  end

  get "/extra/quick/Marshal.4.8/:id" do
    redirect "/extra/fetch/actual/gem/#{params[:id]}"
  end

  get "/extra/fetch/actual/gem/:id" do
    File.read("#{gem_repo4}/quick/Marshal.4.8/#{params[:id]}")
  end

  get "/extra/gems/:id" do
    File.read("#{gem_repo4}/gems/#{params[:id]}")
  end
end

Artifice.activate_with(EndpointExtraApi)