This commit is contained in:
Hoang Huu
2019-10-16 17:52:01 +07:00
parent 97cc9fca21
commit df02d479bf
3 changed files with 71 additions and 38 deletions

View File

@@ -1,13 +1,4 @@
<?php
/**
* Define
* Note: only use for internal purpose.
*
* @package OpalJob
* @copyright Copyright (c) 2019, WpOpal <https://www.wpopal.com>
* @license https://opensource.org/licenses/gpl-license GNU Public License
* @since 1.0
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
@@ -16,7 +7,6 @@ if ( ! defined( 'ABSPATH' ) ) {
/**
* @class Job_Api
*
* @since 1.0.0
* @package Opal_Job
* @subpackage Opal_Job/controllers
*/
@@ -25,7 +15,6 @@ class Opalestate_Agency_Api extends Opalestate_Base_API {
/**
* The unique identifier of the route resource.
*
* @since 1.0.0
* @access public
* @var string $base .
*/
@@ -42,9 +31,6 @@ class Opalestate_Agency_Api extends Opalestate_Base_API {
* Register Routes
*
* Register all CURD actions with POST/GET/PUT and calling function for each
*
* @since 1.0
*
*/
public function register_routes() {
/**
@@ -107,6 +93,16 @@ class Opalestate_Agency_Api extends Opalestate_Base_API {
);
}
/**
* Get object.
*
* @param int $id Object ID.
*
* @return Opalestate_Agency
*/
protected function get_object( $id ) {
return opalesetate_agency( $id );
}
/**
* Get List Of agencies.
@@ -114,8 +110,6 @@ class Opalestate_Agency_Api extends Opalestate_Base_API {
* Based on request to get collection
*
* @return WP_REST_Response is json data
* @since 1.0
*
*/
public function get_items( $request ) {
$agencies['agencies'] = [];
@@ -149,8 +143,6 @@ class Opalestate_Agency_Api extends Opalestate_Base_API {
* Based on request to get a agency.
*
* @return WP_REST_Response is json data
* @since 1.0
*
*/
public function get_item( $request ) {
$response = [];
@@ -177,9 +169,7 @@ class Opalestate_Agency_Api extends Opalestate_Base_API {
*
* @param object $agency_info The Download Post Object
*
* @return array Array of post data to return back in the API
* @since 1.0
*
* @return array Array of post data to return back in the API
*/
public function get_agency_data( $agency_info ) {
$agency = new OpalEstate_Agency( $agency_info->ID );

View File

@@ -7,7 +7,6 @@ if ( ! defined( 'ABSPATH' ) ) {
/**
* Property_Api
*
* @since 1.0.0
* @package Property_Api
*/
class Opalestate_Property_Api extends Opalestate_Base_API {
@@ -15,7 +14,6 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
/**
* The unique identifier of the route resource.
*
* @since 1.0.0
* @access public
* @var string $base .
*/
@@ -32,9 +30,6 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
* Register Routes
*
* Register all CURD actions with POST/GET/PUT and calling function for each
*
* @since 1.0
*
*/
public function register_routes() {
/**
@@ -52,11 +47,11 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
'permission_callback' => [ $this, 'get_items_permissions_check' ],
'args' => $this->get_collection_params(),
],
// [
// 'methods' => WP_REST_Server::CREATABLE,
// 'callback' => [ $this, 'create_item' ],
// // 'permission_callback' => [ $this, 'create_item_permissions_check' ],
// ],
[
'methods' => WP_REST_Server::CREATABLE,
'callback' => [ $this, 'create_item' ],
'permission_callback' => [ $this, 'create_item_permissions_check' ],
],
]
);
@@ -109,6 +104,17 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
);
}
/**
* Get object.
*
* @param int $id Object ID.
*
* @return Opalestate_Property
*/
protected function get_object( $id ) {
return opalesetate_property( $id );
}
/**
* Get List Of Properties
*
@@ -152,8 +158,6 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
* Based on request to get a property.
*
* @return WP_REST_Response is json data
* @since 1.0
*
*/
public function get_item( $request ) {
$response = [];
@@ -214,9 +218,7 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
*
* @param object $property_info The Download Post Object
*
* @return array Array of post data to return back in the API
* @since 1.0
*
* @return array Array of post data to return back in the API
*/
private function get_property_data( $property_info ) {
return opalestate_api_get_property_data( $property_info );