jschairb-rets4r 1.1.18

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.
Files changed (63) hide show
  1. data/.document +5 -0
  2. data/CHANGELOG +566 -0
  3. data/CONTRIBUTORS +7 -0
  4. data/Gemfile +10 -0
  5. data/LICENSE +29 -0
  6. data/MANIFEST +62 -0
  7. data/NEWS +186 -0
  8. data/README.rdoc +43 -0
  9. data/RUBYS +56 -0
  10. data/Rakefile +50 -0
  11. data/TODO +35 -0
  12. data/examples/client_get_object.rb +49 -0
  13. data/examples/client_login.rb +39 -0
  14. data/examples/client_mapper.rb +17 -0
  15. data/examples/client_metadata.rb +42 -0
  16. data/examples/client_parser.rb +9 -0
  17. data/examples/client_search.rb +49 -0
  18. data/examples/settings.yml +114 -0
  19. data/lib/rets4r.rb +14 -0
  20. data/lib/rets4r/auth.rb +73 -0
  21. data/lib/rets4r/client.rb +487 -0
  22. data/lib/rets4r/client/data.rb +14 -0
  23. data/lib/rets4r/client/dataobject.rb +28 -0
  24. data/lib/rets4r/client/exceptions.rb +116 -0
  25. data/lib/rets4r/client/links.rb +32 -0
  26. data/lib/rets4r/client/metadata.rb +15 -0
  27. data/lib/rets4r/client/parsers/compact.rb +42 -0
  28. data/lib/rets4r/client/parsers/compact_nokogiri.rb +91 -0
  29. data/lib/rets4r/client/parsers/metadata.rb +92 -0
  30. data/lib/rets4r/client/parsers/response_parser.rb +100 -0
  31. data/lib/rets4r/client/requester.rb +143 -0
  32. data/lib/rets4r/client/transaction.rb +31 -0
  33. data/lib/rets4r/core_ext/array/extract_options.rb +15 -0
  34. data/lib/rets4r/core_ext/class/attribute_accessors.rb +58 -0
  35. data/lib/rets4r/core_ext/hash/keys.rb +46 -0
  36. data/lib/rets4r/core_ext/hash/slice.rb +39 -0
  37. data/lib/rets4r/listing_mapper.rb +17 -0
  38. data/lib/rets4r/listing_service.rb +35 -0
  39. data/lib/rets4r/loader.rb +8 -0
  40. data/lib/tasks/annotations.rake +121 -0
  41. data/lib/tasks/coverage.rake +13 -0
  42. data/rets4r.gemspec +24 -0
  43. data/spec/rets4r_compact_data_parser_spec.rb +7 -0
  44. data/test/data/1.5/bad_compact.xml +7 -0
  45. data/test/data/1.5/count_only_compact.xml +3 -0
  46. data/test/data/1.5/error.xml +1 -0
  47. data/test/data/1.5/invalid_compact.xml +4 -0
  48. data/test/data/1.5/login.xml +16 -0
  49. data/test/data/1.5/metadata.xml +0 -0
  50. data/test/data/1.5/search_compact.xml +8 -0
  51. data/test/data/1.5/search_compact_big.xml +136 -0
  52. data/test/data/1.5/search_unescaped_compact.xml +8 -0
  53. data/test/data/listing_service.yml +36 -0
  54. data/test/test_auth.rb +68 -0
  55. data/test/test_client.rb +342 -0
  56. data/test/test_client_links.rb +39 -0
  57. data/test/test_compact_nokogiri.rb +64 -0
  58. data/test/test_helper.rb +12 -0
  59. data/test/test_listing_mapper.rb +112 -0
  60. data/test/test_loader.rb +24 -0
  61. data/test/test_parser.rb +96 -0
  62. data/test/test_quality.rb +57 -0
  63. metadata +211 -0
