intial work on adding /lint endpoint
This commit is contained in:
parent
bddd9952a7
commit
43480752fa
9
lib/travis/api/v3/permissions/lint.rb
Normal file
9
lib/travis/api/v3/permissions/lint.rb
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
require 'travis/api/v3/permissions/generic'
|
||||||
|
|
||||||
|
module Travis::API::V3
|
||||||
|
class Permissions::Lint < Permissions::Generic
|
||||||
|
def lint?
|
||||||
|
write?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
13
lib/travis/api/v3/queries/lint.rb
Normal file
13
lib/travis/api/v3/queries/lint.rb
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
require 'travis/yaml'
|
||||||
|
|
||||||
|
module Travis::API::V3
|
||||||
|
class Queries::Lint < Query
|
||||||
|
def lint
|
||||||
|
request.body.rewind
|
||||||
|
content = params[:content] || request.body.read
|
||||||
|
parsed = Travis::Yaml.parse(content)
|
||||||
|
warnings = parsed.nested_warnings.map { |k, m| { key: k, message: m } }
|
||||||
|
{ lint: { warnings: warnings } }.to_json
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
|
@ -36,6 +36,12 @@ module Travis::API::V3
|
||||||
post :restart, '/restart'
|
post :restart, '/restart'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
resource :lint do
|
||||||
|
route '/lint'
|
||||||
|
post :lint
|
||||||
|
put :lint
|
||||||
|
end
|
||||||
|
|
||||||
resource :organization do
|
resource :organization do
|
||||||
capture id: :digit
|
capture id: :digit
|
||||||
route '/org/{organization.id}'
|
route '/org/{organization.id}'
|
||||||
|
|
|
@ -11,6 +11,7 @@ module Travis::API::V3
|
||||||
Builds = Module.new { extend Services }
|
Builds = Module.new { extend Services }
|
||||||
Job = Module.new { extend Services }
|
Job = Module.new { extend Services }
|
||||||
Jobs = Module.new { extend Services }
|
Jobs = Module.new { extend Services }
|
||||||
|
Lint = Module.new { extend Services }
|
||||||
Organization = Module.new { extend Services }
|
Organization = Module.new { extend Services }
|
||||||
Organizations = Module.new { extend Services }
|
Organizations = Module.new { extend Services }
|
||||||
Owner = Module.new { extend Services }
|
Owner = Module.new { extend Services }
|
||||||
|
|
7
lib/travis/api/v3/services/lint/lint.rb
Normal file
7
lib/travis/api/v3/services/lint/lint.rb
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module Travis::API::V3
|
||||||
|
class Services::Lint::Lint < Service
|
||||||
|
def run!
|
||||||
|
lint
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue
Block a user