Skip to content

Instantly share code, notes, and snippets.

@joernroeder
Created July 11, 2012 11:55
Show Gist options
  • Save joernroeder/3089915 to your computer and use it in GitHub Desktop.
Save joernroeder/3089915 to your computer and use it in GitHub Desktop.
RequestHandler.h
/*
* RequestHandler.h
* appConnector
*
* Created by Jonathan Pirnay & Jörn Röder.
* Copyright 2012 jj. All rights reserved.
*
*/
#include "ofMain.h"
#include "ofxJansson.h"
#include "ofxHttpUtils.h"
#ifndef REQUESTHANDLER_H_INCLUDED
#define REQUESTHANDLER_H_INCLUDED
class RequestHandler {
public:
void init(string appKey);
json_t* setup();
void exit();
void setDescription(json_t* desc);
void setDebugResponse(bool val);
bool getDebugResponse();
void post(json_t* values);
string get(json_t* obj);
int getInterval();
private:
string getRequest(string url);
string postRequest(json_t* obj, string url);
string postResponse(ofxHttpResponse &response);
json_t* addAppKey(json_t* values);
string appKey, protocol, host, postUrl, descUrl, getUrl, setupUrl;
int port;
bool _debugResponse;
ofxHttpUtils httpUtils;
};
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment