Sha256: 16de1d761396fd9c2c3e2aada9bb717e3832a48ecb694939f1fb05bbac044b5e

Contents?: true

Size: 1.17 KB

Versions: 4

Compression:

Stored size: 1.17 KB

Contents

#!/usr/bin/ruby
#
# This is an example of how to use the RETS client to perform a basic search.
#
# You will need to set the necessary variables below.
#
#############################################################################################
# Settings

rets_url = 'http://server.com/my/rets/url'
username = 'username'
password = 'password'

rets_resource = 'Property'
rets_class    = 'Residential'
rets_query    = '(RetsField=Value)'

#############################################################################################
$:.unshift 'lib'

require 'rets4r'

client = RETS4R::Client.new(rets_url)

logger = Logger.new($stdout)
logger.level = Logger::WARN
client.logger = logger

login_result = client.login(username, password)

if login_result.success?
	puts "We successfully logged into the RETS server!"
	
	options = {'Limit' => 5}
	
	client.search(rets_resource, rets_class, rets_query, options) do |result|
		result.data.each do |row|
			puts row.inspect
			puts
		end
	end
	
	client.logout
	
	puts "We just logged out of the server."
else
	puts "We were unable to log into the RETS server."
	puts "Please check that you have set the login variables correctly."
end

logger.close

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rets4r-0.8.2 examples/client_search.rb
rets4r-0.8.3 examples/client_search.rb
rets4r-0.8.4 examples/client_search.rb
rets4r-0.8.5 examples/client_search.rb