com.base.Http.Server.Responses.Channel.GetChannelResponse   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
dl 0
loc 32
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getChannel() 0 7 1
A getResponse(Request,Response) 0 4 1
A GetChannelResponse(String,String) 0 4 1
A GetChannelResponse() 0 ? 1
1
package com.base.Http.Server.Responses.Channel;
2
3
import com.base.Http.Request.Request;
4
import com.base.Http.Response.Response;
5
import com.base.Http.Server.Responses.BaseResponse;
6
import com.base.Models.Channel;
7
8
public class GetChannelResponse 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 = "Design";
13
    public static String VALID_DESCRIPTION = "Design Channel for Twitter";
14
    public static String VALID_COLOR = "000000";
15
    public static String VALID_STATUS = "1";
16
17
    public GetChannelResponse() {
18
        super();
19
    }
20
21
    public GetChannelResponse(String teamSlug, String channelSlug) {
22
        super();
23
        VALID_CHANNEL_SLUG = channelSlug;
24
        VALID_TEAM_SLUG = teamSlug;
25
    }
26
27
    @Override
28
    public Response getResponse(Request request, Response response) {
29
        return response.setStatusCode(200)
30
                .setBody(generateResponseBody(getChannel()));
31
    }
32
33
    public Channel getChannel() {
34
        return (Channel) new Channel()
35
                .setSlug(VALID_CHANNEL_SLUG)
36
                .setDescription(VALID_DESCRIPTION)
37
                .setIs_private(VALID_STATUS)
38
                .setColor(VALID_COLOR)
39
                .setName(VALID_NAME);
40
    }
41
}
42