Permalink
Browse files

Updated client to use Orgname / Appname

  • Loading branch information...
1 parent 80ff9bc commit a43082933dd70fa29141b33d072c2b21f7de1476 @rodsimpson rodsimpson committed Dec 29, 2012
Showing with 14 additions and 9 deletions.
  1. +2 −2 UGAPI/UGClient.h
  2. +12 −7 UGAPI/UGClient.m
View
@@ -41,14 +41,14 @@ set the response limit in UGQuery as well.
/********************* INIT AND SETUP *********************/
// init with an app ID
--(id) initWithApplicationID:(NSString *)applicationID;
+-(id) initWithOrganizationId: (NSString *)organizationID withApplicationID:(NSString *)applicationID;
// init with an app ID and a base UserGrid URL. This is useful if you
// are running a local UG server or your company has its own public
// UG server. The default URL is http://api.usergrid.com. The base URL
// must be a fully formated http link, including the "http://" at the
// beginning.
--(id) initWithApplicationID:(NSString *)applicationID baseURL:(NSString *)baseURL;
+-(id) initWithOrganizationId: (NSString *)organizationID withApplicationID:(NSString *)applicationID baseURL:(NSString *)baseURL;
// set the delegate. See "A WORD ON NETWORK COMMUNICATION CALLS"
// at the top of the file for a detailed explanation. The function
View
@@ -23,6 +23,9 @@ @implementation UGClient
// the appID for the specific app
NSString *m_appID;
+ // the appID for the specific app
+ NSString *m_orgID;
+
// the cached auth token
UGUser *m_loggedInUser;
@@ -71,7 +74,7 @@ -(id)init
return nil;
}
--(id) initWithApplicationID:(NSString *)applicationID
+-(id) initWithOrganizationId: (NSString *)organizationID withApplicationID:(NSString *)applicationID
{
self = [super init];
if ( self )
@@ -80,6 +83,7 @@ -(id) initWithApplicationID:(NSString *)applicationID
m_httpManagerPool = [NSMutableArray new];
m_delegateLock = [NSRecursiveLock new];
m_appID = applicationID;
+ m_orgID = organizationID;
m_baseURL = @"http://api.usergrid.com";
m_pendingMultiStepActions = [NSMutableArray new];
m_loggedInUser = nil;
@@ -88,7 +92,7 @@ -(id) initWithApplicationID:(NSString *)applicationID
return self;
}
--(id) initWithApplicationID:(NSString *)applicationID baseURL:(NSString *)baseURL
+-(id) initWithOrganizationId: (NSString *)organizationID withApplicationID:(NSString *)applicationID baseURL:(NSString *)baseURL
{
self = [super init];
if ( self )
@@ -97,6 +101,7 @@ -(id) initWithApplicationID:(NSString *)applicationID baseURL:(NSString *)baseUR
m_httpManagerPool = [NSMutableArray new];
m_delegateLock = [NSRecursiveLock new];
m_appID = applicationID;
+ m_orgID = organizationID;
m_baseURL = baseURL;
}
return self;
@@ -375,35 +380,35 @@ -(UGClientResponse *)createResponse:(int)transactionID jsonStr:(NSString *)jsonS
-(NSMutableString *)createURL:(NSString *)append1
{
NSMutableString *ret = [NSMutableString new];
- [ret appendFormat:@"%@/%@/%@", m_baseURL, m_appID, append1];
+ [ret appendFormat:@"%@/%@/%@/%@", m_baseURL, m_orgID, m_appID, append1];
return ret;
}
-(NSMutableString *)createURL:(NSString *)append1 append2:(NSString *)append2
{
NSMutableString *ret = [NSMutableString new];
- [ret appendFormat:@"%@/%@/%@/%@", m_baseURL, m_appID, append1, append2];
+ [ret appendFormat:@"%@/%@/%@/%@/%@", m_baseURL, m_orgID, m_appID, append1, append2];
return ret;
}
-(NSMutableString *)createURL:(NSString *)append1 append2:(NSString *)append2 append3:(NSString *)append3
{
NSMutableString *ret = [NSMutableString new];
- [ret appendFormat:@"%@/%@/%@/%@/%@", m_baseURL, m_appID, append1, append2, append3];
+ [ret appendFormat:@"%@/%@/%@/%@/%@/%@", m_baseURL, m_orgID, m_appID, append1, append2, append3];
return ret;
}
-(NSMutableString *)createURL:(NSString *)append1 append2:(NSString *)append2 append3:(NSString *)append3 append4:(NSString *)append4
{
NSMutableString *ret = [NSMutableString new];
- [ret appendFormat:@"%@/%@/%@/%@/%@/%@", m_baseURL, m_appID, append1, append2, append3, append4];
+ [ret appendFormat:@"%@/%@/%@/%@/%@/%@/%@", m_baseURL, m_orgID, m_appID, append1, append2, append3, append4];
return ret;
}
-(NSMutableString *)createURL:(NSString *)append1 append2:(NSString *)append2 append3:(NSString *)append3 append4:(NSString *)append4 append5:(NSString *)append5
{
NSMutableString *ret = [NSMutableString new];
- [ret appendFormat:@"%@/%@/%@/%@/%@/%@/%@", m_baseURL, m_appID, append1, append2, append3, append4, append5];
+ [ret appendFormat:@"%@/%@/%@/%@/%@/%@/%@/%@", m_baseURL, m_orgID, m_appID, append1, append2, append3, append4, append5];
return ret;
}

0 comments on commit a430829

Please sign in to comment.