Indivo Framework (iOS)
An iOS framework for Apps connecting to Indivo server
 All Classes Functions Variables Properties Pages
Instance Methods | Class Methods | Properties | List of all members
IndivoServer Class Reference

A class to represent the server you want to connect to. More...

#import <IndivoServer.h>

Inherits NSObject, and <IndivoLoginViewControllerDelegate>.

Inherited by IndivoMockServer.

Instance Methods

(void) - authenticate:
 Strips current credentials and then does the OAuth dance again. More...
 
(NSURL *) - authorizeCallbackURL
 The callback to feed to authorizeURL. More...
 
(void) - callDidFinish:
 Callback to let us know a call has finished. More...
 
(MPOAuthAPI *) - createOAuthWithAuthMethodClass:error:
 Creates a new MPOAuthAPI instance with our current settings. More...
 
(void) - fetchAppSpecificDocumentsWithCallback:
 Fetches global, app-specific documents. More...
 
(void) - performCall:
 Perform a method on our server This method is usally called by INServerObject subclasses, but you can use it bare if you wish. More...
 
(BOOL) - readyToConnect:
 
(IndivoRecord *) - recordWithId:
 Obviously returns the record with the given id, returns nil if it is not found. More...
 
(void) - selectRecord:
 This is the main authentication entry point, this method will ask the delegate where to present a login view controller, if authentication is necessary, and handle all user interactions until login was successful or the user cancels the login operation. More...
 
(BOOL) - shouldAutomaticallyAuthenticateFrom:
 Callback when the call is stuck at user authorization. More...
 
(void) - suspendCall:
 Dequeues a call without finishing it. More...
 

Class Methods

(id) + serverWithDelegate:
 A convenience constructor creating the server for the given delegate. More...
 

Properties

IndivoRecordactiveRecord
 The currently active record. More...
 
NSString * activeRecordId
 Shortcut method to get the id of the currently active record. More...
 
NSString * appId
 The id of the app as it is known on the server. More...
 
NSString * callbackScheme
 Defaults to "indivo-framework", but you can use your own. More...
 
NSString * consumerKey
 The consumer key for the app. More...
 
NSString * consumerSecret
 The consumer secret for the app. More...
 
id< IndivoServerDelegatedelegate
 A delegate to receive notifications. More...
 
NSMutableArray * knownRecords
 A cache of the known records on this server. Not currently used by the framework. More...
 
NSString * lastOAuthVerifier
 Storing our OAuth verifier here until MPOAuth asks for it. More...
 
BOOL storeCredentials
 NO by default. If you set this to YES, a successful login will save credentials to the system keychain. More...
 
NSURL * ui_url
 The UI-server URL (needed for login) More...
 
NSURL * url
 The server URL. More...
 

Detailed Description

A class to represent the server you want to connect to.

This is the main interaction point of the framework with your targeted Indivo Server.

Method Documentation

- (void) authenticate: (INCancelErrorBlock)  callback

Strips current credentials and then does the OAuth dance again.

The authorize screen is automatically shown if necessary.

Attention
This call is only useful if a call is in progress (but has hit an invalid access token), so it will not do anything without a current call.
Parameters
callbackAn INCancelErrorBlock callback
- (NSURL *) authorizeCallbackURL

The callback to feed to authorizeURL.

- (void) callDidFinish: (INServerCall *)  aCall

Callback to let us know a call has finished.

The call will have called the callback by now, no need for us to do any further handling

- (MPOAuthAPI *) createOAuthWithAuthMethodClass: (NSString *)  authClass
error: (NSError *__autoreleasing *)  error 

Creates a new MPOAuthAPI instance with our current settings.

Parameters
authClassAn MPOAuthAuthenticationMethod class name. If nil picks three-legged oauth.
errorA pointer to an error object, which will be filled if the method returns null
- (void) fetchAppSpecificDocumentsWithCallback: (INSuccessRetvalueBlock)  callback

Fetches global, app-specific documents.

GETs documents from /apps/{app id}/documents/ with a two-legged OAuth call.

- (void) performCall: (INServerCall *)  aCall

Perform a method on our server This method is usally called by INServerObject subclasses, but you can use it bare if you wish.

Parameters
aCallThe call to perform
- (BOOL) readyToConnect: (NSError **)  error
- (IndivoRecord *) recordWithId: (NSString *)  recordId

Obviously returns the record with the given id, returns nil if it is not found.

- (void) selectRecord: (INCancelErrorBlock)  callback

This is the main authentication entry point, this method will ask the delegate where to present a login view controller, if authentication is necessary, and handle all user interactions until login was successful or the user cancels the login operation.

Parameters
callbackA block with a first BOOL argument, which will be YES if the user cancelled the action, and an error string argument, which will be nil if authentication was successful. By the time this callback is called, the "activeRecord" property will be set (if the call was successful).
+ (id) serverWithDelegate: (id<IndivoServerDelegate>)  aDelegate

A convenience constructor creating the server for the given delegate.

Configuration is automatically read from "IndivoConfig.h"

- (BOOL) shouldAutomaticallyAuthenticateFrom: (NSURL *)  authURL

Callback when the call is stuck at user authorization.

Returns
We always return NO here, but display the login screen ourselves, loaded from the provided URL
- (void) suspendCall: (INServerCall *)  aCall

Dequeues a call without finishing it.

This is useful for calls that need to be re-performed after another call has been made, e.g. if the token was rejected and we'll be retrying the call after obtaining a new token. In this case, we don't want the call to finish, but we can't leave it in the queue because it would block subsequent calls.

Attention
Do NOT use this to cancel a call because the callback will not be called!

Property Documentation

- (IndivoRecord*) activeRecord
readwritenonatomicstrong

The currently active record.

- (NSString *) activeRecordId
readnonatomiccopy

Shortcut method to get the id of the currently active record.

Shortcut to the active record id.

- (NSString*) appId
readwritenonatomiccopy

The id of the app as it is known on the server.

- (NSString *) callbackScheme
readwritenonatomiccopy

Defaults to "indivo-framework", but you can use your own.

- (NSString*) consumerKey
readwritenonatomiccopy

The consumer key for the app.

- (NSString*) consumerSecret
readwritenonatomiccopy

The consumer secret for the app.

- (id<IndivoServerDelegate>) delegate
readwritenonatomicassign

A delegate to receive notifications.

- (NSMutableArray*) knownRecords
readnonatomicstrong

A cache of the known records on this server. Not currently used by the framework.

- (NSString*) lastOAuthVerifier
readnonatomiccopy

Storing our OAuth verifier here until MPOAuth asks for it.

- (BOOL) storeCredentials
readwritenonatomicassign

NO by default. If you set this to YES, a successful login will save credentials to the system keychain.

- (NSURL*) ui_url
readwritenonatomicstrong

The UI-server URL (needed for login)

- (NSURL*) url
readwritenonatomicstrong

The server URL.


The documentation for this class was generated from the following files: