estately / rets

A pure-ruby library for fetching data from RETS servers
https://github.com/estately/rets
127 stars 94 forks source link

Rets::InvalidRequest: Got error code 20203 (Invalid Class Type) #92

Closed yuuki-hunter closed 9 years ago

yuuki-hunter commented 9 years ago

Hi,

I'm trying to connect to NTREIS (RETS/1.5) with the rets gem. Logging in works fine, but when I try to retrieve a property I get the Rets::InvalidRequest error.

property = client.find :first, {search_type: 'Property', class: 'RES', query: '(178=ACT)'}

According to the 1.5 spec the Well-Known Class Name for residential properties is RES. But I've tried other class names such as 'Residential-Property', 'ResidentialProperty', '1', etc. all to no avail.

This is my first time working with RETS, so it's probably something obvious that I'm missing.

Also I see the the Client Class supports logging. How do I turn that on ? I tried:

client = Rets::Client.new({ login_url: '[url]', username: '[username]', password: '[password]', version: 'RETS/1.5', logger: true })

but got the following error, when I ran client.login

NoMethodError: undefined method debug?' for true:TrueClass

Help appreciated!

Thanks, YH

jDeppen commented 9 years ago

Check out RETS MD, it will give you what you need. I found out I was missing a few things myself.

This might be good to put in the README actually.

dougcole commented 9 years ago

Yep, what @jDeppen said. As for the logger, the initializer expects an actual instance of the logger, something more like Logger.new(STDOUT).

yuuki-hunter commented 9 years ago

Thanks for that!

Using RETS MD I discovered that NTREIS only accepts one Class Type for the Property resource ("Listing"). It expects the type of property to be specified in the query string (e.g. PropertyType=RES).

Many thanks.

yuuki-hunter commented 9 years ago

Thanks Doug.

client = Rets::Client.new({ login_url: '[url]', username: '[username]', password: '[password]', version: 'RETS/1.5', logger: Logger.new(STDOUT) })

Worked like a charm.