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

#import <IndivoRecord.h>

Inherits INServerObject.

Instance Methods

(IndivoDocument *) - addDocumentOfClass:error:
 Instantiates a document of given class and adds it to our documents cache. More...
 
(void) - fetchAppSpecificDocumentsWithCallback:
 Fetch app specific documents of the receiver, calling GET on /records/{record id}/apps/{app id}/documents/. More...
 
(void) - fetchDemographicsDocumentWithCallback:
 Fetches the record's demographics document. More...
 
(void) - fetchDocumentsOfClass:callback:
 Fetch documents of a given type, calling GET on /records/{record id}/documents/?type={type}. More...
 
(void) - fetchDocumentsWithCallback:
 Fetch all documents of the receiver, calling GET on /records/{record id}/documents/. More...
 
(void) - fetchRecordInfoWithCallback:
 Fetches basic record info. More...
 
(void) - fetchReportsOfClass:callback:
 Fetches reports of given type from the server. More...
 
(void) - fetchReportsOfClass:withQuery:callback:
 Fetches reports limited by the query parameters given. More...
 
(id) - initWithId:onServer:
 Initializes a record from given parameters. More...
 
(void) - sendMessage:withBody:ofType:severity:attachments:callback:
 Posts a message to the record's inbox. More...
 
(void) - sendMessage:withBody:ofType:severity:attachments:messageId:callback:
 Posts a message to the record's inbox. More...
 
- Instance Methods inherited from INServerObject
(void) - forceNotOnServer
 This is provided for subclasses, the fact that onServer is readonly but settable by this and markOnServer underlines the fact that you should only change this property when you know what you're doing. More...
 
(void) - get:callback:
 Shortcut for GETting data. More...
 
(void) - get:parameters:callback:
 Shortcut for GETting data with parameters. More...
 
(id) - initFromNode:withServer:
 The designated initializer. More...
 
(BOOL) - is:
 Shortcut method to test if the document has the given ID. More...
 
(void) - markOnServer
 Sets onServer to YES for the receiver. More...
 
(void) - performMethod:withBody:orParameters:httpMethod:callback:
 The basic method to perform REST methods on the server with App credentials. More...
 
(void) - post:body:callback:
 Shortcut for POSTing body data. More...
 
(void) - post:parameters:callback:
 Shortcut for POSTing parameters. More...
 
(void) - put:body:callback:
 Shortcut for PUTting data. More...
 

Properties

NSString * accessToken
 The last access token successfully used with this record. More...
 
NSString * accessTokenSecret
 The last access token secret successfully used with this record. More...
 
NSDate * created
 When this record has been created on the server. More...
 
IndivoDemographicsdemographicsDoc
 The demographics document for this record. More...
 
NSString * demographicsDocId
 The id of the demographics document. More...
 
NSString * label
 This record's name. More...
 
- Properties inherited from INServerObject
BOOL onServer
 Indicates whether this document lives on the server. More...
 
IndivoServerserver
 Our beloved server. More...
 
NSString * uuid
 This object's udid. More...
 

Additional Inherited Members

- Class Methods inherited from INObject
(NSArray *) + attributeNames
 The properties whose names are returned here are expected to be XML node attributes rather than complete nodes. More...
 
(NSString *) + flatXMLNameForPropertyName:
 Objects have the ability to use a different name from the property name for flat XML "name" attributes. More...
 
(id) + newWithNodeName:
 Returns a fresh node with nodeName set. More...
 
(NSString *) + nodeName
 
(NSString *) + nodeType
 
(id) + objectFromAttribute:inNode:
 This method returns an object created from the string contents of a node attribute. More...
 
(id) + objectFromNode:
 This method returns an object created representing the the node. More...
 
- Protected Attributes inherited from INObject
NSString * _nodeName
 

Method Documentation

- (IndivoDocument *) addDocumentOfClass: (Class)  documentClass
error: (NSError * __autoreleasing *)  error 

Instantiates a document of given class and adds it to our documents cache.

Parameters
documentClassMust be a subclass of IndivoDocument
errorAn error pointer
Returns
A newly instantiated object of the desired class
- (void) fetchAppSpecificDocumentsWithCallback: (INSuccessRetvalueBlock)  callback

Fetch app specific documents of the receiver, calling GET on /records/{record id}/apps/{app id}/documents/.

Upon callback, the "INResponseArrayKey" of the user-info dictionary will contain IndivoAppDocument instances.

