From df8f2537ccde2a96780bc2465247c9ef8fc3f97f Mon Sep 17 00:00:00 2001 From: Konstantin Haase Date: Tue, 13 Oct 2015 17:40:58 +0200 Subject: [PATCH] v3: list sortable fields in service index --- lib/travis/api/v3/service_index.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/travis/api/v3/service_index.rb b/lib/travis/api/v3/service_index.rb index 4ee23a1e..7bc0903f 100644 --- a/lib/travis/api/v3/service_index.rb +++ b/lib/travis/api/v3/service_index.rb @@ -96,6 +96,13 @@ module Travis::API::V3 pattern = sub_route ? resource.route + sub_route : resource.route factory = Services[resource.identifier][service] + if factory.params and factory.params.include? "sort_by".freeze + query = Queries[resource.identifier] + if query and query.sortable? + resources[resource.identifier][:sortable_by] = query.sort_by.keys + end + end + pattern.to_templates.each do |template| params = factory.params if request_method == 'GET'.freeze params &&= params.reject { |p| p.start_with? ?@.freeze }