Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
57 lines (40 sloc) 1.48 KB
// Commit.m
// git-phone
// Created by Sam Schroeder on 2/7/09.
// Copyright 2009 Proton Microsystems, LLC. All rights reserved.
#import "Commit.h"
#import "NSString+JSON.h"
@implementation Commit
@synthesize commitID;
@synthesize message;
@synthesize url;
@synthesize authorName;
@synthesize authorEmail;
+ (NSString *)indexURLwithRepository:(NSString *)repository {
return [NSString stringWithFormat:@"%@/%@/%@/commits/master",
[[Config instance] baseAPIURL],
[[Config instance] gitHubUserName],
//TODO: this needs to be thought out better. Maybe loaded on the repo.
+ (NSArray *)loadAllfromRepository:(NSString *)repository {
NSMutableArray *commitsArray = [[NSMutableArray alloc] init];
NSString *resultJSON = [Connector postToURL:[self indexURLwithRepository:repository]];
NSMutableArray *commits = [[NSMutableArray alloc] init];
commits = [[resultJSON JSONValue] valueForKey:@"commits"];
for (NSDictionary *commit in commits) {
Commit *tempCommit = [[Commit alloc] init];
[tempCommit setCommitID:[commit valueForKey:@"id"]];
[tempCommit setMessage:[commit valueForKey:@"message"]];
[tempCommit setUrl:[commit valueForKey:@"url"]];
[tempCommit setAuthorName:[[commit valueForKey:@"author"] valueForKey:@"name"]];
[tempCommit setAuthorEmail:[[commit valueForKey:@"author"] valueForKey:@"email"]];
DevLog2(@"Loaded Commit: %@", [tempCommit commitID]);
[commitsArray addObject:tempCommit];
return commitsArray;