rets 0.2.0 → 0.2.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.2.1 / 2012-04-20
2
+
3
+ * fix: better handling of malformed RETS responses
4
+
1
5
  ### 0.2.0 / 2012-04-20
2
6
 
3
7
  * feature: Ruby 1.9 compatibility!
data/Rakefile CHANGED
@@ -11,6 +11,8 @@ Hoe.spec 'rets' do
11
11
  extra_deps << [ "nokogiri", "~> 1.5.2" ]
12
12
 
13
13
  extra_dev_deps << [ "mocha", "~> 0.11.0" ]
14
+ extra_dev_deps << [ "vcr", "~> 2.2.2" ]
15
+ extra_dev_deps << [ "webmock", "~> 1.8.0" ]
14
16
 
15
17
  ### Use markdown for changelog and readme
16
18
  self.history_file = 'CHANGELOG.md'
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.2.0'
11
+ VERSION = '0.2.1'
12
12
 
13
13
  AuthorizationFailure = Class.new(ArgumentError)
14
14
  InvalidRequest = Class.new(ArgumentError)
data/lib/rets/client.rb CHANGED
@@ -159,6 +159,10 @@ module Rets
159
159
  def create_parts_from_response(response)
160
160
  content_type = response["content-type"]
161
161
 
162
+ if content_type.nil?
163
+ raise MalformedResponse, "Unable to read content-type from response: #{response.inspect}"
164
+ end
165
+
162
166
  if content_type.include?("multipart")
163
167
  boundary = content_type.scan(/boundary="?([^;"]*)?/).join
164
168
 
data/test/helper.rb CHANGED
@@ -4,3 +4,11 @@ require "mocha"
4
4
  require "rets"
5
5
 
6
6
  require "fixtures"
7
+
8
+ require 'vcr'
9
+
10
+ VCR.configure do |c|
11
+ c.cassette_library_dir = 'test/vcr_cassettes'
12
+ c.hook_into :webmock
13
+ end
14
+
data/test/test_client.rb CHANGED
@@ -521,6 +521,15 @@ DIGEST
521
521
  @client.objects([1,2], :foo => :bar)
522
522
  end
523
523
 
524
+ def test_object_handles_empty_bodies
525
+ @client = Rets::Client.new(:password=>"fake", :agent=>"agent", :login_url=>"http://www.example.com:6103/", :username=>"fake_user")
526
+ assert_raise Rets::MalformedResponse do
527
+ VCR.use_cassette('empty_body') do
528
+ @client.objects([1], :resource => 'Property', :object_type => 'Photo', :resource_id => '480346')
529
+ end
530
+ end
531
+ end
532
+
524
533
  def test_objects_raises_on_other_arguments
525
534
  assert_raise ArgumentError do
526
535
  @client.objects(Object.new, :foo => :bar)
metadata CHANGED
@@ -1,113 +1,107 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: rets
3
- version: !ruby/object:Gem::Version
4
- hash: 23
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.2.1
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Estately, Inc. Open Source
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-04-23 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-06-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: net-http-persistent
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70181484516980 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 1
29
- segments:
30
- - 1
31
- - 7
32
- version: "1.7"
20
+ - !ruby/object:Gem::Version
21
+ version: '1.7'
33
22
  type: :runtime
34
- version_requirements: *id001
35
- - !ruby/object:Gem::Dependency
36
- name: nokogiri
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ version_requirements: *70181484516980
25
+ - !ruby/object:Gem::Dependency
26
+ name: nokogiri
27
+ requirement: &70181484516560 !ruby/object:Gem::Requirement
39
28
  none: false
40
- requirements:
29
+ requirements:
41
30
  - - ~>
42
- - !ruby/object:Gem::Version
43
- hash: 7
44
- segments:
45
- - 1
46
- - 5
47
- - 2
31
+ - !ruby/object:Gem::Version
48
32
  version: 1.5.2
49
33
  type: :runtime
50
- version_requirements: *id002
51
- - !ruby/object:Gem::Dependency
52
- name: rdoc
53
34
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
35
+ version_requirements: *70181484516560
36
+ - !ruby/object:Gem::Dependency
37
+ name: mocha
38
+ requirement: &70181484516140 !ruby/object:Gem::Requirement
55
39
  none: false
56
- requirements:
40
+ requirements:
57
41
  - - ~>
58
- - !ruby/object:Gem::Version
59
- hash: 19
60
- segments:
61
- - 3
62
- - 10
63
- version: "3.10"
42
+ - !ruby/object:Gem::Version
43
+ version: 0.11.0
64
44
  type: :development
