src/Support/Carpenter.php
public function constructBridge($credential, $service = null, $authMethod = 'credentials')
    {
        // Get credentials array.
        $credentials = $this->getCredentials($credential);

        // Make sure credentials information is available.
        if (! isset($credentials['username']) || ! isset($credentials['password']) || ! isset($credentials['gateway'])) {
            throw new WatsonBridgeException('Could not construct Bridge, missing some information in credentials.',
                                            500);
        }

        // Make bridge.
        $bridge = $this->makeRawBridge()
                       ->setUsername($credentials['username'])
                       ->setPassword($credentials['password'])
                       ->setEndPoint($credentials['gateway'])
                       ->setClient($credentials['gateway'])
                       ->appendHeaders(['X-Watson-Learning-Opt-Out' => config('watson-bridge.x_watson_learning_opt_out')]);

        // Add service.
        $bridge = $this->addServiceToBridge($bridge, $service);

        // Choose an auth method.
        $bridge = $this->chooseAuthMethodForBridge($bridge, $authMethod);

        return $bridge;
    }
public function constructBridge($credential, $service = null, $authMethod = 'credentials')
    {
        // Get credentials array.
        $credentials = $this->getCredentials($credential);

        // Make sure credentials information is available.
        if (! isset($credentials['username']) || ! isset($credentials['password']) || ! isset($credentials['gateway'])) {
            throw new WatsonBridgeException('Could not construct Bridge, missing some information in credentials.',
                                            500);
        }

        // Make bridge.
        $bridge = $this->makeRawBridge()
                       ->setUsername($credentials['username'])
                       ->setPassword($credentials['password'])
                       ->setEndPoint($credentials['gateway'])
                       ->setClient($credentials['gateway'])
                       ->appendHeaders(['X-Watson-Learning-Opt-Out' => config('watson-bridge.x_watson_learning_opt_out')]);

        // Add service.
        $bridge = $this->addServiceToBridge($bridge, $service);

        // Choose an auth method.
        $bridge = $this->chooseAuthMethodForBridge($bridge, $authMethod);

        return $bridge;
    }
public function constructBridge ( $ credential , $ service = null , $ authMethod = 'credentials' ) { // Get credentials array. $ credentials = $ this -> getCredentials ( $ credential ) ; // Make sure credentials information is available. if ( ! isset ( $ credentials [ 'username' ] ) || ! isset ( $ credentials [ 'password' ] ) || ! isset ( $ credentials [ 'gateway' ] ) ) { throw new WatsonBridgeException ( 'Could not construct Bridge, missing some information in credentials.' , 500 ) ; } // Make bridge. $ bridge = $ this -> makeRawBridge ( ) -> setUsername ( $ credentials [ 'username' ] ) -> setPassword ( $ credentials [ 'password' ] ) -> setEndPoint ( $ credentials [ 'gateway' ] ) -> setClient ( $ credentials [ 'gateway' ] ) -> appendHeaders ( [ 'X-Watson-Learning-Opt-Out' => config ( 'watson-bridge.x_watson_learning_opt_out' ) ] ) ; // Add service. $ bridge = $ this -> addServiceToBridge ( $ bridge , $ service ) ; // Choose an auth method. $ bridge = $ this -> chooseAuthMethodForBridge ( $ bridge , $ authMethod ) ; return $ bridge ; }
Constructs a new Bridge.

@param string $credential
@param string $service
@param string $authMethod

@throws WatsonBridgeException
@return Bridge
Constructs a new Bridge .