Passed
Push — master ( 5d9134...50ca29 )
by Christian
15:07 queued 01:56
created

BusinessEventsApiService   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 100 %

Importance

Changes 0
Metric Value
eloc 13
dl 27
loc 27
rs 10
c 0
b 0
f 0
wmc 3

2 Functions

Rating   Name   Duplication   Size   Complexity  
A getBusinessEvents 13 13 2
A constructor 4 4 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1 View Code Duplication
import ApiService from '../api.service';
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
2
3
/**
4
 * @class
5
 * @extends ApiService
6
 */
7
class BusinessEventsApiService extends ApiService {
8
    constructor(httpClient, loginService, apiEndpoint = 'business-events') {
9
        super(httpClient, loginService, apiEndpoint);
10
        this.name = 'businessEventService';
11
    }
12
13
    /**
14
     * Get all business events
15
     *
16
     * @param {Object} [additionalParams = {}]
17
     * @param {Object} [additionalHeaders = {}]
18
     * @returns {Promise<T>}
19
     */
20
    getBusinessEvents(additionalParams = {}, additionalHeaders = {}) {
21
        const params = additionalParams;
22
        const headers = this.getBasicHeaders(additionalHeaders);
23
24
        return this.httpClient
25
            .get('/_info/events.json', {
26
                params,
27
                headers
28
            })
29
            .then((response) => {
30
                return ApiService.handleResponse(response);
31
            });
32
    }
33
}
34
35
export default BusinessEventsApiService;
36