public static function get($configFilename = 'rets.yml')
 {
     $c = self::getRawConfig($configFilename);
     $retsConfig = new Configuration();
     $retsConfig->setLoginUrl($c['url'])->setUsername($c['username'])->setPassword($c['password'])->setRetsVersion($c['rets_version'])->setUserAgent($c['user_agent'])->setUserAgentPassword($c['user_agent_password'])->setHttpAuthenticationMethod($c['http_auth_method'])->setOption('use_post_method', $c['use_post_method'])->setOption('disable_follow_location', $c['disable_follow_location']);
     return $retsConfig;
 }
 /** @test **/
 public function it_provides_a_1_8_login_parser()
 {
     $config = new Configuration();
     $config->setRetsVersion('1.8');
     $strategy = new StandardStrategy();
     $strategy->initialize($config);
     $this->assertInstanceOf('\\PHRETS\\Parsers\\Login\\OneEight', $strategy->provide('parser.login'));
 }
Example #3
0
 public function setUp()
 {
     $parser = new OneX();
     $parameters = ['SearchType' => 'Property', 'Class' => 'A', 'RestrictedIndicator' => '#####'];
     $data = "\n        <RETS ReplyCode=\"0\" ReplyText=\"Success\">\n          <COUNT Records=\"9057\"/>\n          <DELIMITER value=\"09\"/>\n          <COLUMNS>\tLIST_1\tLIST_105\t</COLUMNS>\n          <DATA>\t20111007152642181995000000\t12-5\t</DATA>\n          <DATA>\t20081003152306903177000000\t07-310\t</DATA>\n          <DATA>\t20081216155101459601000000\t07-340\t</DATA>\n          <MAXROWS/>\n        </RETS>\n        ";
     $c = new Configuration();
     $c->setLoginUrl('http://www.reso.org/login');
     $s = new Session($c);
     $this->results = $parser->parse($s, new Response(200, [], Stream::factory($data)), $parameters);
 }
Example #4
0
 /**
  * @param Configuration $configuration
  * @return void
  */
 public function initialize(Configuration $configuration)
 {
     // start up the service locator
     $this->container = new Container();
     foreach ($this->default_components as $k => $v) {
         if ($k == 'parser.login' and $configuration->getRetsVersion()->isAtLeast1_8()) {
             $v = '\\PHRETS\\Parsers\\Login\\OneEight';
         }
         $this->container->singleton($k, function () use($v) {
             return new $v();
         });
     }
 }
Example #5
0
 /**
  * @param $component
  * @return mixed
  */
 protected function grab($component)
 {
     return $this->configuration->getStrategy()->provide($component);
 }
Example #6
0
 /** @test **/
 public function it_allows_overriding_the_cookie_jar()
 {
     $c = new Configuration();
     $c->setLoginUrl('http://www.reso.org/login');
     $s = new Session($c);
     $jar = new \GuzzleHttp\Cookie\CookieJar();
     $s->setCookieJar($jar);
     $this->assertSame($jar, $s->getCookieJar());
 }
Example #7
0
 /** @test **/
 public function it_accepts_basic_auth()
 {
     $c = new Configuration();
     $c->setHttpAuthenticationMethod(Configuration::AUTH_BASIC);
     $this->assertSame(Configuration::AUTH_BASIC, $c->getHttpAuthenticationMethod());
 }