All files JenkinsUser.ts

100% Statements 18/18
100% Branches 12/12
100% Functions 4/4
100% Lines 18/18
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58    30x     2x     14x 14x 14x     28x 28x 16x   28x 16x   28x 16x   28x 16x   28x 16x   28x 16x                                                      
 
 
import { IJenkinsUser }         from './jenkins-api-ts-typings';
 
export class JenkinsUser implements IJenkinsUser {
    jsonData:           JSON;
    
    _class:             string;
    fullName:           string;
    absoluteUrl:        string;
    
    description:        string;
    id:                 string;
    property:           Array<any>;
    
    constructor() {
        this.property = new Array<any>();
    }
    
    getJsonData(): string {
        return JSON.stringify(this.jsonData);
    }
    
    fromJsonString(json: string): void {
        let data:JSON = JSON.parse(json);
        this.jsonData = data;
        
        this.fromJson(data);
    }
    
    fromJson(data: JSON): void {
        this.jsonData = data;
        
        if(data.hasOwnProperty("_class")) {
            this._class = (data as any)["_class"];
        }
        
        if(data.hasOwnProperty("fullName")) {
            this.fullName = (data as any)["fullName"];
        }
        
        if(data.hasOwnProperty("absoluteUrl")) {
            this.absoluteUrl = (data as any)["absoluteUrl"];
        }
        
        if(data.hasOwnProperty("description")) {
            this.description = (data as any)["description"];
        }
        
        if(data.hasOwnProperty("id")) {
            this.id = (data as any)["id"];
        }
        
        if(data.hasOwnProperty("property")) {
            this.property = (data as any)["property"];
        }
    }
}