Public Member Functions | Private Member Functions | Private Attributes
rms::rms_client Class Reference

Provides direct communication to the RMS API to via cURL. More...

#include <rms.h>

List of all members.

Public Member Functions

rms::article get_article_by_id (int artid)
std::vector< rms::articleget_articles ()
std::vector< rms::articleget_articles_by_pageid (int pageid)
rms::condition get_condition_by_id (int condid)
std::vector< rms::conditionget_conditions ()
rms::content_page get_content_page_by_id (int pageid)
std::vector< rms::content_pageget_content_pages ()
rms::experiment get_experiment_by_id (int expid)
std::vector< rms::experimentget_experiments ()
rms::javascript_file get_javascript_file_by_id (int fileid)
std::vector< rms::javascript_fileget_javascript_files ()
std::vector< rms::slideget_slides ()
std::vector< rms::studyget_studies ()
rms::study get_study_by_id (int studyid)
rms::study_log get_study_log_by_id (int logid)
std::vector< rms::study_logget_study_logs ()
std::vector< rms::study_logget_study_logs_by_expid (int expid)
rms::user_account get_user_account_by_id (int userid)
std::vector< rms::user_accountget_user_accounts ()
 rms_client (std::string host, int port=80, rms::PROTOCOL protocol=HTTP_PROTOCOL)
void set_authorization (std::string username, std::string password)
virtual ~rms_client ()

Private Member Functions

bool extract_json_bool (json_object *json, std::string key)
int extract_json_int (json_object *json, std::string key)
std::string extract_json_string (json_object *json, std::string key)
void free_rms_response (rms::rms_response *buf)
json_object * make_request (std::string url)
rms::article parse_article (json_object *json)
std::vector< rms::articleparse_articles_array (json_object *json_array)
rms::condition parse_condition (json_object *json)
std::vector< rms::conditionparse_conditions_array (json_object *json_array)
rms::content_page parse_content_page (json_object *json)
std::vector< rms::content_pageparse_content_pages_array (json_object *json_array)
rms::experiment parse_experiment (json_object *json)
std::vector< rms::experimentparse_experiments_array (json_object *json_array)
rms::javascript_file parse_javascript_file (json_object *json)
std::vector< rms::javascript_fileparse_javascript_files_array (json_object *json_array)
rms::slide parse_slide (json_object *json)
std::vector< rms::slideparse_slides_array (json_object *json_array)
std::vector< rms::studyparse_studies_array (json_object *json_array)
rms::study parse_study (json_object *json)
rms::study_log parse_study_log (json_object *json)
std::vector< rms::study_logparse_study_logs_array (json_object *json_array)
rms::user_account parse_user_account (json_object *json)
std::vector< rms::user_accountparse_user_accounts_array (json_object *json_array)

Private Attributes

CURL * curl
std::string url_start

Detailed Description

Provides direct communication to the RMS API to via cURL.

The rms_client handles communication to the RMS HTTP or HTTPS server using cURL.

Definition at line 89 of file rms.h.


Constructor & Destructor Documentation

rms_client::rms_client ( std::string  host,
int  port = 80,
rms::PROTOCOL  protocol = HTTP_PROTOCOL 
)

Creates a new client with the given information.

Parameters:
hostthe host name of the server
portthe port of the server (defaults to 80)
protocolthe protocol used to communicate with the server (defaults to HTTP)

Definition at line 19 of file rms.cpp.

rms_client::~rms_client ( ) [virtual]

Cleans up all resources left by cURL.

Definition at line 42 of file rms.cpp.


Member Function Documentation

bool rms_client::extract_json_bool ( json_object *  json,
std::string  key 
) [private]

Extract a boolean from the given JSON object with the given key.

Parameters:
jsona pointer to the JSON object
keythe key of the boolean in the JSON object
Returns:
the boolean that was extracted

Definition at line 707 of file rms.cpp.

int rms_client::extract_json_int ( json_object *  json,
std::string  key 
) [private]

Extract an int from the given JSON object with the given key.

Parameters:
jsona pointer to the JSON object
keythe key of the int in the JSON object
Returns:
the int that was extracted

Definition at line 715 of file rms.cpp.

string rms_client::extract_json_string ( json_object *  json,
std::string  key 
) [private]

Extract a string from the given JSON object with the given key.

Parameters:
jsona pointer to the JSON object
keythe key of the string in the JSON object
Returns:
the string that was extracted or "NULL" if it was a null value

