//
//  RankingObject.m
//  LifeLog
//
//  Created by nvtu on 8/26/17.
//  Copyright © 2017 PhongNV. All rights reserved.
//

#import "RankingObject.h"

@implementation RankingObject

-(id) initWithData : (NSDictionary *) dict {
    if([dict objectForKey:@"user_id"] != nil) {
        self.userID = [dict[@"user_id"] intValue];
    }
    if([dict objectForKey:@"rank"] != nil) {
        self.rank = [dict[@"rank"] intValue];
    }
    if([dict objectForKey:@"steps"] != nil) {
        self.steps = [dict[@"steps"] intValue];
    }
    if([dict objectForKey:@"distance"] != nil) {
        self.distance = [dict[@"distance"] floatValue];
    }
    if([dict objectForKey:@"time"] != nil) {
        self.time = [dict[@"time"] intValue];
    }
    if([dict objectForKey:@"username"] != nil) {
        self.userName = dict[@"username"];
    }
    if([dict objectForKey:@"profile_image"] != nil) {
        self.avatar = dict[@"profile_image"];
    }
    return self;
}

@end
