josephholsten-rets4r 1.1.16 → 1.1.17

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,6 +1,192 @@
1
+ Wed Mar 3 12:43:25 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
2
+
3
+ Require mocha before shoulda to fix 'uninitialized constant Test::Unit::TestResult::TestResultFailureSupport'
4
+
5
+ * test/test_helper.rb: require mocha earlier
6
+
7
+ Tue Feb 23 07:12:46 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
8
+
9
+ Add ListingMapper to convert listing keys
10
+
11
+ * lib/rets4r.rb: require listing service, mapper
12
+ * lib/rets4r/listing_mapper.rb: new file
13
+ * lib/rets4r/listing_service.rb: new file
14
+ * test/data/listing_service.yml: new file
15
+ * test/listing_mapper_test.rb: new file
16
+ * test/test_helper.rb: new file
17
+
18
+ * lib/rets4r/core_ext/array/extract_options.rb: helper from rails
19
+ * lib/rets4r/core_ext/class/attribute_accessors.rb: likewise
20
+ * lib/rets4r/core_ext/hash/keys.rb: likewise
21
+ * lib/rets4r/core_ext/hash/slice.rb: likewise
22
+
23
+ Sat Feb 20 05:39:51 2010 Brian Dunn <brianpatrickdunn@gmail.com>
24
+
25
+ Test that SAX parser yeilds durring read.
26
+ * test/compact_nokogiri_test.rb: modified
27
+ * test/data/1.5/search_compact_big.xml: new file
28
+
29
+ Thu Feb 11 06:21:54 2010 Brian Dunn <brianpatrickdunn@gmail.com>
30
+
31
+ * lib/rets4r/client/parsers/compact_nokogiri.rb
32
+ (CompactNokogiriParser#each): new. should yield each row as the stream is
33
+ read
34
+ (CompactNokogiriParser#to_a): reads the whole stream and returns
35
+ rows in an array
36
+ * lib/rets4r/loader.rb: uses the each method to yield as the stream
37
+ is read
38
+ * test/compact_nokogiri_test.rb: uses to_a instead.
39
+
40
+ Sun Feb 7 19:05:46 2010 Scott Patterson <scott.patterson@digitalaun.com>
41
+
42
+ Removed unnecessary writing of response to xml file in /tmp dir.
43
+
44
+ Sun Feb 7 19:11:38 2010 Scott Patterson <scott.patterson@digitalaun.com>
45
+
46
+ Reversed aliases and accessors to use Ruby-style accessors with the get/set methods aliased.
47
+
48
+ Sun Feb 7 19:04:17 2010 Scott Patterson <scott.patterson@digitalaun.com>
49
+
50
+ Added in #data alias to #response for compatibility.
51
+
52
+ Sun Feb 7 18:57:50 2010 Scott Patterson <scott.patterson@digitalaun.com>
53
+
54
+ Removed old experiment.
55
+
56
+ Sun Feb 7 18:56:24 2010 Scott Patterson <scott.patterson@digitalaun.com>
57
+
58
+ Added compact response with only a count.
59
+
60
+ Thu Sep 10 23:47:49 2009 Andrew Vit <andrew@avit.ca>
61
+
62
+ Support response without a delimiter or column names
63
+
64
+ Mon Sep 14 22:21:35 2009 Andrew Vit <andrew@avit.ca>
65
+
66
+ requiring needed compact parser
67
+
68
+ Wed Sep 16 04:06:16 2009 Andrew Vit <andrew@avit.ca>
69
+
70
+ Handle compact-decoded format using same parser
71
+
72
+ Wed Sep 16 04:06:35 2009 Andrew Vit <andrew@avit.ca>
73
+
74
+ Fixed crash with missing response headers
75
+
76
+ Fri Feb 5 20:37:14 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
77
+
78
+ Version bump to 1.1.16
79
+
80
+ Fri Feb 5 20:36:39 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
81
+
82
+ Merge branch 'master' of github.com:josephholsten/rets4r
83
+
84
+ Fri Feb 5 20:34:13 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
85
+
86
+ Make loader accept any IO
87
+
88
+ * lib/rets4r/client/parsers/compact_nokogiri.rb
89
+ (RETS4R::Loader::load): parse from io, not file name. Callers
90
+ changed
91
+
92
+ Fri Jan 22 01:39:23 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
93
+
94
+ Version bump to 1.1.15
95
+
96
+ Fri Jan 22 01:37:22 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
97
+
98
+ Merge branch 'master' of github.com:josephholsten/rets4r
99
+
100
+ Fri Jan 22 01:32:47 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
101
+
102
+ Fix bug for parsing long lines
103
+
104
+ * lib/rets4r/client/parsers/compact_nokogiri.rb
105
+ (RETS4R::Client::CompactNokogiriParser::CompactDocument#start_element)
106
+ (RETS4R::Client::CompactNokogiriParser::CompactDocument#end_element)
107
+ (RETS4R::Client::CompactNokogiriParser::CompactDocument#characters):
108
+ defer string handling until the element has ended
109
+ * test/compact_nokogiri_test.rb
110
+ (CompactNokogiriTest#test_should_handle_big_data): added
111
+ * test/data/1.5/bad_compact.xml: new file
112
+
113
+ Fri Jan 22 00:51:00 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
114
+
115
+ Regenerated gemspec for version 1.1.14
116
+
117
+ Fri Jan 22 00:50:32 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
118
+
119
+ Version bump to 1.1.14
120
+
121
+ Fri Jan 22 00:44:04 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
122
+
123
+ Add sax parser
124
+
125
+ * lib/rets4r.rb: require compact_nokogiri.rb
126
+ * lib/rets4r/loader.rb (RETS4R::Loader::load): use sax parser
127
+ * lib/rets4r/client/parsers/compact_nokogiri.rb: new file
128
+ * test/compact_nokogiri_test.rb: new file
129
+
130
+ Fri Jan 22 00:38:43 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
131
+
132
+ Run tests that end in _test.rb
133
+
134
+ * Rakefile: add *_test.rb to test pattern
135
+
136
+ Thu Jan 21 23:35:34 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
137
+
138
+ Add a batch file loader
139
+
140
+ * lib/rets4r.rb: require loader
141
+ * lib/rets4r/loader.rb: new file
142
+ * test/loader_test.rb: new file
143
+
144
+ Thu Jan 21 23:10:36 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
145
+
146
+ Add parser example
147
+
148
+ * examples/client_parser.rb: added
149
+
150
+ Thu Jan 21 23:02:50 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
151
+
152
+ Fix reference to rcov instead of relevance-rcov
153
+
154
+ * lib/tasks/coverage.rake: say rcov, not relevance-rcov
155
+
156
+ Thu Jan 21 23:02:04 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
157
+
158
+ Add limit to settings
159
+
160
+ * examples/client_search.rb: pull limit from settings
161
+ * examples/settings.yml: set a sane default
162
+
163
+ Wed Jan 20 11:58:32 2010 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
164
+
165
+ use demo rets server
166
+
167
+ Thu Nov 26 01:06:06 2009 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
168
+
169
+ fix links list
170
+
171
+ Thu Nov 26 01:05:26 2009 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
172
+
173
+ fix indentation
174
+
175
+ Thu Nov 26 01:04:25 2009 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
176
+
177
+ Link to related sites
178
+
179
+ * README.rdoc: updated docs
180
+
181
+ Wed Nov 25 06:37:07 2009 Joseph Anthony Pasquale Holsten <joseph@josephholsten.com>
182
+
183
+ Use gemcutter
184
+
185
+ * Rakefile: include GemcutterTasks
186
+
1
187
  1.1.13
2
188
  Use gemcutter (Joseph Holsten)
3
-
189
+
4
190
  * Rakefile: include GemcutterTasks
5
191
 
6
192
  Fix rdoc reference (Joseph Holsten)
@@ -72,10 +258,8 @@
72
258
  Client#debug: removed, all calls inlined.
73
259
  Client#RETSTransactionException: added
74
260
 
75
-
76
261
  client/parsers/
77
262
 
78
-
79
263
  0.8.5
80
264
  Parser#parse_compact_line now once again ignores beginning and ending delimiters. (Scott Patterson)
81
265
  Parser#parse_data now ignores header fields that are nil or blank when stripped. (Scott Patterson)
data/CONTRIBUTORS CHANGED
@@ -3,3 +3,5 @@ Scott Patterson <scott.patterson@digitalaun.com>
3
3
  Fran�ois Beausoleil <http://blog.teksol.info/>
4
4
  John Wulff <johnw@orcasnet.com>
5
5
  Joseph Holsten <joseph@josephholsten.com>
6
+ Andrew Vit <andrew@avit.ca>
7
+ Brian Dunn <brianpatrickdunn@gmail.com>
data/NEWS ADDED
@@ -0,0 +1,183 @@
1
+ New features
2
+ * RETS4R::Client::ResponseParser#parse_results: works with COMPACT-DECODED
3
+ * RETS4R::Client::CompactDataParser#parse_results: works without a delimiter in response
4
+ * RETS4R::Client::CompactDataParser#parse_data: works without column names in response
5
+ * RETS4R::Client::CompactNokogiriParser: yields data as it is read
6
+ * RETS4R::ListingMapper: added
7
+
8
+ Bug fixes
9
+ * RETS4R::Client#get_object: checks content-type
10
+ * RETS4R::Client::ResponseParser: no longer writes a temp file
11
+
12
+ Internal API changes
13
+ * RETS4R::Client::MetadataIndex: removed
14
+
15
+ 1.1.16
16
+ Internal API changes
17
+ * RETS4R::Loader::load: parse from io, not file name
18
+
19
+ 1.1.15
20
+ Bug fixes
21
+ * RETS4R::Client::CompactNokogiriParser: now parses long lines
22
+
23
+ 1.1.14
24
+ New features
25
+ * RETS4R::Loader: added
26
+ * RETS4R::Client::CompactNokogiriParser: added
27
+
28
+ Other changes
29
+ * Examples use demo RETS server
30
+ * New parser example
31
+
32
+ 1.1.13
33
+ Use gemcutter (Joseph Holsten)
34
+
35
+ * Rakefile: include GemcutterTasks
36
+
37
+ Fix rdoc reference (Joseph Holsten)
38
+
39
+ * README: renamed to README.rdoc
40
+ * Rakefile: likewise
41
+ * rets4r.gemspec: likewise
42
+ * CONTRIBUTORS: added Joseph Holsten
43
+
44
+ 1.1.12
45
+ Merge example settings into a config file (Joseph Holsten)
46
+ Clean up testing (Joseph Holsten)
47
+
48
+ 1.1.11
49
+ Merge many rets4r forks (Joseph Holsten)
50
+
51
+ 1.1.10
52
+ ResponseParser#parse_common: should be _not_ equals (Jacob Basham)
53
+
54
+ 1.1.9
55
+ (no change)
56
+
57
+ 1.1.8
58
+ Client, ResponseParser#parse_common: Parser cleanup (Jacob Basham)
59
+
60
+ 1.1.7
61
+ Client, Client#initialize, Client#create_query_string, Client#request:
62
+ Cleaned up files to be 80 skinny, added CGI escaping of data (Jacob Basham)
63
+
64
+ 1.1.5
65
+ gemspec: fix date error (Jacob Basham)
66
+
67
+ 1.1.3
68
+ gemspec: update (Jacob Basham)
69
+
70
+ 1.1.2
71
+ ResponseParser#parse_key_value: Accept CARETS response (John Wulff)
72
+
73
+ 1.1.1
74
+ ResponseParser#parse_key_value: Handle nils (John Wulff)
75
+
76
+ 1.1.0
77
+ Strip key value pairs for CAPABILITY_LIST endpoints (John Wulff)
78
+ Add lib/rets4r to default load path (John Wulff)
79
+
80
+ 1.0.0
81
+ See changes in 9f7ff731250abc1f73b21cb01d3a6fc3a6617e73 (John Wulff)
82
+
83
+ Parser#parse_compact_line: simplify split.
84
+ Parser#parse_data: remove legacy support.
85
+ Auth::authenticate: handle missing www-authenticate header.
86
+ Auth::parse_header: strip keys, values.
87
+ Client#initialize: method signature changed, removed options, added format.
88
+ Client#set_parser_class, Client#get_parser_class,
89
+ Client#parser_class, Client#parser_class=, Client#set_output,
90
+ Client#get_output, Client#output, Client#output=: removed, callers changed.
91
+ Lay groundwork for non-compact format requests
92
+ Client::DEFAULT_METHOD: changed to GET
93
+ Client::DEFAULT_USER_AGENT: changed to Firefox
94
+ Client#login: handle absolute uris
95
+ Client#parse: Removed. Changed callers to access parser directly.
96
+ Client#get_metadata: method signature changed, format removed. Use format instance variable.
97
+ Client#download_metadata: added
98
+ Client#get_object: handle text/xml responses
99
+ !!! Client#get_object: remove quote support from multipart boundary handling
100
+ Client#count: added
101
+ Client#basic_encode: added
102
+ !!! Client#create_query_string: Remove escaping on request query keys, values
103
+ Client#debug: removed, all calls inlined.
104
+ Client#RETSTransactionException: added
105
+
106
+
107
+ client/parsers/
108
+
109
+
110
+ 0.8.5
111
+ Parser#parse_compact_line now once again ignores beginning and ending delimiters. (Scott Patterson)
112
+ Parser#parse_data now ignores header fields that are nil or blank when stripped. (Scott Patterson)
113
+ Updated test to use the rets client version of the client, not hardcoded for post and get tests. (Scott Patterson)
114
+
115
+ 0.8.4
116
+ Fixed auth issue with authenticate headers with spaces after commas. (Ken Wiesner, Scott Patterson)
117
+ When an exception is raised in the authentication parsing code, complain by raising
118
+ a new exception, but also report anything of interest at the same time: request,
119
+ response, response's body. (François Beausoleil)
120
+ Fixed Client#request to actually respect the specified request method instead of always using GET requests. (Scott Patterson)
121
+ Set default request method to POST since some RETS servers seem to have trouble with GET requests. (Scott Patterson)
122
+
123
+ 0.8.3
124
+ Added example #set_pre_request_block. (François Beausoleil)
125
+ Allow a pre request block to be set for RETS4R::Client.
126
+ This allows the caller to change the request in any meaningful way, such as adding a
127
+ RETS-UA-Authorization header when appropriate. (François Beausoleil)
128
+ Better response handling of HTTP errors. Response codes > 300 other than 401 now raise an
129
+ HTTPError exception that encapsulates the HTTPResponse object.
130
+ 401 errors raise a LoginError exception. (Scott Patterson)
131
+ Added in RETS specification error messages to reference. (Scott Patterson)
132
+ New Rakefile. Install the rake gem and do 'rake test' to run the tests. (François Beausoleil)
133
+
134
+ 0.8.2
135
+ Added missing result parameter to Client#search's yield (Scott Patterson)
136
+ Added 1.7 to supported list and default version (François Beausoleil)
137
+ No longer sends empty (nil) headers (François Beausoleil)
138
+ Added debugging to HTTP output. (François Beausoleil, Scott Patterson)
139
+ Added support for multiple set-cookie headers in the server response (François Beausoleil)
140
+ Added basic search example (Scott Patterson)
141
+ Implied default value of \t in RETS4R::Client::Transaction#delimiter (François Beausoleil)
142
+ #get_metadata now returns the block's value or the results. (François Beausoleil)
143
+ Made sure #login always calls #logout if called with a block. #login returns the block's value
144
+ instead of results. (François Beausoleil)
145
+ New assertions that require Client to have Ruby-like accessors for attributes, instead of
146
+ getters and setters. Applied 'Rename Attribute' on @parser, because #get_parser_class
147
+ was returning the class of the parser's class, instead of the parser's class itself. (François Beausoleil)
148
+ Client#set_rets_version should take care to generate the correct RETS-Version header,
149
+ and #get_rets_version should undo the changes that #set_rets_version did before
150
+ returning the value. (François Beausoleil)
151
+ Don't rescue an exception that's not being processed in Parser. (François Beausoleil)
152
+ RETS4R::Client#get_object extensions: yield or return the array of DataObject instances;
153
+ changed the multipart/parallel response boundary processing rules
154
+ (include \r\n in the boundary detection); added documentation. (François Beausoleil)
155
+ Added GetObject example (Scott Patterson)
156
+ Changed #get_object now yields each DataObject if a block is given rather
157
+ than an array of DataObjects (Scott Patterson)
158
+
159
+ 0.8.1
160
+ Added Action-URL support per the specification.
161
+ Added a secondary_response accessor to the Transaction object, which is what the Action-URL result is stored in.
162
+ Fixed a bug with loggers and parsers
163
+
164
+ 0.8.0
165
+ Fixed RParser support, which now means you can use REXML.
166
+ RParser now retries XML that produced a parser error after trying to clean it.
167
+ Parser support is now more open so that more parsers can be easily added in the future.
168
+ Reorganized parser file layout.
169
+ CParser will only be loaded if libxml (its dependency) is present. If it is, it is the default
170
+ parser.
171
+ Added more parser unit tests.
172
+ Renamed CParser to XMLParser and RPARSER to REXML, both with the hierarchy RETS4R::Client::Module.
173
+ Fixed a bug with the parser output not being set properly.
174
+ Fixed a bug with the parser not respecting the DELIMITER value and insisting on tab delimiters.
175
+ Added support for using a logger
176
+ Added more defaults to the search options (Count => '0', Format => 'COMPACT')
177
+ Added some Rubyisms (blocks can now be given to #new, #login, #get_metadata, #get_object, and #search)
178
+
179
+ 0.7.1
180
+ Added support for reading the results count for searches.
181
+
182
+ 0.7.0
183
+ Initial GEM Version
data/Rakefile CHANGED
@@ -13,7 +13,7 @@ Dir['lib/tasks/*.rake'].each { |task| import task }
13
13
  begin
14
14
  require 'jeweler'
15
15
  Jeweler::Tasks.new do |gem|
16
- gem.name = "josephholsten-rets4r"
16
+ gem.name = "rets4r"
17
17
  gem.summary = 'A native Ruby implementation of RETS (Real Estate Transaction Standard).'
18
18
  gem.authors = ['Scott Patterson', 'John Wulff', 'bgetting', "Jacob Basham"]
19
19
  gem.email = ['scott.patterson@digitalaun.com', 'john@johnwulff.com', 'brian@terra-firma-design.com','jacob@paperpigeons.net']
data/VERSION.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  ---
2
- :build:
3
2
  :major: 1
4
3
  :minor: 1
5
- :patch: 16
4
+ :patch: 17
5
+ :build:
data/lib/rets4r.rb CHANGED
@@ -5,3 +5,5 @@ $:.unshift(dir) unless $:.include?(dir) || $:.include?(File.expand_path(dir))
5
5
  require 'client'
6
6
  require 'loader'
7
7
  require 'client/parsers/compact_nokogiri'
8
+ require 'rets4r/listing_service'
9
+ require 'rets4r/listing_mapper'
data/lib/rets4r/client.rb CHANGED
@@ -18,6 +18,7 @@ require 'cgi'
18
18
  require 'auth'
19
19
  require 'client/dataobject'
20
20
  require 'client/parsers/response_parser'
21
+ require 'client/parsers/compact'
21
22
  require 'thread'
22
23
  require 'logger'
23
24
 
@@ -164,15 +165,15 @@ module RETS4R
164
165
  @headers[name]
165
166
  end
166
167
 
167
- def set_user_agent(name)
168
+ def user_agent=(name)
168
169
  set_header('User-Agent', name)
169
170
  end
170
171
 
171
- def get_user_agent
172
+ def user_agent
172
173
  get_header('User-Agent')
173
174
  end
174
175
 
175
- def set_rets_version(version)
176
+ def rets_version=(version)
176
177
  if (SUPPORTED_RETS_VERSIONS.include? version)
177
178
  set_header('RETS-Version', "RETS/#{version}")
178
179
  else
@@ -180,27 +181,27 @@ module RETS4R
180
181
  end
181
182
  end
182
183
 
183
- def get_rets_version
184
+ def rets_version
184
185
  (get_header('RETS-Version') || "").gsub("RETS/", "")
185
186
  end
186
187
 
187
- def set_request_method(method)
188
+ def request_method=(method)
188
189
  @request_method = method
189
190
  end
190
191
 
191
- def get_request_method
192
+ def request_method
192
193
  # Basic Authentication
193
194
  #
194
195
  @request_method
195
196
  end
196
197
 
197
- # Provide more Ruby-like attribute accessors instead of get/set methods
198
- alias_method :user_agent=, :set_user_agent
199
- alias_method :user_agent, :get_user_agent
200
- alias_method :request_method=, :set_request_method
201
- alias_method :request_method, :get_request_method
202
- alias_method :rets_version=, :set_rets_version
203
- alias_method :rets_version, :get_rets_version
198
+ # Provide backwards-compatible get/set methods.
199
+ alias_method :set_user_agent, :user_agent=
200
+ alias_method :get_user_agent, :user_agent
201
+ alias_method :set_request_method, :request_method=
202
+ alias_method :get_request_method, :request_method
203
+ alias_method :set_rets_version, :rets_version=
204
+ alias_method :get_rets_version, :rets_version
204
205
 
205
206
  #### RETS Transaction Methods ####
206
207
  #
@@ -327,12 +328,12 @@ module RETS4R
327
328
  response = request(@urls['GetObject'], data, header)
328
329
  results = block_given? ? 0 : []
329
330
 
330
- if response['content-type'].include?('text/xml')
331
+ if response['content-type'] && response['content-type'].include?('text/xml')
331
332
  # This probably means that there was an error.
332
333
  # Response parser will likely raise an exception.
333
334
  rr = @response_parser.parse_object_response(response.body)
334
335
  return rr
335
- elsif response['content-type'].include?('multipart/parallel')
336
+ elsif response['content-type'] && response['content-type'].include?('multipart/parallel')
336
337
  content_type = process_content_type(response['content-type'])
337
338
 
338
339
  # TODO: log this