- (void) fetchDemographicsDocumentWithCallback: (INCancelErrorBlock)  aCallback

Fetches the record's demographics document.

Note that this call fetches the demographics document not from the "official" /records/id/demographics REST path but via its uuid from /records/id/documents/demographics-document-id. This is because the latter call returns the document in a different XML format, the one we need, because it is the same format required to PUT the document.

- (void) fetchDocumentsOfClass: (Class)  documentClass
callback: (INSuccessRetvalueBlock)  callback 

Fetch documents of a given type, calling GET on /records/{record id}/documents/?type={type}.

Upon callback, the "INResponseArrayKey" of the user-info dictionary will contain IndivoMetaDocument instances for this record's documents.

Parameters
documentClassThe class of the documents to fetch, must be an IndivoDocument subclass or it will be ignored
callbackThe callback block to be executed after the transfer finishes
- (void) fetchDocumentsWithCallback: (INSuccessRetvalueBlock)  callback

Fetch all documents of the receiver, calling GET on /records/{record id}/documents/.

Upon callback, the "INResponseArrayKey" of the user-info dictionary will contain IndivoMetaDocument instances for this record's documents. This method will call "fetchDocumentsOfClass:callback:" with no class argument.

Parameters
callbackThe callback block to be executed after the transfer finishes
- (void) fetchRecordInfoWithCallback: (INCancelErrorBlock)  aCallback

Fetches basic record info.

- (void) fetchReportsOfClass: (Class)  documentClass
callback: (INSuccessRetvalueBlock)  callback 

Fetches reports of given type from the server.

- (void) fetchReportsOfClass: (Class)  documentClass
withQuery: (INQueryParameter *)  aQuery
callback: (INSuccessRetvalueBlock)  callback 

Fetches reports limited by the query parameters given.

Attention
The "INResponseArrayKey" will contain either IndivoAggregateReport objects or IndivoDocument-subclass objects (of the class supplied to the method)
Parameters
documentClassThe class representing the desired document type (e.g. IndivoMedication for medication reports)
aQueryThe query parameters restricting the query
callbackThe block to execute upon success or failure
- (id) initWithId: (NSString *)  anId
onServer: (IndivoServer *)  aServer 

Initializes a record from given parameters.

- (void) sendMessage: (NSString *)  messageSubject
withBody: (NSString *)  messageBody
ofType: (INMessageType)  type
severity: (INMessageSeverity)  severity
attachments: (NSArray *)  attachments
callback: (INCancelErrorBlock)  callback 

Posts a message to the record's inbox.

This method auto-generates a message id, which generally is what you want. This method generates an API call POST /records/{RECORD_ID}/inbox/{MESSAGE_ID} with the given arguments. If attachments are supplied, the callback will only be called once all attachments have been uploaded.

Parameters
messageSubjectThe message subject
messageBodyThe message's body
typeHow to interpret the message body
severityThe severity or priority of the message
attachmentsAn array containing IndivoDocument instances.
callbackThe block to be called when the operation finishes.
- (void) sendMessage: (NSString *)  messageSubject
withBody: (NSString *)  messageBody
ofType: (INMessageType)  type
severity: (INMessageSeverity)  severity
attachments: (NSArray *)  attachments
messageId: (NSString *)  messageId
callback: (INCancelErrorBlock)  callback 

Posts a message to the record's inbox.

This method generates an API call POST /records/{RECORD_ID}/inbox/{MESSAGE_ID} with the given arguments. If attachments are supplied, the callback will only be called once all attachments have been uploaded.

Parameters
messageSubjectThe message subject
messageBodyThe message's body
typeHow to interpret the message body
severityThe severity or priority of the message
attachmentsAn array containing IndivoDocument instances.
messageIdA message id
callbackThe block to be called when the operation finishes.

Property Documentation

- (NSString*) accessToken
readwritenonatomiccopy

The last access token successfully used with this record.

- (NSString*) accessTokenSecret
readwritenonatomiccopy

The last access token secret successfully used with this record.

- (NSDate*) created
readnonatomicstrong

When this record has been created on the server.

- (IndivoDemographics*) demographicsDoc
readnonatomicstrong

The demographics document for this record.

- (NSString*) demographicsDocId
readnonatomiccopy

The id of the demographics document.

- (NSString*) label
readwritenonatomiccopy

This record's name.


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