rets 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +4 -0
- data/lib/rets/authentication.rb +3 -5
- data/lib/rets/client.rb +7 -1
- data/lib/rets.rb +1 -1
- data/test/test_client.rb +2 -2
- metadata +8 -8
data/CHANGELOG.md
CHANGED
data/lib/rets/authentication.rb
CHANGED
@@ -43,16 +43,14 @@ module Rets
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
def calculate_user_agent_digest(
|
47
|
-
product, _ = user_agent.split("/")
|
48
|
-
|
46
|
+
def calculate_user_agent_digest(product, user_agent_password, rets_request_id, session_id, version)
|
49
47
|
a1 = Digest::MD5.hexdigest "#{product}:#{user_agent_password}"
|
50
48
|
|
51
|
-
Digest::MD5.hexdigest "#{a1}
|
49
|
+
Digest::MD5.hexdigest "#{a1}:#{rets_request_id}:#{session_id}:#{version}"
|
52
50
|
end
|
53
51
|
|
54
52
|
def build_user_agent_auth(*args)
|
55
|
-
%Q(Digest
|
53
|
+
%Q(Digest #{calculate_user_agent_digest(*args)})
|
56
54
|
end
|
57
55
|
|
58
56
|
end
|
data/lib/rets/client.rb
CHANGED
@@ -351,6 +351,12 @@ module Rets
|
|
351
351
|
@cookies.map{ |k,v| "#{k}=#{v}" }.join("; ")
|
352
352
|
end
|
353
353
|
|
354
|
+
def cookie(name)
|
355
|
+
return if @cookies.nil? or @cookies.empty?
|
356
|
+
|
357
|
+
@cookies[name]
|
358
|
+
end
|
359
|
+
|
354
360
|
|
355
361
|
def session=(session)
|
356
362
|
self.authorization = session.authorization
|
@@ -440,7 +446,7 @@ module Rets
|
|
440
446
|
if options[:ua_password]
|
441
447
|
headers.merge!(
|
442
448
|
"RETS-UA-Authorization" => build_user_agent_auth(
|
443
|
-
user_agent, options[:ua_password],
|
449
|
+
user_agent, options[:ua_password], '', cookie('RETS-Session-ID'), rets_version))
|
444
450
|
end
|
445
451
|
|
446
452
|
headers
|
data/lib/rets.rb
CHANGED
data/test/test_client.rb
CHANGED
@@ -331,7 +331,7 @@ DIGEST
|
|
331
331
|
Digest::MD5.expects(:hexdigest).with("a1::session:version").returns("hash")
|
332
332
|
|
333
333
|
assert_equal "hash",
|
334
|
-
@client.calculate_user_agent_digest("agent", "secret", "session", "version")
|
334
|
+
@client.calculate_user_agent_digest("agent", "secret", '', "session", "version")
|
335
335
|
end
|
336
336
|
|
337
337
|
|
@@ -437,7 +437,7 @@ DIGEST
|
|
437
437
|
@client.find(:all, :foo => :bar)
|
438
438
|
end
|
439
439
|
|
440
|
-
def
|
440
|
+
def test_find_eventually_reraises_errors
|
441
441
|
@client.stubs(:find_every).raises(Rets::AuthorizationFailure)
|
442
442
|
assert_raise Rets::AuthorizationFailure do
|
443
443
|
@client.find(:all, :foo => :bar)
|
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:
|
4
|
+
hash: 23
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Estately, Inc. Open Source
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2012-03
|
19
|
+
date: 2012-04-03 00:00:00 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: net-http-persistent
|
@@ -88,11 +88,11 @@ dependencies:
|
|
88
88
|
requirements:
|
89
89
|
- - ~>
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
hash:
|
91
|
+
hash: 25
|
92
92
|
segments:
|
93
93
|
- 2
|
94
|
-
-
|
95
|
-
version: "2.
|
94
|
+
- 13
|
95
|
+
version: "2.13"
|
96
96
|
type: :development
|
97
97
|
version_requirements: *id005
|
98
98
|
description: |-
|
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
163
|
requirements: []
|
164
164
|
|
165
165
|
rubyforge_project: rets
|
166
|
-
rubygems_version: 1.8.
|
166
|
+
rubygems_version: 1.8.15
|
167
167
|
signing_key:
|
168
168
|
specification_version: 3
|
169
169
|
summary: A pure-ruby library for fetching data from [RETS] servers
|