diff --git a/lib/travis/api/v3/service_index.rb b/lib/travis/api/v3/service_index.rb index bbf13f90..c35882e9 100644 --- a/lib/travis/api/v3/service_index.rb +++ b/lib/travis/api/v3/service_index.rb @@ -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 } diff --git a/spec/v3/service_index_spec.rb b/spec/v3/service_index_spec.rb index 06d81bb1..e1e9b6cc 100644 --- a/spec/v3/service_index_spec.rb +++ b/spec/v3/service_index_spec.rb @@ -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