Rechanize is a simple RETS client
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
LICENSE
README
Rakefile
rechanize.gemspec

README

Rechanize is a simple RETS client.
Rechanize provides an interface for querying metadata, data and objects.

== Initialize The Client
login  = "http://user:pass@rets.com/login_path"
client = Rechanize::Client.new(login)

== Build A Search
params = 'SearchType=Property&Class=Residential'
format = '&Query=(LN=*),(RECODMODDATE=%s%s)'
query  = params + (format % [Date.today, '%2B'])

== Get Some Datas
client.get(query) do |listing|
  puts "$#{listing['LP']  ##{listing['LN']}"
  puts "#{listing['STRNUM']} #{listing['STR']}"
  puts "#{listing['CITY']} #{listing['ST']}"
end

== Build An Image Request
params = 'Resource=Property&Type=Photo&Id=%s:%s'
query  = params % ["0", "*"]

== Get Some Images
client.get(query) do |index, headers, data|
  puts "Image #{index} is a #{headers['content-type']}"
end


TODO Finish testing
TODO Class methods on Rechanize for parsing dates to and from RETS datetime strings
TODO Test with a service other then MRED
TODO Incorporate the visitor pattern to handle different protocol versions.