\CloudMunch\datamanagerCMDataManager

Class CMDataManager This class connects to cloudmunch to update /retrieve data

Summary

Methods
Properties
Constants
__construct()
getDataForContext()
downloadGSkey()
putDataForContext()
updateDataForContext()
deleteDataForContext()
sendNotification()
downloadFile()
do_curl()
json_object()
json_string()
startsWith()
html2txt()
No public properties found
RESPONSE
SUCCESS
REQUESTID
APIKEY
No protected methods found
No protected properties found
N/A
No private methods found
$logHelper
$appContext
$notificationHandler
N/A

Constants

RESPONSE

RESPONSE

SUCCESS

SUCCESS

REQUESTID

REQUESTID

APIKEY

APIKEY

Properties

$logHelper

$logHelper : \CloudMunch\datamanager\CloudMunch\loghandling\LogHandler

Type

\CloudMunch\datamanager\CloudMunch\loghandling\LogHandler — Reference to LogHandler object.

$appContext

$appContext : \CloudMunch\datamanager\CloudMunch\AppContext

Type

\CloudMunch\datamanager\CloudMunch\AppContext — Reference to AppContext object.

$notificationHandler

$notificationHandler : \CloudMunch\datamanager\CloudMunch\helper\NotificationHandler

Type

\CloudMunch\datamanager\CloudMunch\helper\NotificationHandler — notification handler

Methods

__construct()

__construct(\CloudMunch\datamanager\CloudMunch\loghandling\LogHandler  $logHandler, \CloudMunch\datamanager\CloudMunch\AppContext  $appContext, \CloudMunch\datamanager\CloudMunch\helper\NotificationHandler  $notificationHandler = null) 

Constructor to initialise loghandling, application context and notification handler.

Parameters

\CloudMunch\datamanager\CloudMunch\loghandling\LogHandler $logHandler
\CloudMunch\datamanager\CloudMunch\AppContext $appContext
\CloudMunch\datamanager\CloudMunch\helper\NotificationHandler $notificationHandler

getDataForContext()

getDataForContext(string  $url, string  $apikey, string  $querystring) : boolean|\CloudMunch\datamanager\jsonobject|string

Retreives data for given context

Parameters

string $url
string $apikey
string $querystring

Returns

boolean|\CloudMunch\datamanager\jsonobject|string

downloadGSkey()

downloadGSkey(string  $url, string  $apikey, string  $querystring) : boolean

Download key for google service

Parameters

string $url
string $apikey
string $querystring

Returns

boolean

putDataForContext()

putDataForContext(string  $url, string  $apikey, array  $data, string  $comment = null, array  $extraParams = null) : \CloudMunch\datamanager\json

Update data for given context.

Parameters

string $url
string $apikey
array $data
string $comment
array $extraParams

Returns

\CloudMunch\datamanager\json —

object in the format {"data":{"id":"contextid","name":"contextname"},"request":{"status":"SUCCESS"}}

updateDataForContext()

updateDataForContext(string  $url, string  $apikey, array  $data, string  $comment = null) : boolean

Patch data for given context.

Parameters

string $url
string $apikey
array $data
string $comment

Returns

boolean

deleteDataForContext()

deleteDataForContext(string  $url, string  $apikey) : boolean|\CloudMunch\datamanager\unknown

Delete data for given context.

Parameters

string $url
string $apikey

Returns

boolean|\CloudMunch\datamanager\unknown

sendNotification()

sendNotification(string  $serverurl, string  $apikey, string  $contextarray) : boolean

This method is to invoke notify api on cloudmunch.

Parameters

string $serverurl

: base server url

string $apikey

: Api key.

string $contextarray

: an array of components of the notification

Returns

boolean —

: success status

downloadFile()

downloadFile(string  $url, string  $apikey, string  $source, string  $destination = null) : boolean

Download the file source to given destination.

Parameters

string $url
string $apikey
string $source
string $destination

Returns

boolean

do_curl()

do_curl(string  $url, string  $headers = null, string  $requestType = null, string  $data = null, string  $curlOpts = null) : array

A helper function for curl.

Parameters

string $url
string $headers
string $requestType
string $data
string $curlOpts

Returns

array

json_object()

json_object(string|array  $data) : \CloudMunch\datamanager\Json

Converts given array or string to json object.

Parameters

string|array $data

Returns

\CloudMunch\datamanager\Json —

object

json_string()

json_string(string|array  $data) : string

Converts given object to json string

Parameters

string|array $data

Returns

string

startsWith()

startsWith(string  $haystack, string  $needle) : boolean

This method returns true if haystack starts with needle.

Parameters

string $haystack
string $needle

Returns

boolean —

true if haystack starts with needle

html2txt()

html2txt(string  $document) : string

Coverts html document to string.

Parameters

string $document

Returns

string