Definition at line 690 of file rms.cpp.

Frees all memory used by the given rms_response.

Parameters:
bufthe buffer to free

Definition at line 741 of file rms.cpp.

Get the article with the given ID number.

Parameters:
artidthe article ID number
Returns:
the article with the given ID number

Definition at line 120 of file rms.cpp.

Get a vector of all articles on the server.

Returns:
a vector of all articles on the server

Definition at line 98 of file rms.cpp.

vector< article > rms_client::get_articles_by_pageid ( int  pageid)

Get a vector of all articles on the server that are assigned to the given page.

Parameters:
pageidthe page ID number
Returns:
a vector of all articles on the server.

Definition at line 142 of file rms.cpp.

Get the condition with the given ID number.

Parameters:
condidthe condition ID number
Returns:
the condition with the given ID number

Definition at line 252 of file rms.cpp.

Get a vector of all conditions on the server.

Returns:
a vector of all conditions on the server

Definition at line 230 of file rms.cpp.

Get the content page with the given ID number.

Parameters:
pageidthe content page ID number
Returns:
the content page with the given ID number

Definition at line 186 of file rms.cpp.

Get a vector of all content pages on the server.

Returns:
a vector of all content pages on the server

Definition at line 164 of file rms.cpp.

Get the experiment with the given ID number.

Parameters:
expidthe experiment ID number
Returns:
the experiment with the given ID number

Definition at line 296 of file rms.cpp.

Get a vector of all experiments on the server.

Returns:
a vector of all experiments on the server

Definition at line 274 of file rms.cpp.

Get the Javascript file with the given ID number.

Parameters:
fileidthe Javascript file ID number
Returns:
the Javascript file with the given ID number

Definition at line 76 of file rms.cpp.

Get a vector of all downloaded Javascript files on the server.

Returns:
a vector of all downloaded Javascript files on the server

Definition at line 54 of file rms.cpp.

Get a vector of all slides on the server.

Returns:
a vector of all slides on the server

Definition at line 208 of file rms.cpp.

Get a vector of all studies on the server.

Returns:
a vector of all studies on the server

Definition at line 318 of file rms.cpp.

Get the study with the given ID number.

Parameters:
studyidthe study ID number
Returns:
the study with the given ID number

Definition at line 340 of file rms.cpp.

Get the study log entry with the given ID number.

Parameters:
logidthe study log entry ID number
Returns:
the study log entry with the given ID number

Definition at line 384 of file rms.cpp.

Get a vector of all study log entries on the server.

Returns:
a vector of all study log entries on the server

Definition at line 362 of file rms.cpp.

Get a vector of all study log entries with the given experiment ID number.

Parameters:
logidthe experiment ID number
Returns:
a vector of all study log entries with the given experiment ID number

Definition at line 406 of file rms.cpp.

Get the user account with the given ID number.

Parameters:
useridthe user account ID number
Returns:
the user account with the given ID number

Definition at line 450 of file rms.cpp.

Get a vector of all user accounts on the server.

Returns:
a vector of all user accounts on the server

Definition at line 428 of file rms.cpp.

json_object * rms_client::make_request ( std::string  url) [private]

Make a request to the RMS server with the given URL.

Parameters:
urlthe URL to query
Returns:
the JSON object that was returned from the server

Definition at line 723 of file rms.cpp.

article rms_client::parse_article ( json_object *  json) [private]

Parse the given JSON object as an article.

Parameters:
jsona pointer to the JSON object
Returns:
the article that was parsed from the JSON object

Definition at line 506 of file rms.cpp.

vector< article > rms_client::parse_articles_array ( json_object *  json_array) [private]

Parse the given JSON object as an array of articles.

Parameters:
json_arraya pointer to the JSON object
Returns:
the vector of articles that was parsed from the JSON object

Definition at line 494 of file rms.cpp.

condition rms_client::parse_condition ( json_object *  json) [private]

Parse the given JSON object as a condition.

Parameters:
jsona pointer to the JSON object
Returns:
the condition that was parsed from the JSON object

Definition at line 577 of file rms.cpp.

vector< condition > rms_client::parse_conditions_array ( json_object *  json_array) [private]

Parse the given JSON object as an array of conditions.

Parameters:
json_arraya pointer to the JSON object
Returns:
the vector of conditions that was parsed from the JSON object

Definition at line 565 of file rms.cpp.

