v3: consisten nameing

This commit is contained in:
Konstantin Haase 2015-03-09 18:35:38 +01:00
parent a3a9f1282a
commit 9b8a99ea33
2 changed files with 11 additions and 11 deletions

View File

@ -30,7 +30,7 @@ module Travis::API::V3
list = resources[resource.identifier][service] ||= [] list = resources[resource.identifier][service] ||= []
pattern = sub_route ? resource.route + sub_route : resource.route pattern = sub_route ? resource.route + sub_route : resource.route
pattern.to_templates.each do |template| pattern.to_templates.each do |template|
list << { 'request-method'.freeze => request_method, 'uri-template'.freeze => prefix + template } list << { 'request_method'.freeze => request_method, 'uri_template'.freeze => prefix + template }
end end
end end
end end

View File

@ -9,22 +9,22 @@ describe Travis::API::V3::ServiceIndex do
describe "custom json entry point" do describe "custom json entry point" do
let(:expected_resources) {{ let(:expected_resources) {{
"repository" => { "repository" => {
"find" => [{"request-method"=>"GET", "uri-template"=>"#{path}repo/{repository.id}"}], "find" => [{"request_method"=>"GET", "uri_template"=>"#{path}repo/{repository.id}"}],
"enable" => [{"request-method"=>"POST", "uri-template"=>"#{path}repo/{repository.id}/enable"}], "enable" => [{"request_method"=>"POST", "uri_template"=>"#{path}repo/{repository.id}/enable"}],
"disable" => [{"request-method"=>"POST", "uri-template"=>"#{path}repo/{repository.id}/disable"}] }, "disable" => [{"request_method"=>"POST", "uri_template"=>"#{path}repo/{repository.id}/disable"}] },
"repositories" => { "repositories" => {
"for_current_user" => [{"request-method"=>"GET", "uri-template"=>"#{path}repos"}] }, "for_current_user" => [{"request_method"=>"GET", "uri_template"=>"#{path}repos"}] },
"branch" => { "branch" => {
"find" => [{"request-method"=>"GET", "uri-template"=>"#{path}repo/{repository.id}/branch/{branch.name}"}]}, "find" => [{"request_method"=>"GET", "uri_template"=>"#{path}repo/{repository.id}/branch/{branch.name}"}]},
"build" => { "build" => {
"find" => [{"request-method"=>"GET", "uri-template"=>"#{path}build/{build.id}"}] }, "find" => [{"request_method"=>"GET", "uri_template"=>"#{path}build/{build.id}"}] },
"organizations" => { "organizations" => {
"for_current_user" => [{"request-method"=>"GET", "uri-template"=>"#{path}orgs"}] }, "for_current_user" => [{"request_method"=>"GET", "uri_template"=>"#{path}orgs"}] },
"organization" => { "organization" => {
"find" => [{"request-method"=>"GET", "uri-template"=>"#{path}org/{organization.id}"}] }, "find" => [{"request_method"=>"GET", "uri_template"=>"#{path}org/{organization.id}"}] },
"requests" => { "requests" => {
"find" => [{"request-method"=>"GET", "uri-template"=>"#{path}repo/{repository.id}/requests"}], "find" => [{"request_method"=>"GET", "uri_template"=>"#{path}repo/{repository.id}/requests"}],
"create" => [{"request-method"=>"POST", "uri-template"=>"#{path}repo/{repository.id}/requests"}]} "create" => [{"request_method"=>"POST", "uri_template"=>"#{path}repo/{repository.id}/requests"}]}
}} }}
describe 'with /v3 prefix' do describe 'with /v3 prefix' do