rets 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ### 0.1.1 / 2012-01-11
2
+
3
+ * bugfix - prevent infinite loop in login
4
+
1
5
  # rets Changelog
2
6
 
3
7
  ### 0.1.0 / 2011-06-23
data/lib/rets.rb CHANGED
@@ -8,7 +8,7 @@ require 'net/http/persistent'
8
8
  require 'nokogiri'
9
9
 
10
10
  module Rets
11
- VERSION = '0.1.0'
11
+ VERSION = '0.1.1'
12
12
 
13
13
  AuthorizationFailure = Class.new(ArgumentError)
14
14
  InvalidRequest = Class.new(ArgumentError)
data/lib/rets/client.rb CHANGED
@@ -34,7 +34,8 @@ module Rets
34
34
  # RETS server provides, per http://retsdoc.onconfluence.com/display/rets172/4.10+Capability+URL+List.
35
35
  def login
36
36
  request(uri.path)
37
- capabilities
37
+ raise UnknownResponse, "Cannot read rets server capabilities." unless @capabilities
38
+ @capabilities
38
39
  end
39
40
 
40
41
  # Finds records.
@@ -382,7 +383,7 @@ module Rets
382
383
  # Feel free to make this better. It has a test.
383
384
  raw_key_values.split(/\n/).
384
385
  map { |r| r.split(/=/, 2) }.
385
- each { |k,v| h[k.strip.downcase] = v }
386
+ each { |k,v| h[k.strip.downcase] = v.strip }
386
387
 
387
388
  h
388
389
  end
data/test/fixtures.rb CHANGED
@@ -21,6 +21,14 @@ CAPABILITIES = <<-XML
21
21
  </RETS>
22
22
  XML
23
23
 
24
+ CAPABILITIES_WITH_WHITESPACE = <<XML
25
+ <RETS ReplyCode="0" ReplyText="Operation Successful">
26
+ <RETS-RESPONSE>
27
+ Action = /RETS/Action
28
+ </RETS-RESPONSE>
29
+ </RETS>
30
+ XML
31
+
24
32
  # 44 is the ASCII code for comma; an invalid delimiter.
25
33
  INVALID_DELIMETER = <<-XML
26
34
  <?xml version="1.0"?>
data/test/test_client.rb CHANGED
@@ -181,6 +181,13 @@ class TestClient < Test::Unit::TestCase
181
181
  )
182
182
  end
183
183
 
184
+ def test_extract_capabilities_with_whitespace
185
+ assert_equal(
186
+ {"action" => "/RETS/Action"},
187
+ @client.extract_capabilities(Nokogiri.parse(CAPABILITIES_WITH_WHITESPACE))
188
+ )
189
+ end
190
+
184
191
  def test_capability_url_returns_parsed_url
185
192
  @client.capabilities = { "foo" => "http://example.com" }
186
193
 
@@ -200,6 +207,12 @@ class TestClient < Test::Unit::TestCase
200
207
  @client.capabilities
201
208
  end
202
209
 
210
+ def test_login_fails_if_cannot_read_capabilities
211
+ @client.stubs(:request)
212
+ assert_raise Rets::UnknownResponse do
213
+ @client.login
214
+ end
215
+ end
203
216
 
204
217
  def test_cookies?
205
218
  assert @client.cookies?({"set-cookie" => "FavoriteFruit=Plum;"})
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rets
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Estately, Inc. Open Source
@@ -16,8 +16,7 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-06-23 00:00:00 -07:00
20
- default_executable:
19
+ date: 2012-01-11 00:00:00 Z
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
23
22
  name: net-http-persistent
@@ -67,21 +66,35 @@ dependencies:
67
66
  type: :development
68
67
  version_requirements: *id003
69
68
  - !ruby/object:Gem::Dependency
70
- name: hoe
69
+ name: rdoc
71
70
  prerelease: false
72
71
  requirement: &id004 !ruby/object:Gem::Requirement
73
72
  none: false
74
73
  requirements:
75
- - - ">="
74
+ - - ~>
76
75
  - !ruby/object:Gem::Version
77
- hash: 41
76
+ hash: 19
78
77
  segments:
79
- - 2
80
- - 9
81
- - 1
82
- version: 2.9.1
78
+ - 3
79
+ - 10
80
+ version: "3.10"
83
81
  type: :development
84
82
  version_requirements: *id004
83
+ - !ruby/object:Gem::Dependency
84
+ name: hoe
85
+ prerelease: false
86
+ requirement: &id005 !ruby/object:Gem::Requirement
87
+ none: false
88
+ requirements:
89
+ - - ~>
90
+ - !ruby/object:Gem::Version
91
+ hash: 27
92
+ segments:
93
+ - 2
94
+ - 12
95
+ version: "2.12"
96
+ type: :development
97
+ version_requirements: *id005
85
98
  description: |-
86
99
  A pure-ruby library for fetching data from [RETS] servers.
87
100
 
@@ -120,7 +133,6 @@ files:
120
133
  - test/test_parser_compact.rb
121
134
  - test/test_parser_multipart.rb
122
135
  - .gemtest
123
- has_rdoc: true
124
136
  homepage: http://github.com/estately/rets
125
137
  licenses: []
126
138
 
@@ -151,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
163
  requirements: []
152
164
 
153
165
  rubyforge_project: rets
154
- rubygems_version: 1.4.2
166
+ rubygems_version: 1.8.10
155
167
  signing_key:
156
168
  specification_version: 3
157
169
  summary: A pure-ruby library for fetching data from [RETS] servers