private function validateResponse( $response ) {

		// Make sure WordPress errors are handled.
		if ( is_wp_error( $response ) ) {
			$this->error = $response->get_error_message();
			return false;
		}

		// Check for 200 response code from server.
		$responseCode = wp_remote_retrieve_response_code( $response );
		if ( false === strstr( $responseCode, '200' ) ) {
			$responseMessage = wp_remote_retrieve_response_message( $response );
			$this->error = "{$responseCode} {$responseMessage}";
			return false;
		}

		// Check for nested status code not being successful.
		if ( isset( $this->response->status ) && 200 !== $this->response->status ) {
			$this->error = $this->response->result->data;
			return false;
		}

		return true;
	}
private function validateResponse( $response ) {

		// Make sure WordPress errors are handled.
		if ( is_wp_error( $response ) ) {
			$this->error = $response->get_error_message();
			return false;
		}

		// Check for 200 response code from server.
		$responseCode = wp_remote_retrieve_response_code( $response );
		if ( false === strstr( $responseCode, '200' ) ) {
			$responseMessage = wp_remote_retrieve_response_message( $response );
			$this->error = "{$responseCode} {$responseMessage}";
			return false;
		}

		// Check for nested status code not being successful.
		if ( isset( $this->response->status ) && 200 !== $this->response->status ) {
			$this->error = $this->response->result->data;
			return false;
		}

		return true;
	}
private function validateResponse ( $ response ) { // Make sure WordPress errors are handled. if ( is_wp_error ( $ response ) ) { $ this -> error = $ response -> get_error_message ( ) ; return false ; } // Check for 200 response code from server. $ responseCode = wp_remote_retrieve_response_code ( $ response ) ; if ( false === strstr ( $ responseCode , '200' ) ) { $ responseMessage = wp_remote_retrieve_response_message ( $ response ) ; $ this -> error = "{$responseCode} {$responseMessage}" ; return false ; } // Check for nested status code not being successful. if ( isset ( $ this -> response -> status ) && 200 !== $ this -> response -> status ) { $ this -> error = $ this -> response -> result -> data ; return false ; } return true ; }
Validates the API response.

@since  1.0.0

@param  object $response API response object.

@return bool
Validates the API response .