data/CONTRIBUTORS ADDED
@@ -0,0 +1,7 @@
1
+ Scott Patterson <scott.patterson@digitalaun.com>
2
+
3
+ Fran�ois Beausoleil <http://blog.teksol.info/>
4
+ John Wulff <johnw@orcasnet.com>
5
+ Joseph Holsten <joseph@josephholsten.com>
6
+ Andrew Vit <andrew@avit.ca>
7
+ Brian Dunn <brianpatrickdunn@gmail.com>
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ source :rubygems
2
+
3
+ gem 'nokogiri'
4
+
5
+ group :dev do
6
+ gem 'mocha'
7
+ gem 'rake'
8
+ gem 'shoulda'
9
+ gem 'activesupport'
10
+ end
data/LICENSE ADDED
@@ -0,0 +1,29 @@
1
+ RETS4R
2
+ Copyright 2006 Scott Patterson <scott.patterson@digitalaun.com>
3
+
4
+ This program is copyrighted free software by Scott Patterson. You can
5
+ redistribute it and/or modify it under the same terms of Ruby's license;
6
+ either the dual license version in 2003 (see the file RUBYS), or any later
7
+ version.
8
+
9
+ Some parts Copyright (c) 2009 bgetting
10
+ Some parts Copyright (c) 2009 John Wulff
11
+
12
+ Permission is hereby granted, free of charge, to any person obtaining
13
+ a copy of this software and associated documentation files (the
14
+ "Software"), to deal in the Software without restriction, including
15
+ without limitation the rights to use, copy, modify, merge, publish,
16
+ distribute, sublicense, and/or sell copies of the Software, and to
17
+ permit persons to whom the Software is furnished to do so, subject to
18
+ the following conditions:
19
+
20
+ The above copyright notice and this permission notice shall be
21
+ included in all copies or substantial portions of the Software.
22
+
23
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
25
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
26
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
27
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
28
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
29
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/MANIFEST ADDED
@@ -0,0 +1,62 @@
1
+ .document
2
+ CHANGELOG
3
+ CONTRIBUTORS
4
+ Gemfile
5
+ LICENSE
6
+ MANIFEST
7
+ NEWS
8
+ README.rdoc
9
+ RUBYS
10
+ Rakefile
11
+ TODO
12
+ examples/client_get_object.rb
13
+ examples/client_login.rb
14
+ examples/client_mapper.rb
15
+ examples/client_metadata.rb
16
+ examples/client_parser.rb
17
+ examples/client_search.rb
18
+ examples/settings.yml
19
+ lib/rets4r.rb
20
+ lib/rets4r/auth.rb
21
+ lib/rets4r/client.rb
22
+ lib/rets4r/client/data.rb
23
+ lib/rets4r/client/dataobject.rb
24
+ lib/rets4r/client/exceptions.rb
25
+ lib/rets4r/client/links.rb
26
+ lib/rets4r/client/metadata.rb
27
+ lib/rets4r/client/parsers/compact.rb
28
+ lib/rets4r/client/parsers/compact_nokogiri.rb
29
+ lib/rets4r/client/parsers/metadata.rb
30
+ lib/rets4r/client/parsers/response_parser.rb
31
+ lib/rets4r/client/requester.rb
32
+ lib/rets4r/client/transaction.rb
33
+ lib/rets4r/core_ext/array/extract_options.rb
34
+ lib/rets4r/core_ext/class/attribute_accessors.rb
35
+ lib/rets4r/core_ext/hash/keys.rb
36
+ lib/rets4r/core_ext/hash/slice.rb
37
+ lib/rets4r/listing_mapper.rb
38
+ lib/rets4r/listing_service.rb
39
+ lib/rets4r/loader.rb
40
+ lib/tasks/annotations.rake
41
+ lib/tasks/coverage.rake
42
+ rets4r.gemspec
43
+ spec/rets4r_compact_data_parser_spec.rb
44
+ test/data/1.5/bad_compact.xml
45
+ test/data/1.5/count_only_compact.xml
46
+ test/data/1.5/error.xml
47
+ test/data/1.5/invalid_compact.xml
48
+ test/data/1.5/login.xml
49
+ test/data/1.5/metadata.xml
50
+ test/data/1.5/search_compact.xml
51
+ test/data/1.5/search_compact_big.xml
52
+ test/data/1.5/search_unescaped_compact.xml
53
+ test/data/listing_service.yml
54
+ test/test_auth.rb
55
+ test/test_client.rb
56
+ test/test_client_links.rb
57
+ test/test_compact_nokogiri.rb
58
+ test/test_helper.rb
59
+ test/test_listing_mapper.rb
60
+ test/test_loader.rb
61
+ test/test_parser.rb
62
+ test/test_quality.rb
data/NEWS ADDED
@@ -0,0 +1,186 @@
1
+ 1.1.17
2
+ New features
3
+ * RETS4R::Client::ResponseParser#parse_results: works with COMPACT-DECODED
4
+ * RETS4R::Client::CompactDataParser#parse_results: works without a
5
+ delimiter in response
6
+ * RETS4R::Client::CompactDataParser#parse_data: works without column names
7
+ in response
8
+ * RETS4R::Client::CompactNokogiriParser: yields data as it is read
9
+ * RETS4R::ListingMapper: added
10
+
11
+ Bug fixes
12
+ * RETS4R::Client#get_object: checks content-type
13
+ * RETS4R::Client::ResponseParser: no longer writes a temp file
14
+
15
+ Internal API changes
16
+ * RETS4R::Client::MetadataIndex: removed
17
+
18
+ 1.1.16
19
+ Internal API changes
20
+ * RETS4R::Loader::load: parse from io, not file name
21
+
22
+ 1.1.15
23
+ Bug fixes
24
+ * RETS4R::Client::CompactNokogiriParser: now parses long lines
25
+
26
+ 1.1.14
27
+ New features
28
+ * RETS4R::Loader: added
29
+ * RETS4R::Client::CompactNokogiriParser: added
30
+
31
+ Other changes
32
+ * Examples use demo RETS server
33
+ * New parser example
34
+
35
+ 1.1.13
36
+ Use gemcutter (Joseph Holsten)
37
+
38
+ * Rakefile: include GemcutterTasks
39
+
40
+ Fix rdoc reference (Joseph Holsten)
41
+
42
+ * README: renamed to README.rdoc
43
+ * Rakefile: likewise
44
+ * rets4r.gemspec: likewise
45
+ * CONTRIBUTORS: added Joseph Holsten
46
+
47
+ 1.1.12
48
+ Merge example settings into a config file (Joseph Holsten)
49
+ Clean up testing (Joseph Holsten)
50
+
51
+ 1.1.11
52
+ Merge many rets4r forks (Joseph Holsten)
53
+
54
+ 1.1.10
55
+ ResponseParser#parse_common: should be _not_ equals (Jacob Basham)
56
+
57
+ 1.1.9
58
+ (no change)
59
+
60
+ 1.1.8
61
+ Client, ResponseParser#parse_common: Parser cleanup (Jacob Basham)
62
+
63
+ 1.1.7
64
+ Client, Client#initialize, Client#create_query_string, Client#request:
65
+ Cleaned up files to be 80 skinny, added CGI escaping of data (Jacob Basham)
66
+
67
+ 1.1.5
68
+ gemspec: fix date error (Jacob Basham)
69
+
70
+ 1.1.3
71
+ gemspec: update (Jacob Basham)
72
+
73
+ 1.1.2
74
+ ResponseParser#parse_key_value: Accept CARETS response (John Wulff)
75
+
76
+ 1.1.1
77
+ ResponseParser#parse_key_value: Handle nils (John Wulff)
78
+
79
+ 1.1.0
80
+ Strip key value pairs for CAPABILITY_LIST endpoints (John Wulff)
81
+ Add lib/rets4r to default load path (John Wulff)
82
+
83
+ 1.0.0
84
+ See changes in 9f7ff731250abc1f73b21cb01d3a6fc3a6617e73 (John Wulff)
85
+
86
+ Parser#parse_compact_line: simplify split.
87
+ Parser#parse_data: remove legacy support.
88
+ Auth::authenticate: handle missing www-authenticate header.
89
+ Auth::parse_header: strip keys, values.
90
+ Client#initialize: method signature changed, removed options, added format.
91
+ Client#set_parser_class, Client#get_parser_class,
92
+ Client#parser_class, Client#parser_class=, Client#set_output,
93
+ Client#get_output, Client#output, Client#output=: removed, callers changed.
94
+ Lay groundwork for non-compact format requests
95
+ Client::DEFAULT_METHOD: changed to GET
96
+ Client::DEFAULT_USER_AGENT: changed to Firefox
97
+ Client#login: handle absolute uris
98
+ Client#parse: Removed. Changed callers to access parser directly.
99
+ Client#get_metadata: method signature changed, format removed. Use format instance variable.
100
+ Client#download_metadata: added
101
+ Client#get_object: handle text/xml responses
102
+ !!! Client#get_object: remove quote support from multipart boundary handling
103
+ Client#count: added
104
+ Client#basic_encode: added
105
+ !!! Client#create_query_string: Remove escaping on request query keys, values
106
+ Client#debug: removed, all calls inlined.
107
+ Client#RETSTransactionException: added
108
+
109
+
110
+ client/parsers/
111
+
112
+
113
+ 0.8.5
114
+ Parser#parse_compact_line now once again ignores beginning and ending delimiters. (Scott Patterson)
115
+ Parser#parse_data now ignores header fields that are nil or blank when stripped. (Scott Patterson)
116
+ Updated test to use the rets client version of the client, not hardcoded for post and get tests. (Scott Patterson)
117
+
118
+ 0.8.4
119
+ Fixed auth issue with authenticate headers with spaces after commas. (Ken Wiesner, Scott Patterson)
120
+ When an exception is raised in the authentication parsing code, complain by raising
121
+ a new exception, but also report anything of interest at the same time: request,
122
+ response, response's body. (François Beausoleil)
123
+ Fixed Client#request to actually respect the specified request method instead of always using GET requests. (Scott Patterson)
124
+ Set default request method to POST since some RETS servers seem to have trouble with GET requests. (Scott Patterson)
125
+
126
+ 0.8.3
127
+ Added example #set_pre_request_block. (François Beausoleil)
128
+ Allow a pre request block to be set for RETS4R::Client.
129
+ This allows the caller to change the request in any meaningful way, such as adding a
130
+ RETS-UA-Authorization header when appropriate. (François Beausoleil)
131
+ Better response handling of HTTP errors. Response codes > 300 other than 401 now raise an
132
+ HTTPError exception that encapsulates the HTTPResponse object.
133
+ 401 errors raise a LoginError exception. (Scott Patterson)
134
+ Added in RETS specification error messages to reference. (Scott Patterson)
135
+ New Rakefile. Install the rake gem and do 'rake test' to run the tests. (François Beausoleil)
136
+
137
+ 0.8.2
138
+ Added missing result parameter to Client#search's yield (Scott Patterson)
139
+ Added 1.7 to supported list and default version (François Beausoleil)
140
+ No longer sends empty (nil) headers (François Beausoleil)
141
+ Added debugging to HTTP output. (François Beausoleil, Scott Patterson)
142
+ Added support for multiple set-cookie headers in the server response (François Beausoleil)
143
+ Added basic search example (Scott Patterson)
144
+ Implied default value of \t in RETS4R::Client::Transaction#delimiter (François Beausoleil)
145
+ #get_metadata now returns the block's value or the results. (François Beausoleil)
146
+ Made sure #login always calls #logout if called with a block. #login returns the block's value
147
+ instead of results. (François Beausoleil)
148
+ New assertions that require Client to have Ruby-like accessors for attributes, instead of
149
+ getters and setters. Applied 'Rename Attribute' on @parser, because #get_parser_class
150
+ was returning the class of the parser's class, instead of the parser's class itself. (François Beausoleil)
151
+ Client#set_rets_version should take care to generate the correct RETS-Version header,
152
+ and #get_rets_version should undo the changes that #set_rets_version did before
153
+ returning the value. (François Beausoleil)
154
+ Don't rescue an exception that's not being processed in Parser. (François Beausoleil)
155
+ RETS4R::Client#get_object extensions: yield or return the array of DataObject instances;
156
+ changed the multipart/parallel response boundary processing rules
157
+ (include \r\n in the boundary detection); added documentation. (François Beausoleil)
158
+ Added GetObject example (Scott Patterson)
159
+ Changed #get_object now yields each DataObject if a block is given rather
160
+ than an array of DataObjects (Scott Patterson)
161
+
162
+ 0.8.1
163
+ Added Action-URL support per the specification.
164
+ Added a secondary_response accessor to the Transaction object, which is what the Action-URL result is stored in.
165
+ Fixed a bug with loggers and parsers
166
+
167
+ 0.8.0
168
+ Fixed RParser support, which now means you can use REXML.
169
+ RParser now retries XML that produced a parser error after trying to clean it.
170
+ Parser support is now more open so that more parsers can be easily added in the future.
171
+ Reorganized parser file layout.
172
+ CParser will only be loaded if libxml (its dependency) is present. If it is, it is the default
173
+ parser.
174
+ Added more parser unit tests.
175
+ Renamed CParser to XMLParser and RPARSER to REXML, both with the hierarchy RETS4R::Client::Module.
176
+ Fixed a bug with the parser output not being set properly.
177
+ Fixed a bug with the parser not respecting the DELIMITER value and insisting on tab delimiters.
178
+ Added support for using a logger
179
+ Added more defaults to the search options (Count => '0', Format => 'COMPACT')
180
+ Added some Rubyisms (blocks can now be given to #new, #login, #get_metadata, #get_object, and #search)
181
+
182
+ 0.7.1
183
+ Added support for reading the results count for searches.
184
+
185
+ 0.7.0
186
+ Initial GEM Version
data/README.rdoc ADDED
@@ -0,0 +1,43 @@
1
+ = RETS4R
2
+
3
+ RETS4R provides a native Ruby interface to the RETS (Real Estate
4
+ Transaction Standard). It currently is built for the 1.5 specification,
5
+ but support for 1.7 and 2.0 are planned. It does not currently implement
6
+ all of the specification, but the most commonly used portions.
7
+ Specifically, there is no support for Update transactions.
8
+
9
+ While this is the only "native" Ruby RETS library currently available
10
+ (to my knowledge), there is another client written in C++ with Ruby
11
+ bindings available from the Center for Realtor� Technology
12
+ (http://www.crt.realtors.org/projects/rets/librets/).
13
+
14
+ == Links
15
+
16
+ * Source: http://github.com/josephholsten/rets4r
17
+ * Documentation: http://rdoc.info/projects/josephholsten/rets4r
18
+
19
+ == Requirements
20
+
21
+ * Ruby 1.8.4
22
+
23
+ == License
24
+
25
+ Please see the LICENSE file.
26
+
27
+ == Acknowledgments
28
+
29
+ This project was made possible in part by the Contra Costa Association of
30
+ Realtors� (http://www.ccartoday.com).
31
+
32
+ == Getting Started
33
+
34
+ Take a look at the examples directory. You'll find it more helpful than
35
+ the unit tests because the unit tests work off of local files and mock
36
+ objects, rather than making real transaction calls.
37
+
38
+ Due to the nature of this library, it is HIGHLY recommended that you
39
+ have at least a basic understanding of the RETS protocol. The official
40
+ RETS website is http://www.rets.org.
41
+
42
+ Most of the time, you will be either searching for resources or getting
43
+ objects, so begin there.
data/RUBYS ADDED
@@ -0,0 +1,56 @@
1
+ Ruby is copyrighted free software by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ You can redistribute it and/or modify it under either the terms of the GPL
3
+ (see the file GPL), or the conditions below:
4
+
5
+ 1. You may make and give away verbatim copies of the source form of the
6
+ software without restriction, provided that you duplicate all of the
7
+ original copyright notices and associated disclaimers.
8
+
9
+ 2. You may modify your copy of the software in any way, provided that
10
+ you do at least ONE of the following:
11
+
12
+ a) place your modifications in the Public Domain or otherwise
13
+ make them Freely Available, such as by posting said
14
+ modifications to Usenet or an equivalent medium, or by allowing
15
+ the author to include your modifications in the software.
16
+
17
+ b) use the modified software only within your corporation or
18
+ organization.
19
+
20
+ c) give non-standard binaries non-standard names, with
21
+ instructions on where to get the original software distribution.
22
+
23
+ d) make other distribution arrangements with the author.
24
+
25
+ 3. You may distribute the software in object code or binary form,
26
+ provided that you do at least ONE of the following:
27
+
28
+ a) distribute the binaries and library files of the software,
29
+ together with instructions (in the manual page or equivalent)
30
+ on where to get the original distribution.
31
+
32
+ b) accompany the distribution with the machine-readable source of
33
+ the software.
34
+
35
+ c) give non-standard binaries non-standard names, with
36
+ instructions on where to get the original software distribution.
37
+
38
+ d) make other distribution arrangements with the author.
39
+
40
+ 4. You may modify and include the part of the software into any other
41
+ software (possibly commercial). But some files in the distribution
42
+ are not written by the author, so that they are not under these terms.
43
+
44
+ For the list of those files and their copying conditions, see the
45
+ file LEGAL.
46
+
47
+ 5. The scripts and library files supplied as input to or produced as
48
+ output from the software do not automatically fall under the
49
+ copyright of the software, but belong to whomever generated them,
50
+ and may be sold commercially, and may be aggregated with this
51
+ software.
52
+
53
+ 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
54
+ IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
55
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
56
+ PURPOSE.
data/Rakefile ADDED
@@ -0,0 +1,50 @@
1
+ require 'rake'
2
+ require 'rake/clean'
3
+ require 'rake/packagetask'
4
+ require 'rake/gempackagetask'
5
+ require 'rake/contrib/rubyforgepublisher'
6
+ require 'fileutils'
7
+ include FileUtils
8
+
9
+ # impart all tasks in lib/tasks/
10
+ Dir['lib/tasks/*.rake'].each { |task| import task }
11
+
12
+ require 'rake/testtask'
13
+ Rake::TestTask.new(:test) do |test|
14
+ test.verbose = true
15
+ end
16
+
17
+ task :default => :test
18
+
19
+ require 'rake/rdoctask'
20
+ Rake::RDocTask.new do |rdoc|
21
+ if File.exist?('VERSION.yml')
22
+ config = YAML.load(File.read('VERSION.yml'))
23
+ version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
24
+ else
25
+ version = ""
26
+ end
27
+
28
+ rdoc.rdoc_dir = 'rdoc'
29
+ rdoc.title = "rets4r #{version}"
30
+ rdoc.options << '--line-numbers' << '--inline-source'
31
+ rdoc.rdoc_files.include('README.rdoc')
32
+ rdoc.rdoc_files.include('lib/**/*.rb')
33
+ end
34
+ CLEAN << 'rdoc'
35
+
36
+ file 'MANIFEST.tmp' do
37
+ sh %{find . -type f | sed 's/\\.\\///' | grep -v '.git' | sort > MANIFEST.tmp}
38
+ end
39
+ CLEAN << 'MANIFEST.tmp'
40
+
41
+ desc "Check the manifest against current files"
42
+ task :check_manifest => [:clean, 'MANIFEST', 'MANIFEST.tmp'] do
43
+ puts `diff -du MANIFEST MANIFEST.tmp`
44
+ end
45
+
46
+ CLEAN << '.rake_tasks'
47
+
48
+ lib = File.expand_path("../lib/rets4r.rb", __FILE__)
49
+ version = File.read(lib)[/^\s*VERSION\s*=\s*(['"])(\d\.\d\.\d+)\1/, 2]
50
+ CLEAN << "rets4r-#{version}.gem"