summaryrefslogtreecommitdiff
path: root/spec/support/artifice/endpoint_extra_api.rb
blob: 62e2c2bb93291ecef79eedd3c89879b04dfee5f6 (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
33
34
# frozen_string_literal: true

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)