v3: remove include param from POST templates

This commit is contained in:
Konstantin Haase 2015-04-15 13:23:05 +02:00
parent c3ce4738ec
commit 23c72dfa69
2 changed files with 4 additions and 4 deletions

View File

@ -34,7 +34,7 @@ module Travis::API::V3
pattern = sub_route ? resource.route + sub_route : resource.route
factory = Services[resource.identifier][service]
pattern.to_templates.each do |template|
params = request_method == 'GET'.freeze ? factory.params : Service.params
params = factory.params if request_method == 'GET'.freeze
params &&= params.reject { |p| p.start_with? ?@.freeze }
template += "{?#{params.sort.join(?,)}}" if params and params.any?
list << { :@type => :template, :request_method => request_method, :uri_template => prefix + template }

View File

@ -21,7 +21,7 @@ describe Travis::API::V3::ServiceIndex do
describe "create action" do
let(:action) { resource.fetch("actions").fetch("create") }
specify { expect(action).to include("@type"=>"template", "request_method"=>"POST", "uri_template"=>"#{path}repo/{repository.id}/requests{?include}") }
specify { expect(action).to include("@type"=>"template", "request_method"=>"POST", "uri_template"=>"#{path}repo/{repository.id}/requests") }
end
end
@ -48,12 +48,12 @@ describe Travis::API::V3::ServiceIndex do
describe "enable action" do
let(:action) { resource.fetch("actions").fetch("enable") }
specify { expect(action).to include("@type"=>"template", "request_method"=>"POST", "uri_template"=>"#{path}repo/{repository.id}/enable{?include}") }
specify { expect(action).to include("@type"=>"template", "request_method"=>"POST", "uri_template"=>"#{path}repo/{repository.id}/enable") }
end
describe "disable action" do
let(:action) { resource.fetch("actions").fetch("disable") }
specify { expect(action).to include("@type"=>"template", "request_method"=>"POST", "uri_template"=>"#{path}repo/{repository.id}/disable{?include}") }
specify { expect(action).to include("@type"=>"template", "request_method"=>"POST", "uri_template"=>"#{path}repo/{repository.id}/disable") }
end
end