private function httpPost( $path, Array $payload ){

        $url = new Uri( $this->baseUrl . $path );

        $request = new Request(
            'POST',
            $url,
            $this->buildHeaders(),
            json_encode( $payload )
        );

        try {

            $response = $this->getHttpClient()->sendRequest( $request );

        } catch (\RuntimeException $e){
            throw new Exception\NotifyException( $e->getMessage(), $e->getCode(), $e );
        }

        //---

        switch( $response->getStatusCode() ){
            case 200:
            case 201:
                return $this->handleResponse( $response );
            default:
                return $this->handleErrorResponse( $response );
        }

    }
private function httpPost( $path, Array $payload ){

        $url = new Uri( $this->baseUrl . $path );

        $request = new Request(
            'POST',
            $url,
            $this->buildHeaders(),
            json_encode( $payload )
        );

        try {

            $response = $this->getHttpClient()->sendRequest( $request );

        } catch (\RuntimeException $e){
            throw new Exception\NotifyException( $e->getMessage(), $e->getCode(), $e );
        }

        //---

        switch( $response->getStatusCode() ){
            case 200:
            case 201:
                return $this->handleResponse( $response );
            default:
                return $this->handleErrorResponse( $response );
        }

    }
private function httpPost ( $ path , Array $ payload ) { $ url = new Uri ( $ this -> baseUrl . $ path ) ; $ request = new Request ( 'POST' , $ url , $ this -> buildHeaders ( ) , json_encode ( $ payload ) ) ; try { $ response = $ this -> getHttpClient ( ) -> sendRequest ( $ request ) ; } catch ( \ RuntimeException $ e ) { throw new Exception \ NotifyException ( $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } //--- switch ( $ response -> getStatusCode ( ) ) { case 200 : case 201 : return $ this -> handleResponse ( $ response ) ; default : return $ this -> handleErrorResponse ( $ response ) ; } }
Performs a POST against the Notify API.

@param string $path
@param array  $payload

@return array
@throw Exception\NotifyException | Exception\ApiException | Exception\UnexpectedValueException
Performs a POST against the Notify API .