From 2aff27aa5a754291f99a79f48567e732d263db75 Mon Sep 17 00:00:00 2001 From: Timo Engelhardt Date: Mon, 13 Feb 2017 14:21:50 -0800 Subject: [PATCH 1/3] feat(Review): Added new review endpoint --- lib/Castle.php | 1 + lib/Castle/Castle.php | 10 ++++++++++ lib/Castle/Models/Review.php | 6 ++++++ test/Castle.php | 1 + test/CastleTest.php | 8 ++++++++ 5 files changed, 26 insertions(+) create mode 100644 lib/Castle/Models/Review.php diff --git a/lib/Castle.php b/lib/Castle.php index 43073ac..4e1ca18 100755 --- a/lib/Castle.php +++ b/lib/Castle.php @@ -23,5 +23,6 @@ function lcfirst( $str ) { require(dirname(__FILE__) . '/RestModel/Model.php'); require(dirname(__FILE__) . '/Castle/Models/Context.php'); require(dirname(__FILE__) . '/Castle/Models/Authenticate.php'); +require(dirname(__FILE__) . '/Castle/Models/Review.php'); require(dirname(__FILE__) . '/Castle/CurlTransport.php'); require(dirname(__FILE__) . '/Castle/Request.php'); diff --git a/lib/Castle/Castle.php b/lib/Castle/Castle.php index 28dd71f..3db8ff3 100755 --- a/lib/Castle/Castle.php +++ b/lib/Castle/Castle.php @@ -64,6 +64,16 @@ public static function authenticate(Array $attributes) return $auth; } + /** + * Authenticate an action + * @param String $attributes 'user_id' and 'name' are required + * @return Castle_Authenticate + */ + public static function fetchReview(String $id) + { + return Castle_Review::find($id); + } + /** * Updates user information. Call when a user logs in or updates their information. * @param String $user_id Id of the user diff --git a/lib/Castle/Models/Review.php b/lib/Castle/Models/Review.php new file mode 100644 index 0000000..3e295e1 --- /dev/null +++ b/lib/Castle/Models/Review.php @@ -0,0 +1,6 @@ +assertRequest('post', '/identify'); } + + public function testReview() + { + Castle_RequestTransport::setResponse(200, '{ "id": "123553", "reviewed": true, "user_id" : "1234546", "context": {} }'); + $review = Castle::fetchReview('123553'); + $this->assertRequest('get', '/reviews/123553'); + $this->assertEquals($review->id, '123553'); + } } From 6b8e17ca26fc08659e07323a58ad02732892c4a5 Mon Sep 17 00:00:00 2001 From: Timo Engelhardt Date: Mon, 13 Feb 2017 14:28:02 -0800 Subject: [PATCH 2/3] fix(Castle): remove type check --- lib/Castle/Castle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Castle/Castle.php b/lib/Castle/Castle.php index 3db8ff3..50e2c19 100755 --- a/lib/Castle/Castle.php +++ b/lib/Castle/Castle.php @@ -69,7 +69,7 @@ public static function authenticate(Array $attributes) * @param String $attributes 'user_id' and 'name' are required * @return Castle_Authenticate */ - public static function fetchReview(String $id) + public static function fetchReview($id) { return Castle_Review::find($id); } From 0e2be9c41ca5d22fa052762e8dac81685235ff27 Mon Sep 17 00:00:00 2001 From: Timo Engelhardt Date: Mon, 13 Feb 2017 14:31:53 -0800 Subject: [PATCH 3/3] version bump --- lib/Castle/Castle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Castle/Castle.php b/lib/Castle/Castle.php index 50e2c19..8156306 100755 --- a/lib/Castle/Castle.php +++ b/lib/Castle/Castle.php @@ -14,7 +14,7 @@ abstract class Castle public static $scrubHeaders = array('Cookie'); - const VERSION = '1.3.0'; + const VERSION = '1.4.0'; public static function getApiKey() {