rets 0.1.7 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +5 -1
- data/README.md +1 -0
- data/Rakefile +3 -3
- data/lib/rets.rb +1 -1
- data/lib/rets/client.rb +7 -7
- data/lib/rets/metadata/root.rb +5 -1
- data/lib/rets/metadata/table.rb +5 -5
- data/test/test_metadata.rb +1 -1
- metadata +27 -28
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -2,15 +2,15 @@ require 'rubygems'
|
|
2
2
|
require 'hoe'
|
3
3
|
|
4
4
|
Hoe.plugin :git, :doofus
|
5
|
+
Hoe.plugin :travis
|
5
6
|
|
6
7
|
Hoe.spec 'rets' do
|
7
8
|
developer 'Estately, Inc. Open Source', 'opensource@estately.com'
|
8
|
-
developer 'Ben Bleything', 'ben@bleything.net'
|
9
9
|
|
10
10
|
extra_deps << [ "net-http-persistent", "~> 1.7" ]
|
11
|
-
extra_deps << [ "nokogiri", "~> 1.
|
11
|
+
extra_deps << [ "nokogiri", "~> 1.5.2" ]
|
12
12
|
|
13
|
-
extra_dev_deps << [ "mocha", "~> 0.
|
13
|
+
extra_dev_deps << [ "mocha", "~> 0.11.0" ]
|
14
14
|
|
15
15
|
### Use markdown for changelog and readme
|
16
16
|
self.history_file = 'CHANGELOG.md'
|
data/lib/rets.rb
CHANGED
data/lib/rets/client.rb
CHANGED
@@ -160,7 +160,7 @@ module Rets
|
|
160
160
|
content_type = response["content-type"]
|
161
161
|
|
162
162
|
if content_type.include?("multipart")
|
163
|
-
boundary = content_type.scan(/boundary="?([^;"]*)?/).
|
163
|
+
boundary = content_type.scan(/boundary="?([^;"]*)?/).join
|
164
164
|
|
165
165
|
parts = Parser::Multipart.parse(response.body, boundary)
|
166
166
|
|
@@ -336,7 +336,7 @@ module Rets
|
|
336
336
|
def cookies=(cookies)
|
337
337
|
@cookies ||= {}
|
338
338
|
|
339
|
-
cookies.each do |cookie|
|
339
|
+
Array(cookies).each do |cookie|
|
340
340
|
cookie.match(/(\S+)=([^;]+);?/)
|
341
341
|
|
342
342
|
@cookies[$1] = $2
|
@@ -385,7 +385,7 @@ module Rets
|
|
385
385
|
|
386
386
|
begin
|
387
387
|
capability_uri = URI.parse(url)
|
388
|
-
rescue URI::InvalidURIError
|
388
|
+
rescue URI::InvalidURIError
|
389
389
|
raise MalformedResponse, "Unable to parse capability URL: #{url.inspect}"
|
390
390
|
end
|
391
391
|
|
@@ -395,15 +395,15 @@ module Rets
|
|
395
395
|
def extract_capabilities(document)
|
396
396
|
raw_key_values = document.xpath("/RETS/RETS-RESPONSE").text.strip
|
397
397
|
|
398
|
-
|
398
|
+
hash = Hash.new{|h,k| h.key?(k.downcase) ? h[k.downcase] : nil }
|
399
399
|
|
400
400
|
# ... :(
|
401
401
|
# Feel free to make this better. It has a test.
|
402
402
|
raw_key_values.split(/\n/).
|
403
403
|
map { |r| r.split(/=/, 2) }.
|
404
|
-
each { |k,v|
|
404
|
+
each { |k,v| hash[k.strip.downcase] = v.strip }
|
405
405
|
|
406
|
-
|
406
|
+
hash
|
407
407
|
end
|
408
408
|
|
409
409
|
|
@@ -503,7 +503,7 @@ module Rets
|
|
503
503
|
end
|
504
504
|
end
|
505
505
|
|
506
|
-
rescue Nokogiri::XML::SyntaxError
|
506
|
+
rescue Nokogiri::XML::SyntaxError
|
507
507
|
#Not xml
|
508
508
|
end
|
509
509
|
end
|
data/lib/rets/metadata/root.rb
CHANGED
@@ -147,7 +147,11 @@ module Rets
|
|
147
147
|
class_name = type.capitalize.gsub(/_(\w)/) { $1.upcase }
|
148
148
|
container_name = "#{class_name}Container"
|
149
149
|
|
150
|
-
|
150
|
+
if ::RUBY_VERSION < '1.9'
|
151
|
+
container_class = Containers.const_defined?(container_name) ? Containers.const_get(container_name) : Containers::Container
|
152
|
+
else
|
153
|
+
container_class = Containers.const_defined?(container_name, true) ? Containers.const_get(container_name, true) : Containers::Container
|
154
|
+
end
|
151
155
|
container_class.new(fragment)
|
152
156
|
end
|
153
157
|
end
|
data/lib/rets/metadata/table.rb
CHANGED
@@ -81,21 +81,21 @@ module Rets
|
|
81
81
|
|
82
82
|
values = multi? ? value.split(","): [value]
|
83
83
|
|
84
|
-
values = values.map do |
|
84
|
+
values = values.map do |v|
|
85
85
|
|
86
86
|
#Remove surrounding quotes
|
87
|
-
|
87
|
+
clean_value = v.scan(/^["']?(.*?)["']?$/).join
|
88
88
|
|
89
|
-
lookup_type = lookup_type(
|
89
|
+
lookup_type = lookup_type(clean_value)
|
90
90
|
|
91
91
|
resolved_value = lookup_type ? lookup_type.long_value : nil
|
92
92
|
|
93
|
-
warn("Discarding unmappable value of #{
|
93
|
+
warn("Discarding unmappable value of #{clean_value.inspect}") if resolved_value.nil? && $VERBOSE
|
94
94
|
|
95
95
|
resolved_value
|
96
96
|
end
|
97
97
|
|
98
|
-
multi? ? values.map {|
|
98
|
+
multi? ? values.map {|v| v.to_s.strip } : values.first.to_s.strip
|
99
99
|
end
|
100
100
|
end
|
101
101
|
end
|
data/test/test_metadata.rb
CHANGED
@@ -193,7 +193,7 @@ class TestMetadata < Test::Unit::TestCase
|
|
193
193
|
Rets::Metadata::Resource.expects(:find_rets_classes).with(metadata, resource).returns([rets_class_fragment])
|
194
194
|
|
195
195
|
classes = Rets::Metadata::Resource.build_classes(resource, metadata)
|
196
|
-
|
196
|
+
assert_equal([rets_class], classes)
|
197
197
|
end
|
198
198
|
|
199
199
|
def test_resource_build
|
metadata
CHANGED
@@ -1,22 +1,21 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 2
|
9
|
+
- 0
|
10
|
+
version: 0.2.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Estately, Inc. Open Source
|
14
|
-
- Ben Bleything
|
15
14
|
autorequire:
|
16
15
|
bindir: bin
|
17
16
|
cert_chain: []
|
18
17
|
|
19
|
-
date: 2012-04-
|
18
|
+
date: 2012-04-23 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: net-http-persistent
|
@@ -41,43 +40,43 @@ dependencies:
|
|
41
40
|
requirements:
|
42
41
|
- - ~>
|
43
42
|
- !ruby/object:Gem::Version
|
44
|
-
hash:
|
43
|
+
hash: 7
|
45
44
|
segments:
|
46
45
|
- 1
|
47
|
-
-
|
48
|
-
-
|
49
|
-
version: 1.
|
46
|
+
- 5
|
47
|
+
- 2
|
48
|
+
version: 1.5.2
|
50
49
|
type: :runtime
|
51
50
|
version_requirements: *id002
|
52
51
|
- !ruby/object:Gem::Dependency
|
53
|
-
name:
|
52
|
+
name: rdoc
|
54
53
|
prerelease: false
|
55
54
|
requirement: &id003 !ruby/object:Gem::Requirement
|
56
55
|
none: false
|
57
56
|
requirements:
|
58
57
|
- - ~>
|
59
58
|
- !ruby/object:Gem::Version
|
60
|
-
hash:
|
59
|
+
hash: 19
|
61
60
|
segments:
|
62
|
-
-
|
63
|
-
-
|
64
|
-
|
65
|
-
version: 0.9.12
|
61
|
+
- 3
|
62
|
+
- 10
|
63
|
+
version: "3.10"
|
66
64
|
type: :development
|
67
65
|
version_requirements: *id003
|
68
66
|
- !ruby/object:Gem::Dependency
|
69
|
-
name:
|
67
|
+
name: mocha
|
70
68
|
prerelease: false
|
71
69
|
requirement: &id004 !ruby/object:Gem::Requirement
|
72
70
|
none: false
|
73
71
|
requirements:
|
74
72
|
- - ~>
|
75
73
|
- !ruby/object:Gem::Version
|
76
|
-
hash:
|
74
|
+
hash: 51
|
77
75
|
segments:
|
78
|
-
-
|
79
|
-
-
|
80
|
-
|
76
|
+
- 0
|
77
|
+
- 11
|
78
|
+
- 0
|
79
|
+
version: 0.11.0
|
81
80
|
type: :development
|
82
81
|
version_requirements: *id004
|
83
82
|
- !ruby/object:Gem::Dependency
|
@@ -88,20 +87,20 @@ dependencies:
|
|
88
87
|
requirements:
|
89
88
|
- - ~>
|
90
89
|
- !ruby/object:Gem::Version
|
91
|
-
hash:
|
90
|
+
hash: 7
|
92
91
|
segments:
|
93
|
-
-
|
94
|
-
-
|
95
|
-
version: "
|
92
|
+
- 3
|
93
|
+
- 0
|
94
|
+
version: "3.0"
|
96
95
|
type: :development
|
97
96
|
version_requirements: *id005
|
98
97
|
description: |-
|
98
|
+
[![Build Status](https://secure.travis-ci.org/estately/rets.png?branch=master)](http://travis-ci.org/estately/rets)
|
99
99
|
A pure-ruby library for fetching data from [RETS] servers.
|
100
100
|
|
101
101
|
[RETS]: http://www.rets.org
|
102
102
|
email:
|
103
103
|
- opensource@estately.com
|
104
|
-
- ben@bleything.net
|
105
104
|
executables:
|
106
105
|
- rets
|
107
106
|
extensions: []
|
@@ -163,10 +162,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
162
|
requirements: []
|
164
163
|
|
165
164
|
rubyforge_project: rets
|
166
|
-
rubygems_version: 1.8.
|
165
|
+
rubygems_version: 1.8.23
|
167
166
|
signing_key:
|
168
167
|
specification_version: 3
|
169
|
-
summary: A pure-ruby library for fetching data from [RETS] servers
|
168
|
+
summary: "[![Build Status](https://secure.travis-ci.org/estately/rets.png?branch=master)](http://travis-ci.org/estately/rets) A pure-ruby library for fetching data from [RETS] servers"
|
170
169
|
test_files:
|
171
170
|
- test/test_client.rb
|
172
171
|
- test/test_metadata.rb
|