public function __construct(array $options)
 {
     $options = Collection::fromConfig($options, self::$defaultOptions, self::$requiredOptions);
     $this->client = MeasurementProtocolClient::factory(array('ssl' => $options->get(self::OPT_SSL)));
     $this->registerPlugin(new DataSetter(array(HitInterface::FIELD_VERSION => 1, HitInterface::FIELD_TRACKING_ID => $options->get(self::OPT_TRACKING_ID))));
     $this->registerPlugins($options->get(self::OPT_PLUGINS));
 }
 protected function dispatchCommand(OperationCommand $command)
 {
     $client = MeasurementProtocolClient::factory();
     $plugin = new UserIpOverrider();
     $event = new Event(array('command' => $command));
     $plugin->register($client);
     $client->getEventDispatcher()->dispatch('command.before_prepare', $event);
 }
 public function __construct()
 {
     $this->client = MeasurementProtocolClient::factory();
 }
 public function testModifyProxyCurlSetting()
 {
     $proxy = 'tcp://localhost:80';
     $client = MeasurementProtocolClient::factory(array('tid' => $this->getTrackingId(), 'curl.options' => array('CURLOPT_PROXY' => $proxy)));
     $this->getResponse('abstract.collect', array('cid' => $this->getCustomerId()), true, $client);
     $requestCurlOptions = $this->history->getLastRequest()->getCurlOptions();
     $this->assertSame($proxy, $requestCurlOptions[CURLOPT_PROXY]);
 }
 public function setUp()
 {
     $this->client = MeasurementProtocolClient::factory();
 }