Commit ef404d8ea62f277ec40d9a0a82c08d389b07b54e
1 parent
2eb1220f
Exists in
spb-stable
and in
3 other branches
Dropped expiration date from the snippet API
Showing
2 changed files
with
0 additions
and
6 deletions
Show diff stats
doc/api/project_snippets.md
| @@ -57,7 +57,6 @@ Parameters: | @@ -57,7 +57,6 @@ Parameters: | ||
| 57 | + `id` (required) - The ID of a project | 57 | + `id` (required) - The ID of a project |
| 58 | + `title` (required) - The title of a snippet | 58 | + `title` (required) - The title of a snippet |
| 59 | + `file_name` (required) - The name of a snippet file | 59 | + `file_name` (required) - The name of a snippet file |
| 60 | -+ `lifetime` (optional) - The expiration date of a snippet | ||
| 61 | + `code` (required) - The content of a snippet | 60 | + `code` (required) - The content of a snippet |
| 62 | 61 | ||
| 63 | 62 | ||
| @@ -75,7 +74,6 @@ Parameters: | @@ -75,7 +74,6 @@ Parameters: | ||
| 75 | + `snippet_id` (required) - The ID of a project's snippet | 74 | + `snippet_id` (required) - The ID of a project's snippet |
| 76 | + `title` (optional) - The title of a snippet | 75 | + `title` (optional) - The title of a snippet |
| 77 | + `file_name` (optional) - The name of a snippet file | 76 | + `file_name` (optional) - The name of a snippet file |
| 78 | -+ `lifetime` (optional) - The expiration date of a snippet | ||
| 79 | + `code` (optional) - The content of a snippet | 77 | + `code` (optional) - The content of a snippet |
| 80 | 78 | ||
| 81 | 79 |
lib/api/project_snippets.rb
| @@ -41,7 +41,6 @@ module API | @@ -41,7 +41,6 @@ module API | ||
| 41 | # id (required) - The ID of a project | 41 | # id (required) - The ID of a project |
| 42 | # title (required) - The title of a snippet | 42 | # title (required) - The title of a snippet |
| 43 | # file_name (required) - The name of a snippet file | 43 | # file_name (required) - The name of a snippet file |
| 44 | - # lifetime (optional) - The expiration date of a snippet | ||
| 45 | # code (required) - The content of a snippet | 44 | # code (required) - The content of a snippet |
| 46 | # Example Request: | 45 | # Example Request: |
| 47 | # POST /projects/:id/snippets | 46 | # POST /projects/:id/snippets |
| @@ -50,7 +49,6 @@ module API | @@ -50,7 +49,6 @@ module API | ||
| 50 | required_attributes! [:title, :file_name, :code] | 49 | required_attributes! [:title, :file_name, :code] |
| 51 | 50 | ||
| 52 | attrs = attributes_for_keys [:title, :file_name] | 51 | attrs = attributes_for_keys [:title, :file_name] |
| 53 | - attrs[:expires_at] = params[:lifetime] if params[:lifetime].present? | ||
| 54 | attrs[:content] = params[:code] if params[:code].present? | 52 | attrs[:content] = params[:code] if params[:code].present? |
| 55 | @snippet = user_project.snippets.new attrs | 53 | @snippet = user_project.snippets.new attrs |
| 56 | @snippet.author = current_user | 54 | @snippet.author = current_user |
| @@ -69,7 +67,6 @@ module API | @@ -69,7 +67,6 @@ module API | ||
| 69 | # snippet_id (required) - The ID of a project snippet | 67 | # snippet_id (required) - The ID of a project snippet |
| 70 | # title (optional) - The title of a snippet | 68 | # title (optional) - The title of a snippet |
| 71 | # file_name (optional) - The name of a snippet file | 69 | # file_name (optional) - The name of a snippet file |
| 72 | - # lifetime (optional) - The expiration date of a snippet | ||
| 73 | # code (optional) - The content of a snippet | 70 | # code (optional) - The content of a snippet |
| 74 | # Example Request: | 71 | # Example Request: |
| 75 | # PUT /projects/:id/snippets/:snippet_id | 72 | # PUT /projects/:id/snippets/:snippet_id |
| @@ -78,7 +75,6 @@ module API | @@ -78,7 +75,6 @@ module API | ||
| 78 | authorize! :modify_project_snippet, @snippet | 75 | authorize! :modify_project_snippet, @snippet |
| 79 | 76 | ||
| 80 | attrs = attributes_for_keys [:title, :file_name] | 77 | attrs = attributes_for_keys [:title, :file_name] |
| 81 | - attrs[:expires_at] = params[:lifetime] if params[:lifetime].present? | ||
| 82 | attrs[:content] = params[:code] if params[:code].present? | 78 | attrs[:content] = params[:code] if params[:code].present? |
| 83 | 79 | ||
| 84 | if @snippet.update_attributes attrs | 80 | if @snippet.update_attributes attrs |