diff options
author | James Lopez <james@jameslopez.es> | 2017-07-07 16:54:39 +0300 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-07-07 16:54:39 +0300 |
commit | a9e8af3386f47cee657a95f0094095f5f4cc1b4e (patch) | |
tree | 44bf6a97c7ec3743668c2e1fd4ccc52a032998a6 /lib/api/project_snippets.rb | |
parent | 5173955fd49ab9748a9878203b691732198091aa (diff) |
add spec and project snippet user agent details endpoint
Diffstat (limited to 'lib/api/project_snippets.rb')
-rw-r--r-- | lib/api/project_snippets.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/api/project_snippets.rb b/lib/api/project_snippets.rb index 64efe82a937..3320eadff0d 100644 --- a/lib/api/project_snippets.rb +++ b/lib/api/project_snippets.rb @@ -131,6 +131,22 @@ module API content_type 'text/plain' present snippet.content end + + desc 'Get the user agent details for a project snippet' do + success Entities::UserAgentDetail + end + params do + requires :snippet_id, type: Integer, desc: 'The ID of a project snippet' + end + get ":id/snippets/:snippet_id/user_agent_detail" do + authenticated_as_admin! + + snippet = Snippet.find_by!(id: params[:id]) + + return not_found!('UserAgentDetail') unless snippet.user_agent_detail + + present snippet.user_agent_detail, with: Entities::UserAgentDetail + end end end end |