estately / rets

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

capability_url error/ examples unclear #140

Closed zoesteinkamp closed 9 years ago

zoesteinkamp commented 9 years ago

I am getting two errors, and I'm also just generally confused on how to use the gem to get data from the MLS systems. I am currently trying to receive specific types of data from the MLS using this dictionary as my guide

http://www.reso.org/assets/Certifications/resodatadictionarycertificationoverview_v1.0.3_2015_0330.pdf

and so right now I'm trying to get address, but I'm not getting anywhere. Just an FYI the property number 123, is fake, I'm just trying to test if I could receive data. If this has an effect on my error messages let me know and ill try to get a real mls_id. What I want to do its use mL_ids of houses to look up their specific information, including timestamps/addresses etc..

So my code looks like this.

require 'rets'
# Pass the :login_url, :username, :password and :version of RETS
client = Rets::Client.new({
                              login_url: 'http://ris.retsiq.com/rets/login',
                              username: 'Deleted for Github',
                              password: 'Deleted for Github',
                              version: 'RETS/1.5'
                          })

begin
  client.login
rescue => e
  puts 'Error: ' + e.message
  exit!
end
puts 'We connected! Lets log out...'
client.logout

address = client.objects '*', {
                               resource: 'Property',
                               object_type: 'Address',
                               resource_id: '123'
                           }
puts address
client.logout

And the errors I'm receiving look like this.

/Users/Zoe/.rvm/rubies/ruby-2.2.1/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /Users/Zoe/Documents/planomatic-photoplan/ruby/apiconnector/lib/mls/ri_mls.rb
Cookie#domain returns dot-less domain name now. Use Cookie#dot_domain if you need "." at the beginning.
We connected! Lets log out...
Cookie#domain returns dot-less domain name now. Use Cookie#dot_domain if you need "." at the beginning.
Cookie#domain returns dot-less domain name now. Use Cookie#dot_domain if you need "." at the beginning.
Cookie#domain returns dot-less domain name now. Use Cookie#dot_domain if you need "." at the beginning.
/Users/Zoe/.rvm/gems/ruby-2.2.1/gems/rets-0.9.0/lib/rets/client.rb:310:in `capability_url': unknown capability GetObject, available capabilities ["membername", "user", "broker", "metadataversion", "minmetadataversion", "timeoutseconds", "login", "logout", "x-selector"] (Rets::UnknownCapability)
    from /Users/Zoe/.rvm/gems/ruby-2.2.1/gems/rets-0.9.0/lib/rets/client.rb:250:in `fetch_object'
    from /Users/Zoe/.rvm/gems/ruby-2.2.1/gems/rets-0.9.0/lib/rets/client.rb:193:in `objects'
    from /Users/Zoe/Documents/planomatic-photoplan/ruby/apiconnector/lib/mls/ri_mls.rb:19:in `<top (required)>'
    from -e:1:in `load'
    from -e:1:in `<main>'

Process finished with exit code 1

So the Url_compatibility error is the obvious one I do not understand. The Cookie#Domain is apparently from http client, I'm still unsure why its there. Any help would be greatly appreciated.

dougcole commented 9 years ago

Hi @zoesteinkamp, in rets parlance object are usually supplemental data for the listing, most commonly photos. If you are trying to fetch data about a specific property, you can just use the find method for properties. Check out the example here: https://github.com/estately/rets/blob/master/example/get-property.rb

The unknown capability means that this RETS server doesn't support fetching objects. Interestingly the list of known capabilities in the error message doesn't include search either, so it's likely my suggestion above won't work either. Assuming that's the case, I'd contact the RETS vendor and ask for permission to use the search functionality. Hope that helps!

zoesteinkamp commented 9 years ago

Thank you! I will contact them and let you know if I have any problems actually related to your system.