rets4r 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,109 @@
1
+ $:.unshift File.join(File.dirname(__FILE__), "../..", "lib")
2
+
3
+ module RETS4R
4
+ class Client
5
+
6
+ =begin
7
+
8
+ Provides a set of parser tests that can be extend for each specific parser type.
9
+
10
+ Usage:
11
+
12
+ module TestMyParser < Test::Unit::TestCase
13
+ include TestParser
14
+
15
+ def setup
16
+ @parser = MyParser.new
17
+ end
18
+ end
19
+
20
+ =end
21
+
22
+ module TestParser
23
+ DATA_DIR = 'test/client/data/1.5/'
24
+
25
+ def setup
26
+ # To be overridden. Must set @parser with a valid parser object
27
+ end
28
+
29
+ def load_xml_from_file(file_name)
30
+ xml = ''
31
+
32
+ File.open(file_name) do |file|
33
+ file.each do |line|
34
+ xml << line
35
+ end
36
+ end
37
+
38
+ xml
39
+ end
40
+
41
+ def parse_to_transaction(xml_file_name)
42
+ @parser.parse(load_xml_from_file(xml_file_name))
43
+ end
44
+
45
+ # Test Cases
46
+
47
+ def test_search_compact
48
+ transaction = parse_to_transaction("#{DATA_DIR}search_compact.xml")
49
+
50
+ assert_equal(true, transaction.success?)
51
+ assert_equal(nil, transaction.response)
52
+ assert_equal(false, transaction.header.empty?)
53
+ assert_equal(2, transaction.data.length)
54
+ assert_equal(transaction.header.length, transaction.data[0].length)
55
+ assert_equal(4, transaction.count)
56
+ assert_equal(9, transaction.delimiter)
57
+ assert_equal("\t", transaction.ascii_delimiter)
58
+ end
59
+
60
+ def test_unescaped_search_compact
61
+ transaction = parse_to_transaction("#{DATA_DIR}search_unescaped_compact.xml")
62
+
63
+ # (We should be able to recover automatically from this)
64
+ assert_equal(true, transaction.success?)
65
+ assert_equal(nil, transaction.response)
66
+ assert_equal(false, transaction.header.empty?)
67
+ assert_equal(2, transaction.data.length)
68
+ assert_equal(transaction.header.length, transaction.data[0].length)
69
+ assert_equal(4, transaction.count)
70
+ end
71
+
72
+ def test_invalid_search_compact
73
+ assert_raise(ParserException) do
74
+ parse_to_transaction("#{DATA_DIR}invalid_compact.xml")
75
+ end
76
+ end
77
+
78
+ def test_login_results
79
+ transaction = parse_to_transaction("#{DATA_DIR}login.xml")
80
+
81
+ assert_equal(true, transaction.success?)
82
+ assert_equal('srealtor,1,11,11111', transaction.response['User'])
83
+ assert_equal('/rets/Login', transaction.response['Login'])
84
+ end
85
+
86
+ =begin These were salvaged from the old parser test case.
87
+
88
+ def test_metadata_results
89
+ trans = parse_to_transaction("test/client/data/metadata-full.xml")
90
+
91
+ assert_equal(true, trans.success?)
92
+ assert_equal(605, trans.data.length)
93
+
94
+ #assert_equal('METADATA-SYSTEM', trans.data[0].type)
95
+ end
96
+ =end
97
+
98
+ def test_error_results
99
+ xml = load_xml_from_file("#{DATA_DIR}error.xml")
100
+
101
+ transaction = @parser.parse(xml)
102
+
103
+ assert_equal(false, transaction.success?)
104
+ assert_equal('20400', transaction.reply_code)
105
+ assert_equal('Invalid Invalidness.', transaction.reply_text)
106
+ end
107
+ end
108
+ end
109
+ end
@@ -0,0 +1,8 @@
1
+ $:.unshift File.join(File.dirname(__FILE__))
2
+
3
+ require 'test/unit'
4
+ require 'tc_auth.rb'
5
+ require 'tc_client.rb'
6
+ require 'tc_metadataindex.rb'
7
+ require 'parser/tc_rexml.rb'
8
+ require 'parser/tc_xmlparser.rb'
@@ -0,0 +1 @@
1
+ require 'test/ts_client'
@@ -0,0 +1 @@
1
+ require 'test/client/ts_all'
metadata ADDED
@@ -0,0 +1,96 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.2
3
+ specification_version: 1
4
+ name: rets4r
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.8.2
7
+ date: 2007-06-27 00:00:00 -07:00
8
+ summary: A native Ruby implementation of RETS (Real Estate Transaction Standard).
9
+ require_paths:
10
+ - lib
11
+ email: scott.patterson@digitalaun.com
12
+ homepage: http://rets4r.rubyforge.org/
13
+ rubyforge_project: rets4r
14
+ description:
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">"
22
+ - !ruby/object:Gem::Version
23
+ version: 0.0.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Scott Patterson
31
+ files:
32
+ - examples/client_get_object.rb
33
+ - examples/client_login.rb
34
+ - examples/client_metadata.rb
35
+ - examples/client_search.rb
36
+ - lib/rets4r
37
+ - lib/rets4r.rb
38
+ - lib/rets4r/auth.rb
39
+ - lib/rets4r/client
40
+ - lib/rets4r/client.rb
41
+ - lib/rets4r/client/data.rb
42
+ - lib/rets4r/client/dataobject.rb
43
+ - lib/rets4r/client/metadata.rb
44
+ - lib/rets4r/client/metadataindex.rb
45
+ - lib/rets4r/client/parser
46
+ - lib/rets4r/client/parser.rb
47
+ - lib/rets4r/client/transaction.rb
48
+ - lib/rets4r/client/parser/rexml.rb
49
+ - lib/rets4r/client/parser/xmlparser.rb
50
+ - test/client
51
+ - test/ts_all.rb
52
+ - test/ts_client.rb
53
+ - test/client/data
54
+ - test/client/parser
55
+ - test/client/tc_auth.rb
56
+ - test/client/tc_client.rb
57
+ - test/client/tc_metadataindex.rb
58
+ - test/client/test_parser.rb
59
+ - test/client/ts_all.rb
60
+ - test/client/data/1.5
61
+ - test/client/data/1.5/error.xml
62
+ - test/client/data/1.5/invalid_compact.xml
63
+ - test/client/data/1.5/login.xml
64
+ - test/client/data/1.5/metadata.xml
65
+ - test/client/data/1.5/search_compact.xml
66
+ - test/client/data/1.5/search_unescaped_compact.xml
67
+ - test/client/parser/tc_rexml.rb
68
+ - test/client/parser/tc_xmlparser.rb
69
+ - CONTRIBUTORS
70
+ - README
71
+ - LICENSE
72
+ - RUBYS
73
+ - GPL
74
+ - CHANGELOG
75
+ - TODO
76
+ test_files:
77
+ - test/ts_all.rb
78
+ rdoc_options:
79
+ - --main
80
+ - README
81
+ extra_rdoc_files:
82
+ - CONTRIBUTORS
83
+ - README
84
+ - LICENSE
85
+ - RUBYS
86
+ - GPL
87
+ - CHANGELOG
88
+ - TODO
89
+ executables: []
90
+
91
+ extensions: []
92
+
93
+ requirements: []
94
+
95
+ dependencies: []
96
+