rets4r 0.8.5 → 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.
- data/.document +5 -0
- data/{test/client/data/1.5/metadata.xml → .gemtest} +0 -0
- data/CHANGELOG +611 -66
- data/CONTRIBUTORS +6 -2
- data/Gemfile +1 -0
- data/LICENSE +22 -0
- data/MANIFEST +63 -0
- data/NEWS +203 -0
- data/{README → README.rdoc} +11 -4
- data/RUBYS +7 -7
- data/Rakefile +48 -0
- data/TODO +5 -1
- data/examples/client_get_object.rb +31 -42
- data/examples/client_login.rb +20 -18
- data/examples/client_mapper.rb +17 -0
- data/examples/client_metadata.rb +28 -28
- data/examples/client_parser.rb +9 -0
- data/examples/client_search.rb +25 -27
- data/examples/settings.yml +114 -0
- data/lib/rets4r.rb +14 -1
- data/lib/rets4r/auth.rb +70 -66
- data/lib/rets4r/client.rb +470 -650
- data/lib/rets4r/client/data.rb +13 -13
- data/lib/rets4r/client/dataobject.rb +27 -19
- data/lib/rets4r/client/exceptions.rb +116 -0
- data/lib/rets4r/client/links.rb +32 -0
- data/lib/rets4r/client/metadata.rb +12 -12
- data/lib/rets4r/client/parsers/compact.rb +42 -0
- data/lib/rets4r/client/parsers/compact_nokogiri.rb +91 -0
- data/lib/rets4r/client/parsers/metadata.rb +92 -0
- data/lib/rets4r/client/parsers/response_parser.rb +100 -0
- data/lib/rets4r/client/requester.rb +143 -0
- data/lib/rets4r/client/transaction.rb +30 -33
- data/lib/rets4r/core_ext/array/extract_options.rb +15 -0
- data/lib/rets4r/core_ext/class/attribute_accessors.rb +58 -0
- data/lib/rets4r/core_ext/hash/keys.rb +46 -0
- data/lib/rets4r/core_ext/hash/slice.rb +39 -0
- data/lib/rets4r/listing_mapper.rb +17 -0
- data/lib/rets4r/listing_service.rb +35 -0
- data/lib/rets4r/loader.rb +8 -0
- data/lib/tasks/annotations.rake +121 -0
- data/lib/tasks/coverage.rake +13 -0
- data/rets4r.gemspec +24 -0
- data/spec/rets4r_compact_data_parser_spec.rb +7 -0
- data/test/data/1.5/bad_compact.xml +7 -0
- data/test/data/1.5/count_only_compact.xml +3 -0
- data/test/{client/data → data}/1.5/error.xml +0 -0
- data/test/{client/data → data}/1.5/invalid_compact.xml +0 -0
- data/test/{client/data → data}/1.5/login.xml +0 -0
- data/test/data/1.5/metadata.xml +0 -0
- data/test/{client/data → data}/1.5/search_compact.xml +0 -0
- data/test/data/1.5/search_compact_big.xml +136 -0
- data/test/{client/data → data}/1.5/search_unescaped_compact.xml +0 -0
- data/test/data/listing_service.yml +36 -0
- data/test/test_auth.rb +68 -0
- data/test/test_client.rb +342 -0
- data/test/test_client_links.rb +39 -0
- data/test/test_compact_nokogiri.rb +64 -0
- data/test/test_helper.rb +12 -0
- data/test/test_listing_mapper.rb +112 -0
- data/test/test_loader.rb +24 -0
- data/test/test_parser.rb +96 -0
- data/test/test_quality.rb +57 -0
- metadata +168 -53
- data/GPL +0 -340
- data/examples/metadata.xml +0 -42
- data/lib/rets4r/client/metadataindex.rb +0 -82
- data/lib/rets4r/client/parser.rb +0 -141
- data/lib/rets4r/client/parser/rexml.rb +0 -75
- data/lib/rets4r/client/parser/xmlparser.rb +0 -95
- data/test/client/parser/tc_rexml.rb +0 -17
- data/test/client/parser/tc_xmlparser.rb +0 -21
- data/test/client/tc_auth.rb +0 -68
- data/test/client/tc_client.rb +0 -320
- data/test/client/tc_metadataindex.rb +0 -36
- data/test/client/test_parser.rb +0 -128
- data/test/client/ts_all.rb +0 -8
- data/test/ts_all.rb +0 -1
- data/test/ts_client.rb +0 -1
data/CONTRIBUTORS
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
-
|
1
|
+
Scott Patterson <scott.patterson@digitalaun.com>
|
2
2
|
|
3
|
-
|
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 @@
|
|
1
|
+
gemspec
|
data/LICENSE
CHANGED
@@ -5,3 +5,25 @@ This program is copyrighted free software by Scott Patterson. You can
|
|
5
5
|
redistribute it and/or modify it under the same terms of Ruby's license;
|
6
6
|
either the dual license version in 2003 (see the file RUBYS), or any later
|
7
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,63 @@
|
|
1
|
+
.document
|
2
|
+
.gemtest
|
3
|
+
CHANGELOG
|
4
|
+
CONTRIBUTORS
|
5
|
+
Gemfile
|
6
|
+
LICENSE
|
7
|
+
MANIFEST
|
8
|
+
NEWS
|
9
|
+
README.rdoc
|
10
|
+
RUBYS
|
11
|
+
Rakefile
|
12
|
+
TODO
|
13
|
+
examples/client_get_object.rb
|
14
|
+
examples/client_login.rb
|
15
|
+
examples/client_mapper.rb
|
16
|
+
examples/client_metadata.rb
|
17
|
+
examples/client_parser.rb
|
18
|
+
examples/client_search.rb
|
19
|
+
examples/settings.yml
|
20
|
+
lib/rets4r.rb
|
21
|
+
lib/rets4r/auth.rb
|
22
|
+
lib/rets4r/client.rb
|
23
|
+
lib/rets4r/client/data.rb
|
24
|
+
lib/rets4r/client/dataobject.rb
|
25
|
+
lib/rets4r/client/exceptions.rb
|
26
|
+
lib/rets4r/client/links.rb
|
27
|
+
lib/rets4r/client/metadata.rb
|
28
|
+
lib/rets4r/client/parsers/compact.rb
|
29
|
+
lib/rets4r/client/parsers/compact_nokogiri.rb
|
30
|
+
lib/rets4r/client/parsers/metadata.rb
|
31
|
+
lib/rets4r/client/parsers/response_parser.rb
|
32
|
+
lib/rets4r/client/requester.rb
|
33
|
+
lib/rets4r/client/transaction.rb
|
34
|
+
lib/rets4r/core_ext/array/extract_options.rb
|
35
|
+
lib/rets4r/core_ext/class/attribute_accessors.rb
|
36
|
+
lib/rets4r/core_ext/hash/keys.rb
|
37
|
+
lib/rets4r/core_ext/hash/slice.rb
|
38
|
+
lib/rets4r/listing_mapper.rb
|
39
|
+
lib/rets4r/listing_service.rb
|
40
|
+
lib/rets4r/loader.rb
|
41
|
+
lib/tasks/annotations.rake
|
42
|
+
lib/tasks/coverage.rake
|
43
|
+
rets4r.gemspec
|
44
|
+
spec/rets4r_compact_data_parser_spec.rb
|
45
|
+
test/data/1.5/bad_compact.xml
|
46
|
+
test/data/1.5/count_only_compact.xml
|
47
|
+
test/data/1.5/error.xml
|
48
|
+
test/data/1.5/invalid_compact.xml
|
49
|
+
test/data/1.5/login.xml
|
50
|
+
test/data/1.5/metadata.xml
|
51
|
+
test/data/1.5/search_compact.xml
|
52
|
+
test/data/1.5/search_compact_big.xml
|
53
|
+
test/data/1.5/search_unescaped_compact.xml
|
54
|
+
test/data/listing_service.yml
|
55
|
+
test/test_auth.rb
|
56
|
+
test/test_client.rb
|
57
|
+
test/test_client_links.rb
|
58
|
+
test/test_compact_nokogiri.rb
|
59
|
+
test/test_helper.rb
|
60
|
+
test/test_listing_mapper.rb
|
61
|
+
test/test_loader.rb
|
62
|
+
test/test_parser.rb
|
63
|
+
test/test_quality.rb
|
data/NEWS
ADDED
@@ -0,0 +1,203 @@
|
|
1
|
+
1.1.18
|
2
|
+
New Features
|
3
|
+
* Support multiple environments in examples
|
4
|
+
* Use streaming XML (SAX) parser by default
|
5
|
+
* Support case insensitive headers in DataObjects
|
6
|
+
* Support location parameter in Get Object requests
|
7
|
+
* Add a mapper example
|
8
|
+
* Support rubygems-test
|
9
|
+
* Send a meaningful user agent of rets4r/n.n.n
|
10
|
+
* Raise meaningful exceptions when the service responds with an error
|
11
|
+
|
12
|
+
Bug Fixes
|
13
|
+
* Ignore nil keys and values when creating query strings
|
14
|
+
* Remove broken RETS Session ID header support
|
15
|
+
* Fix nokogiri dependency
|
16
|
+
* Remove broken multi-thread support
|
17
|
+
|
18
|
+
1.1.17
|
19
|
+
New features
|
20
|
+
* RETS4R::Client::ResponseParser#parse_results: works with COMPACT-DECODED
|
21
|
+
* RETS4R::Client::CompactDataParser#parse_results: works without a
|
22
|
+
delimiter in response
|
23
|
+
* RETS4R::Client::CompactDataParser#parse_data: works without column names
|
24
|
+
in response
|
25
|
+
* RETS4R::Client::CompactNokogiriParser: yields data as it is read
|
26
|
+
* RETS4R::ListingMapper: added
|
27
|
+
|
28
|
+
Bug fixes
|
29
|
+
* RETS4R::Client#get_object: checks content-type
|
30
|
+
* RETS4R::Client::ResponseParser: no longer writes a temp file
|
31
|
+
|
32
|
+
Internal API changes
|
33
|
+
* RETS4R::Client::MetadataIndex: removed
|
34
|
+
|
35
|
+
1.1.16
|
36
|
+
Internal API changes
|
37
|
+
* RETS4R::Loader::load: parse from io, not file name
|
38
|
+
|
39
|
+
1.1.15
|
40
|
+
Bug fixes
|
41
|
+
* RETS4R::Client::CompactNokogiriParser: now parses long lines
|
42
|
+
|
43
|
+
1.1.14
|
44
|
+
New features
|
45
|
+
* RETS4R::Loader: added
|
46
|
+
* RETS4R::Client::CompactNokogiriParser: added
|
47
|
+
|
48
|
+
Other changes
|
49
|
+
* Examples use demo RETS server
|
50
|
+
* New parser example
|
51
|
+
|
52
|
+
1.1.13
|
53
|
+
Use gemcutter (Joseph Holsten)
|
54
|
+
|
55
|
+
* Rakefile: include GemcutterTasks
|
56
|
+
|
57
|
+
Fix rdoc reference (Joseph Holsten)
|
58
|
+
|
59
|
+
* README: renamed to README.rdoc
|
60
|
+
* Rakefile: likewise
|
61
|
+
* rets4r.gemspec: likewise
|
62
|
+
* CONTRIBUTORS: added Joseph Holsten
|
63
|
+
|
64
|
+
1.1.12
|
65
|
+
Merge example settings into a config file (Joseph Holsten)
|
66
|
+
Clean up testing (Joseph Holsten)
|
67
|
+
|
68
|
+
1.1.11
|
69
|
+
Merge many rets4r forks (Joseph Holsten)
|
70
|
+
|
71
|
+
1.1.10
|
72
|
+
ResponseParser#parse_common: should be _not_ equals (Jacob Basham)
|
73
|
+
|
74
|
+
1.1.9
|
75
|
+
(no change)
|
76
|
+
|
77
|
+
1.1.8
|
78
|
+
Client, ResponseParser#parse_common: Parser cleanup (Jacob Basham)
|
79
|
+
|
80
|
+
1.1.7
|
81
|
+
Client, Client#initialize, Client#create_query_string, Client#request:
|
82
|
+
Cleaned up files to be 80 skinny, added CGI escaping of data (Jacob Basham)
|
83
|
+
|
84
|
+
1.1.5
|
85
|
+
gemspec: fix date error (Jacob Basham)
|
86
|
+
|
87
|
+
1.1.3
|
88
|
+
gemspec: update (Jacob Basham)
|
89
|
+
|
90
|
+
1.1.2
|
91
|
+
ResponseParser#parse_key_value: Accept CARETS response (John Wulff)
|
92
|
+
|
93
|
+
1.1.1
|
94
|
+
ResponseParser#parse_key_value: Handle nils (John Wulff)
|
95
|
+
|
96
|
+
1.1.0
|
97
|
+
Strip key value pairs for CAPABILITY_LIST endpoints (John Wulff)
|
98
|
+
Add lib/rets4r to default load path (John Wulff)
|
99
|
+
|
100
|
+
1.0.0
|
101
|
+
See changes in 9f7ff731250abc1f73b21cb01d3a6fc3a6617e73 (John Wulff)
|
102
|
+
|
103
|
+
Parser#parse_compact_line: simplify split.
|
104
|
+
Parser#parse_data: remove legacy support.
|
105
|
+
Auth::authenticate: handle missing www-authenticate header.
|
106
|
+
Auth::parse_header: strip keys, values.
|
107
|
+
Client#initialize: method signature changed, removed options, added format.
|
108
|
+
Client#set_parser_class, Client#get_parser_class,
|
109
|
+
Client#parser_class, Client#parser_class=, Client#set_output,
|
110
|
+
Client#get_output, Client#output, Client#output=: removed, callers changed.
|
111
|
+
Lay groundwork for non-compact format requests
|
112
|
+
Client::DEFAULT_METHOD: changed to GET
|
113
|
+
Client::DEFAULT_USER_AGENT: changed to Firefox
|
114
|
+
Client#login: handle absolute uris
|
115
|
+
Client#parse: Removed. Changed callers to access parser directly.
|
116
|
+
Client#get_metadata: method signature changed, format removed. Use format instance variable.
|
117
|
+
Client#download_metadata: added
|
118
|
+
Client#get_object: handle text/xml responses
|
119
|
+
!!! Client#get_object: remove quote support from multipart boundary handling
|
120
|
+
Client#count: added
|
121
|
+
Client#basic_encode: added
|
122
|
+
!!! Client#create_query_string: Remove escaping on request query keys, values
|
123
|
+
Client#debug: removed, all calls inlined.
|
124
|
+
Client#RETSTransactionException: added
|
125
|
+
|
126
|
+
|
127
|
+
client/parsers/
|
128
|
+
|
129
|
+
|
130
|
+
0.8.5
|
131
|
+
Parser#parse_compact_line now once again ignores beginning and ending delimiters. (Scott Patterson)
|
132
|
+
Parser#parse_data now ignores header fields that are nil or blank when stripped. (Scott Patterson)
|
133
|
+
Updated test to use the rets client version of the client, not hardcoded for post and get tests. (Scott Patterson)
|
134
|
+
|
135
|
+
0.8.4
|
136
|
+
Fixed auth issue with authenticate headers with spaces after commas. (Ken Wiesner, Scott Patterson)
|
137
|
+
When an exception is raised in the authentication parsing code, complain by raising
|
138
|
+
a new exception, but also report anything of interest at the same time: request,
|
139
|
+
response, response's body. (François Beausoleil)
|
140
|
+
Fixed Client#request to actually respect the specified request method instead of always using GET requests. (Scott Patterson)
|
141
|
+
Set default request method to POST since some RETS servers seem to have trouble with GET requests. (Scott Patterson)
|
142
|
+
|
143
|
+
0.8.3
|
144
|
+
Added example #set_pre_request_block. (François Beausoleil)
|
145
|
+
Allow a pre request block to be set for RETS4R::Client.
|
146
|
+
This allows the caller to change the request in any meaningful way, such as adding a
|
147
|
+
RETS-UA-Authorization header when appropriate. (François Beausoleil)
|
148
|
+
Better response handling of HTTP errors. Response codes > 300 other than 401 now raise an
|
149
|
+
HTTPError exception that encapsulates the HTTPResponse object.
|
150
|
+
401 errors raise a LoginError exception. (Scott Patterson)
|
151
|
+
Added in RETS specification error messages to reference. (Scott Patterson)
|
152
|
+
New Rakefile. Install the rake gem and do 'rake test' to run the tests. (François Beausoleil)
|
153
|
+
|
154
|
+
0.8.2
|
155
|
+
Added missing result parameter to Client#search's yield (Scott Patterson)
|
156
|
+
Added 1.7 to supported list and default version (François Beausoleil)
|
157
|
+
No longer sends empty (nil) headers (François Beausoleil)
|
158
|
+
Added debugging to HTTP output. (François Beausoleil, Scott Patterson)
|
159
|
+
Added support for multiple set-cookie headers in the server response (François Beausoleil)
|
160
|
+
Added basic search example (Scott Patterson)
|
161
|
+
Implied default value of \t in RETS4R::Client::Transaction#delimiter (François Beausoleil)
|
162
|
+
#get_metadata now returns the block's value or the results. (François Beausoleil)
|
163
|
+
Made sure #login always calls #logout if called with a block. #login returns the block's value
|
164
|
+
instead of results. (François Beausoleil)
|
165
|
+
New assertions that require Client to have Ruby-like accessors for attributes, instead of
|
166
|
+
getters and setters. Applied 'Rename Attribute' on @parser, because #get_parser_class
|
167
|
+
was returning the class of the parser's class, instead of the parser's class itself. (François Beausoleil)
|
168
|
+
Client#set_rets_version should take care to generate the correct RETS-Version header,
|
169
|
+
and #get_rets_version should undo the changes that #set_rets_version did before
|
170
|
+
returning the value. (François Beausoleil)
|
171
|
+
Don't rescue an exception that's not being processed in Parser. (François Beausoleil)
|
172
|
+
RETS4R::Client#get_object extensions: yield or return the array of DataObject instances;
|
173
|
+
changed the multipart/parallel response boundary processing rules
|
174
|
+
(include \r\n in the boundary detection); added documentation. (François Beausoleil)
|
175
|
+
Added GetObject example (Scott Patterson)
|
176
|
+
Changed #get_object now yields each DataObject if a block is given rather
|
177
|
+
than an array of DataObjects (Scott Patterson)
|
178
|
+
|
179
|
+
0.8.1
|
180
|
+
Added Action-URL support per the specification.
|
181
|
+
Added a secondary_response accessor to the Transaction object, which is what the Action-URL result is stored in.
|
182
|
+
Fixed a bug with loggers and parsers
|
183
|
+
|
184
|
+
0.8.0
|
185
|
+
Fixed RParser support, which now means you can use REXML.
|
186
|
+
RParser now retries XML that produced a parser error after trying to clean it.
|
187
|
+
Parser support is now more open so that more parsers can be easily added in the future.
|
188
|
+
Reorganized parser file layout.
|
189
|
+
CParser will only be loaded if libxml (its dependency) is present. If it is, it is the default
|
190
|
+
parser.
|
191
|
+
Added more parser unit tests.
|
192
|
+
Renamed CParser to XMLParser and RPARSER to REXML, both with the hierarchy RETS4R::Client::Module.
|
193
|
+
Fixed a bug with the parser output not being set properly.
|
194
|
+
Fixed a bug with the parser not respecting the DELIMITER value and insisting on tab delimiters.
|
195
|
+
Added support for using a logger
|
196
|
+
Added more defaults to the search options (Count => '0', Format => 'COMPACT')
|
197
|
+
Added some Rubyisms (blocks can now be given to #new, #login, #get_metadata, #get_object, and #search)
|
198
|
+
|
199
|
+
0.7.1
|
200
|
+
Added support for reading the results count for searches.
|
201
|
+
|
202
|
+
0.7.0
|
203
|
+
Initial GEM Version
|
data/{README → README.rdoc}
RENAMED
@@ -11,10 +11,14 @@ While this is the only "native" Ruby RETS library currently available
|
|
11
11
|
bindings available from the Center for Realtor� Technology
|
12
12
|
(http://www.crt.realtors.org/projects/rets/librets/).
|
13
13
|
|
14
|
+
== Links
|
15
|
+
|
16
|
+
* Source: http://github.com/josephholsten/rets4r
|
17
|
+
* Documentation: http://rdoc.info/projects/josephholsten/rets4r
|
18
|
+
|
14
19
|
== Requirements
|
15
20
|
|
16
|
-
* Ruby 1.8.4
|
17
|
-
* XML::Parser (Optional. If not present, REXML will be used.)
|
21
|
+
* Ruby 1.8.4
|
18
22
|
|
19
23
|
== License
|
20
24
|
|
@@ -22,7 +26,7 @@ Please see the LICENSE file.
|
|
22
26
|
|
23
27
|
== Acknowledgments
|
24
28
|
|
25
|
-
This project was made possible by the Contra Costa Association of
|
29
|
+
This project was made possible in part by the Contra Costa Association of
|
26
30
|
Realtors� (http://www.ccartoday.com).
|
27
31
|
|
28
32
|
== Getting Started
|
@@ -33,4 +37,7 @@ objects, rather than making real transaction calls.
|
|
33
37
|
|
34
38
|
Due to the nature of this library, it is HIGHLY recommended that you
|
35
39
|
have at least a basic understanding of the RETS protocol. The official
|
36
|
-
RETS website is http://www.rets.org.
|
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
CHANGED
@@ -11,8 +11,8 @@ You can redistribute it and/or modify it under either the terms of the GPL
|
|
11
11
|
|
12
12
|
a) place your modifications in the Public Domain or otherwise
|
13
13
|
make them Freely Available, such as by posting said
|
14
|
-
|
15
|
-
|
14
|
+
modifications to Usenet or an equivalent medium, or by allowing
|
15
|
+
the author to include your modifications in the software.
|
16
16
|
|
17
17
|
b) use the modified software only within your corporation or
|
18
18
|
organization.
|
@@ -26,11 +26,11 @@ You can redistribute it and/or modify it under either the terms of the GPL
|
|
26
26
|
provided that you do at least ONE of the following:
|
27
27
|
|
28
28
|
a) distribute the binaries and library files of the software,
|
29
|
-
|
30
|
-
|
29
|
+
together with instructions (in the manual page or equivalent)
|
30
|
+
on where to get the original distribution.
|
31
31
|
|
32
32
|
b) accompany the distribution with the machine-readable source of
|
33
|
-
|
33
|
+
the software.
|
34
34
|
|
35
35
|
c) give non-standard binaries non-standard names, with
|
36
36
|
instructions on where to get the original software distribution.
|
@@ -44,9 +44,9 @@ You can redistribute it and/or modify it under either the terms of the GPL
|
|
44
44
|
For the list of those files and their copying conditions, see the
|
45
45
|
file LEGAL.
|
46
46
|
|
47
|
-
5. The scripts and library files supplied as input to or produced as
|
47
|
+
5. The scripts and library files supplied as input to or produced as
|
48
48
|
output from the software do not automatically fall under the
|
49
|
-
copyright of the software, but belong to whomever generated them,
|
49
|
+
copyright of the software, but belong to whomever generated them,
|
50
50
|
and may be sold commercially, and may be aggregated with this
|
51
51
|
software.
|
52
52
|
|
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler/setup'
|
3
|
+
require 'rake'
|
4
|
+
require 'rake/clean'
|
5
|
+
require 'fileutils'
|
6
|
+
include FileUtils
|
7
|
+
|
8
|
+
# impart all tasks in lib/tasks/
|
9
|
+
Dir['lib/tasks/*.rake'].each { |task| import task }
|
10
|
+
|
11
|
+
require 'rake/testtask'
|
12
|
+
Rake::TestTask.new(:test) do |test|
|
13
|
+
test.verbose = true
|
14
|
+
end
|
15
|
+
|
16
|
+
task :default => :test
|
17
|
+
|
18
|
+
require 'rake/rdoctask'
|
19
|
+
Rake::RDocTask.new do |rdoc|
|
20
|
+
if File.exist?('VERSION.yml')
|
21
|
+
config = YAML.load(File.read('VERSION.yml'))
|
22
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
23
|
+
else
|
24
|
+
version = ""
|
25
|
+
end
|
26
|
+
|
27
|
+
rdoc.rdoc_dir = 'rdoc'
|
28
|
+
rdoc.title = "rets4r #{version}"
|
29
|
+
rdoc.options << '--line-numbers' << '--inline-source'
|
30
|
+
rdoc.rdoc_files.include('README.rdoc')
|
31
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
32
|
+
end
|
33
|
+
CLEAN << 'rdoc'
|
34
|
+
|
35
|
+
file 'MANIFEST.tmp' do
|
36
|
+
sh %{find . -type f | sed 's/\\.\\///' | grep -v '.git' | sort > MANIFEST.tmp}
|
37
|
+
end
|
38
|
+
CLEAN << 'MANIFEST.tmp'
|
39
|
+
|
40
|
+
desc "Check the manifest against current files"
|
41
|
+
task :check_manifest => [:clean, 'MANIFEST', 'MANIFEST.tmp'] do
|
42
|
+
puts `diff -du MANIFEST MANIFEST.tmp`
|
43
|
+
end
|
44
|
+
|
45
|
+
CLEAN << '.rake_tasks'
|
46
|
+
|
47
|
+
Bundler::GemHelper.install_tasks
|
48
|
+
CLEAN << 'pkg/*'
|
data/TODO
CHANGED
@@ -9,6 +9,8 @@ Add
|
|
9
9
|
* More Documentation
|
10
10
|
* Reply Codes (Readable Meaning)
|
11
11
|
* A search convenience method that makes subsequent requests if maxrows is true.
|
12
|
+
* Extend examples so they are useful replacements for SimpleRETS
|
13
|
+
* Shared configuration between examples
|
12
14
|
|
13
15
|
Verify
|
14
16
|
* 1.7 Compliance and support
|
@@ -23,4 +25,6 @@ Possible To-do Items
|
|
23
25
|
* Update Actions
|
24
26
|
* Password Change Transaction
|
25
27
|
* Get Transaction
|
26
|
-
* HTTPS Support
|
28
|
+
* HTTPS Support
|
29
|
+
* Simple mapping to ActiveRecord
|
30
|
+
* add metric_fu
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#!/usr/bin/ruby
|
1
|
+
#!/usr/bin/env ruby
|
2
2
|
#
|
3
3
|
# This is an example of how to use the RETS client to retrieve an objet.
|
4
4
|
#
|
@@ -7,14 +7,11 @@
|
|
7
7
|
#############################################################################################
|
8
8
|
# Settings
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
resource = 'Property'
|
16
|
-
object_type = 'Photo'
|
17
|
-
resource_id = 'id:*'
|
10
|
+
require 'yaml'
|
11
|
+
require 'active_support/core_ext/hash'
|
12
|
+
settings_file = File.expand_path(File.join(File.dirname(__FILE__), "settings.yml"))
|
13
|
+
env = ENV['LISTING_ENV'] || 'development'
|
14
|
+
settings = YAML.load_file(settings_file)[env].symbolize_keys
|
18
15
|
|
19
16
|
#############################################################################################
|
20
17
|
$:.unshift 'lib'
|
@@ -23,38 +20,30 @@ require 'rets4r'
|
|
23
20
|
require 'logger'
|
24
21
|
|
25
22
|
def handle_object(object)
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
23
|
+
case object.info['Content-Type']
|
24
|
+
when 'image/jpeg' then extension = 'jpg'
|
25
|
+
when 'image/gif' then extension = 'gif'
|
26
|
+
when 'image/png' then extension = 'png'
|
27
|
+
else extension = 'unknown'
|
28
|
+
end
|
29
|
+
|
30
|
+
File.open("#{object.info['Content-ID']}_#{object.info['Object-ID']}.#{extension}", 'w') do |f|
|
31
|
+
f.write(object.data)
|
32
|
+
end
|
36
33
|
end
|
37
34
|
|
38
|
-
client = RETS4R::Client.new(
|
39
|
-
|
40
|
-
client.login(username, password) do |login_result|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
results.each do |object|
|
54
|
-
handle_object(object)
|
55
|
-
end
|
56
|
-
else
|
57
|
-
puts "We were unable to log into the RETS server."
|
58
|
-
puts "Please check that you have set the login variables correctly."
|
59
|
-
end
|
60
|
-
end
|
35
|
+
client = RETS4R::Client.new(settings[:url])
|
36
|
+
|
37
|
+
client.login(settings[:username], settings[:password]) do |login_result|
|
38
|
+
|
39
|
+
if login_result.success?
|
40
|
+
## Method 1
|
41
|
+
# Get objects using a block
|
42
|
+
client.get_object(settings[:resource], settings[:object_type], settings[:resource_id] + ':0:*') do |object|
|
43
|
+
handle_object(object)
|
44
|
+
end
|
45
|
+
else
|
46
|
+
puts "We were unable to log into the RETS server."
|
47
|
+
puts "Please check that you have set the login variables correctly."
|
48
|
+
end
|
49
|
+
end
|