Merge branch 'develop'
diff --git a/README.md b/README.md
index 6e2aa05..2ff11b9 100644
--- a/README.md
+++ b/README.md
@@ -78,7 +78,7 @@
3. Once the build finishes you will get a Phar in `build/artifacts`, and a set of API documentation.
Assuming you have copied the Phar to your current working directory, to use the client, simply
- require_once("predictionio.phar");
+ require_once("predictionio.phar");
Supported Commands
@@ -164,7 +164,23 @@
try {
// assume you have created an itemsim engine named 'engine2'
// we try to get top 10 similar items for an item (item ID 6)
- $command = $client->getCommand('itemsim_get_top_n', array('pio_iid' => '6', 'pio_engine' => 'engine1', 'pio_n' => 10));
+ $command = $client->getCommand('itemsim_get_top_n', array('pio_iid' => '6', 'pio_engine' => 'engine2', 'pio_n' => 10));
+ $rec = $client->execute($command);
+ print_r($rec);
+} catch (Exception $e) {
+ echo 'Caught exception: ', $e->getMessage(), "\n";
+}
+```
+
+
+Retrieving Ranking of Items for a User
+--------------------------------------
+
+```PHP
+try {
+ // assume you have created an itemrank engine named 'engine3'
+ // we try to get ranking of 5 items (item IDs: 1, 2, 3, 4, 5) for a user (user ID 7)
+ $command = $client->getCommand('itemrank_get_ranked', array('pio_uid' => '7', 'pio_iids' => '1,2,3,4,5', 'pio_engine' => 'engine3'));
$rec = $client->execute($command);
print_r($rec);
} catch (Exception $e) {
diff --git a/build.xml b/build.xml
index a86d747..d959425 100644
--- a/build.xml
+++ b/build.xml
@@ -46,9 +46,11 @@
<include name="vendor/symfony/class-loader/Symfony/Component/ClassLoader/UniversalClassLoader.php" />
<include name="vendor/symfony/event-dispatcher/**/*.php" />
<include name="vendor/guzzle/guzzle/src/Guzzle/**/*.php" />
+ <include name="vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem" />
+ <include name="vendor/guzzle/guzzle/src/Guzzle/Http/Resources/cacert.pem.md5" />
</fileset>
<metadata>
- <element name="author" value="PredictionIO" />
+ <element name="author" value="PredictionIO" />
</metadata>
</pharpackage>
<exec command="apigen -s src -d docs --title 'PredictionIO API PHP Client'" passthru="true" />
diff --git a/composer.json b/composer.json
index d30709a..fd4343b 100644
--- a/composer.json
+++ b/composer.json
@@ -2,22 +2,30 @@
"name": "predictionio/predictionio",
"type": "library",
"description": "PredictionIO API PHP Client",
- "keywords": ["predictionio", "tappingstone", "rest", "restful", "web service", "prediction", "recommendation"],
+ "keywords": [
+ "predictionio",
+ "tappingstone",
+ "rest",
+ "restful",
+ "web service",
+ "prediction",
+ "recommendation"
+ ],
"homepage": "http://prediction.io",
"license": "Apache-2.0",
"authors": [
- {
- "name": "The PredictionIO Team",
- "email": "help@tappingstone.com",
- "homepage": "http://prediction.io"
- }
+ {
+ "name": "The PredictionIO Team",
+ "email": "help@prediction.io",
+ "homepage": "http://prediction.io"
+ }
],
"require": {
- "php": ">=5.3.2",
- "guzzle/guzzle": "~3.8.0"
+ "php": ">=5.3.2",
+ "guzzle/guzzle": "~3.8.0"
},
"require-dev": {
- "symfony/class-loader": "*"
+ "symfony/class-loader": "*"
},
"autoload": {
"psr-0": {
diff --git a/src/PredictionIO/Command/ItemrankGetRanked.php b/src/PredictionIO/Command/ItemrankGetRanked.php
new file mode 100644
index 0000000..317c41d
--- /dev/null
+++ b/src/PredictionIO/Command/ItemrankGetRanked.php
@@ -0,0 +1,55 @@
+<?php
+
+namespace PredictionIO\Command;
+
+use Guzzle\Http\Message\RequestInterface;
+use Guzzle\Service\Command\AbstractCommand;
+
+/**
+ * ItemRank Engine Get Items Ranking for a User
+ *
+ * Retrieve ranking of items for this specific user.
+ *
+ * @guzzle engine type="string" required="true"
+ * @guzzle iids type="string" required="true"
+ */
+class ItemrankGetRanked extends AbstractCommand
+{
+ /**
+ * Set the "engine" parameter for the current command
+ *
+ * @param string $engine Engine Name
+ *
+ * @return ItemrankGetRanked
+ */
+ public function setEngine($engine)
+ {
+ return $this->set('pio_engine', $engine);
+ }
+
+ /**
+ * Set the "iids" parameter for the current command
+ *
+ * @param string $iids Comma-separated list of Item IDs
+ *
+ * @return ItemrankGetRanked
+ */
+ public function setIids($iids)
+ {
+ return $this->set('pio_iids', $iids);
+ }
+
+ /**
+ * Create the request object that will carry out the command. Used internally by Guzzle.
+ */
+ protected function build()
+ {
+ $this->set('pio_uid', $this->client->getIdentity());
+ $this->request = $this->client->createRequest(
+ RequestInterface::GET,
+ 'engines/itemrank/' . $this->get('pio_engine') . '/ranked',
+ null,
+ $this->getAll()
+ );
+ }
+}