content_page rms_client::parse_content_page ( json_object *  json) [private]

Parse the given JSON object as a content page.

Parameters:
jsona pointer to the JSON object
Returns:
the content page that was parsed from the JSON object

Definition at line 530 of file rms.cpp.

vector< content_page > rms_client::parse_content_pages_array ( json_object *  json_array) [private]

Parse the given JSON object as an array of content pages.

Parameters:
json_arraya pointer to the JSON object
Returns:
the vector of content pages that was parsed from the JSON object

Definition at line 518 of file rms.cpp.

experiment rms_client::parse_experiment ( json_object *  json) [private]

Parse the given JSON object as a condition.

Parameters:
jsona pointer to the JSON object
Returns:
the experiment that was parsed from the JSON object

Definition at line 600 of file rms.cpp.

vector< experiment > rms_client::parse_experiments_array ( json_object *  json_array) [private]

Parse the given JSON object as an array of experiments.

Parameters:
json_arraya pointer to the JSON object
Returns:
the vector of experiments that was parsed from the JSON object

Definition at line 588 of file rms.cpp.

javascript_file rms_client::parse_javascript_file ( json_object *  json) [private]

Parse the given JSON object as a Javascript file.

Parameters:
jsona pointer to the JSON object
Returns:
the Javascript file that was parsed from the JSON object

Definition at line 484 of file rms.cpp.

vector< javascript_file > rms_client::parse_javascript_files_array ( json_object *  json_array) [private]

Parse the given JSON object as an array of Javascript files.

Parameters:
json_arraya pointer to the JSON object
Returns:
the vector of Javascript files that was parsed from the JSON object

Definition at line 472 of file rms.cpp.

slide rms_client::parse_slide ( json_object *  json) [private]

Parse the given JSON object as a slide.

Parameters:
jsona pointer to the JSON object
Returns:
the slide that was parsed from the JSON object

Definition at line 554 of file rms.cpp.

vector< slide > rms_client::parse_slides_array ( json_object *  json_array) [private]

Parse the given JSON object as an array of slides.

Parameters:
json_arraya pointer to the JSON object
Returns:
the vector of slides that was parsed from the JSON object

Definition at line 542 of file rms.cpp.

vector< study > rms_client::parse_studies_array ( json_object *  json_array) [private]

Parse the given JSON object as an array of studies.

Parameters:
json_arraya pointer to the JSON object
Returns:
the vector of studies that was parsed from the JSON object

Definition at line 613 of file rms.cpp.

study rms_client::parse_study ( json_object *  json) [private]

Parse the given JSON object as a study.

Parameters:
jsona pointer to the JSON object
Returns:
the study that was parsed from the JSON object

Definition at line 625 of file rms.cpp.

study_log rms_client::parse_study_log ( json_object *  json) [private]

Parse the given JSON object as a study log entry.

Parameters:
jsona pointer to the JSON object
Returns:
the study log entry that was parsed from the JSON object

Definition at line 649 of file rms.cpp.

vector< study_log > rms_client::parse_study_logs_array ( json_object *  json_array) [private]

Parse the given JSON object as an array of study log entries.

Parameters:
json_arraya pointer to the JSON object
Returns:
the vector of study log entries that was parsed from the JSON object

Definition at line 637 of file rms.cpp.

user_account rms_client::parse_user_account ( json_object *  json) [private]

Parse the given JSON object as a user account.

Parameters:
jsona pointer to the JSON object
Returns:
the user account that was parsed from the JSON object

Definition at line 672 of file rms.cpp.

vector< user_account > rms_client::parse_user_accounts_array ( json_object *  json_array) [private]

Parse the given JSON object as an array of user accounts.

Parameters:
json_arraya pointer to the JSON object
Returns:
the vector of user accounts that was parsed from the JSON object

Definition at line 660 of file rms.cpp.

void rms_client::set_authorization ( std::string  username,
std::string  password 
)

Sets the authentication header in cURL.

Parameters:
usernamethe username of the user
passwordthe plain-text password for the user

Definition at line 48 of file rms.cpp.


Member Data Documentation

CURL* rms::rms_client::curl [private]

used to communicate with the HTTP or HTTPS server

Definition at line 246 of file rms.h.

std::string rms::rms_client::url_start [private]

the base string for the URL

Definition at line 245 of file rms.h.


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


rmscpp
Author(s): Russell Toris
autogenerated on Sat Dec 28 2013 17:08:58