65
- version_requirements: *id003
66
- - !ruby/object:Gem::Dependency
67
- name: mocha
68
45
  prerelease: false
69
- requirement: &id004 !ruby/object:Gem::Requirement
46
+ version_requirements: *70181484516140
47
+ - !ruby/object:Gem::Dependency
48
+ name: vcr
49
+ requirement: &70181484515720 !ruby/object:Gem::Requirement
70
50
  none: false
71
- requirements:
51
+ requirements:
72
52
  - - ~>
73
- - !ruby/object:Gem::Version
74
- hash: 51
75
- segments:
76
- - 0
77
- - 11
78
- - 0
79
- version: 0.11.0
53
+ - !ruby/object:Gem::Version
54
+ version: 2.2.2
80
55
  type: :development
81
- version_requirements: *id004
82
- - !ruby/object:Gem::Dependency
83
- name: hoe
84
56
  prerelease: false
85
- requirement: &id005 !ruby/object:Gem::Requirement
57
+ version_requirements: *70181484515720
58
+ - !ruby/object:Gem::Dependency
59
+ name: webmock
60
+ requirement: &70181484515300 !ruby/object:Gem::Requirement
86
61
  none: false
87
- requirements:
62
+ requirements:
88
63
  - - ~>
89
- - !ruby/object:Gem::Version
90
- hash: 7
91
- segments:
92
- - 3
93
- - 0
94
- version: "3.0"
64
+ - !ruby/object:Gem::Version
65
+ version: 1.8.0
95
66
  type: :development
96
- version_requirements: *id005
97
- description: |-
98
- [![Build Status](https://secure.travis-ci.org/estately/rets.png?branch=master)](http://travis-ci.org/estately/rets)
67
+ prerelease: false
68
+ version_requirements: *70181484515300
69
+ - !ruby/object:Gem::Dependency
70
+ name: rdoc
71
+ requirement: &70181484514880 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ version: '3.10'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *70181484514880
80
+ - !ruby/object:Gem::Dependency
81
+ name: hoe
82
+ requirement: &70181484514460 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: '2.13'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *70181484514460
91
+ description: ! '[![Build Status](https://secure.travis-ci.org/estately/rets.png?branch=master)](http://travis-ci.org/estately/rets)
92
+
99
93
  A pure-ruby library for fetching data from [RETS] servers.
100
-
101
- [RETS]: http://www.rets.org
102
- email:
94
+
95
+
96
+ [RETS]: http://www.rets.org'
97
+ email:
103
98
  - opensource@estately.com
104
- executables:
99
+ executables:
105
100
  - rets
106
101
  extensions: []
107
-
108
- extra_rdoc_files:
102
+ extra_rdoc_files:
109
103
  - Manifest.txt
110
- files:
104
+ files:
111
105
  - CHANGELOG.md
112
106
  - Manifest.txt
113
107
  - README.md
@@ -134,39 +128,32 @@ files:
134
128
  - .gemtest
135
129
  homepage: http://github.com/estately/rets
136
130
  licenses: []
137
-
138
131
  post_install_message:
139
- rdoc_options:
132
+ rdoc_options:
140
133
  - --main
141
134
  - README.md
142
- require_paths:
135
+ require_paths:
143
136
  - lib
144
- required_ruby_version: !ruby/object:Gem::Requirement
137
+ required_ruby_version: !ruby/object:Gem::Requirement
145
138
  none: false
146
- requirements:
147
- - - ">="
148
- - !ruby/object:Gem::Version
149
- hash: 3
150
- segments:
151
- - 0
152
- version: "0"
153
- required_rubygems_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
154
144
  none: false
155
- requirements:
156
- - - ">="
157
- - !ruby/object:Gem::Version
158
- hash: 3
159
- segments:
160
- - 0
161
- version: "0"
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
162
149
  requirements: []
163
-
164
150
  rubyforge_project: rets
165
- rubygems_version: 1.8.23
151
+ rubygems_version: 1.8.15
166
152
  signing_key:
167
153
  specification_version: 3
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"
169
- test_files:
154
+ summary: ! '[![Build Status](https://secure.travis-ci.org/estately/rets.png?branch=master)](http://travis-ci.org/estately/rets)
155
+ A pure-ruby library for fetching data from [RETS] servers'
156
+ test_files:
170
157
  - test/test_client.rb
171
158
  - test/test_metadata.rb
172
159
  - test/test_parser_compact.rb