| Total Complexity | 2 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | package com.base.Http.Server.Responses.Channel; |
||
| 8 | public class UpdateChannelResponse extends BaseResponse { |
||
| 9 | |||
| 10 | public static String VALID_TEAM_SLUG = "twitter"; |
||
| 11 | public static String VALID_CHANNEL_SLUG = "design-1"; |
||
| 12 | public static String VALID_NAME = "Logo Design"; |
||
| 13 | public static String VALID_DESCRIPTION = "Logo Design Channel for Twitter"; |
||
| 14 | public static String VALID_COLOR = "000000"; |
||
| 15 | public static String VALID_STATUS = "1"; |
||
| 16 | |||
| 17 | @Override |
||
| 18 | public Response getResponse(Request request, Response response) { |
||
| 19 | |||
| 20 | return response.setStatusCode(200) |
||
| 21 | .setBody(generateResponseBody(getChannel(request))); |
||
| 22 | |||
| 23 | } |
||
| 24 | |||
| 25 | public Channel getChannel(Request request) { |
||
| 26 | |||
| 27 | return (Channel) (new Channel()) |
||
| 28 | .setColor(request.getParameters().getOrDefault("color", "")) |
||
| 29 | .setDescription(request.getParameters().getOrDefault("description", "")) |
||
| 30 | .setName(request.getParameters().getOrDefault("name", "")) |
||
| 31 | .setSlug(request.getParameters().getOrDefault("slug", VALID_CHANNEL_SLUG)) |
||
| 32 | .setIs_private(request.getParameters().getOrDefault("is_private", "")); |
||
| 33 | } |
||
| 35 |