restr 0.5.0 → 0.5.2
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/History.txt +8 -0
- data/Manifest.txt +0 -3
- data/config/hoe.rb +2 -1
- data/lib/restr.rb +12 -11
- metadata +3 -6
- data/.loadpath +0 -5
- data/.project +0 -17
- data/log/debug.log +0 -0
data/History.txt
CHANGED
@@ -1,3 +1,11 @@
|
|
1
|
+
== 0.5.2 :: 2009-03-18
|
2
|
+
|
3
|
+
* Use xml_in instead of xml_in_string to process XML.
|
4
|
+
|
5
|
+
== 0.5.1 :: 2009-01-30
|
6
|
+
|
7
|
+
* Fixed error in the way the request_timeout value was being set.
|
8
|
+
|
1
9
|
== 0.5.0 :: 2009-01-07
|
2
10
|
|
3
11
|
* A logger can be provided on a per-call basis, rather than just for the
|
data/Manifest.txt
CHANGED
data/config/hoe.rb
CHANGED
@@ -30,6 +30,7 @@ ENV['NODOT'] = '1'
|
|
30
30
|
REV = nil
|
31
31
|
# UNCOMMENT IF REQUIRED:
|
32
32
|
#REV = `svn info`.each {|line| if line =~ /^Revision:/ then k,v = line.split(': '); break v.chomp; else next; end} rescue nil
|
33
|
+
#REV = Time.now.strftime('%Y%m%d')
|
33
34
|
VERS = Restr::VERSION::STRING + (REV ? ".#{REV}" : "")
|
34
35
|
RDOC_OPTS = ['--quiet', '--title', 'restr documentation',
|
35
36
|
"--opname", "index.html",
|
@@ -67,4 +68,4 @@ end
|
|
67
68
|
CHANGES = hoe.paragraphs_of('History.txt', 0..1).join("\\n\\n")
|
68
69
|
PATH = (RUBYFORGE_PROJECT == GEM_NAME) ? RUBYFORGE_PROJECT : "#{RUBYFORGE_PROJECT}/#{GEM_NAME}"
|
69
70
|
hoe.remote_rdoc_dir = File.join(PATH.gsub(/^#{RUBYFORGE_PROJECT}\/?/,''), 'rdoc')
|
70
|
-
hoe.rsync_args = '-av --delete --ignore-errors'
|
71
|
+
hoe.rsync_args = '-av --delete --ignore-errors'
|
data/lib/restr.rb
CHANGED
@@ -74,14 +74,14 @@ class Restr
|
|
74
74
|
module VERSION #:nodoc:
|
75
75
|
MAJOR = 0
|
76
76
|
MINOR = 5
|
77
|
-
TINY =
|
77
|
+
TINY = 2
|
78
78
|
|
79
79
|
STRING = [MAJOR, MINOR, TINY].join('.')
|
80
80
|
end
|
81
81
|
|
82
82
|
|
83
83
|
@@logger = nil
|
84
|
-
@@request_timeout =
|
84
|
+
@@request_timeout = 180
|
85
85
|
|
86
86
|
cattr_accessor :request_timeout
|
87
87
|
|
@@ -100,10 +100,10 @@ class Restr
|
|
100
100
|
end
|
101
101
|
|
102
102
|
def self.do(method, url, params = {}, options = {})
|
103
|
-
puts "METHOD: #{method.inspect}"
|
104
|
-
puts "URL: #{url.inspect}"
|
105
|
-
puts "PARAMS: #{params.inspect}"
|
106
|
-
puts "OPTIONS: #{options.inspect}"
|
103
|
+
#puts "METHOD: #{method.inspect}"
|
104
|
+
#puts "URL: #{url.inspect}"
|
105
|
+
#puts "PARAMS: #{params.inspect}"
|
106
|
+
#puts "OPTIONS: #{options.inspect}"
|
107
107
|
|
108
108
|
uri = URI.parse(url)
|
109
109
|
|
@@ -138,8 +138,9 @@ class Restr
|
|
138
138
|
req.set_form_data(params, '&')
|
139
139
|
end
|
140
140
|
|
141
|
-
logger.debug("Sending #{method.inspect} request to #{url.inspect}
|
142
|
-
(
|
141
|
+
logger.debug("Sending #{method.inspect} request to #{url.inspect} "+
|
142
|
+
(method.to_s == 'get' ? "params" : "data")+" #{params.inspect}"+
|
143
|
+
(options.blank? ? "" : " with options #{options.inspect}}")+".") if logger
|
143
144
|
|
144
145
|
client = Net::HTTP.new(uri.host, uri.port)
|
145
146
|
client.use_ssl = (uri.scheme == 'https')
|
@@ -159,7 +160,7 @@ class Restr
|
|
159
160
|
when Net::HTTPSuccess
|
160
161
|
if res.content_type =~ /[\/+]xml$/
|
161
162
|
logger.debug("Got XML response: \n#{res.body}") if logger
|
162
|
-
return XmlSimple.
|
163
|
+
return XmlSimple.xml_in(res.body,
|
163
164
|
'forcearray' => false,
|
164
165
|
'keeproot' => false
|
165
166
|
)
|
@@ -169,7 +170,7 @@ class Restr
|
|
169
170
|
end
|
170
171
|
when TimeoutError
|
171
172
|
logger.debug(res) if logger
|
172
|
-
return XmlSimple.
|
173
|
+
return XmlSimple.xml_in(res,
|
173
174
|
'forcearray' => false,
|
174
175
|
'keeproot' => false
|
175
176
|
)
|
@@ -183,4 +184,4 @@ class Restr
|
|
183
184
|
|
184
185
|
class InvalidRequestMethod < Exception
|
185
186
|
end
|
186
|
-
end
|
187
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Zukowski
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-03-18 00:00:00 -04:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ">="
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 1.8.
|
23
|
+
version: 1.8.0
|
24
24
|
version:
|
25
25
|
description: A very simple REST client.
|
26
26
|
email:
|
@@ -36,8 +36,6 @@ extra_rdoc_files:
|
|
36
36
|
- README.txt
|
37
37
|
- website/index.txt
|
38
38
|
files:
|
39
|
-
- .loadpath
|
40
|
-
- .project
|
41
39
|
- History.txt
|
42
40
|
- License.txt
|
43
41
|
- Manifest.txt
|
@@ -46,7 +44,6 @@ files:
|
|
46
44
|
- config/hoe.rb
|
47
45
|
- config/requirements.rb
|
48
46
|
- lib/restr.rb
|
49
|
-
- log/debug.log
|
50
47
|
- script/destroy
|
51
48
|
- script/generate
|
52
49
|
- script/txt2html
|
data/.loadpath
DELETED
data/.project
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<projectDescription>
|
3
|
-
<name>restr</name>
|
4
|
-
<comment></comment>
|
5
|
-
<projects>
|
6
|
-
</projects>
|
7
|
-
<buildSpec>
|
8
|
-
<buildCommand>
|
9
|
-
<name>org.rubypeople.rdt.core.rubybuilder</name>
|
10
|
-
<arguments>
|
11
|
-
</arguments>
|
12
|
-
</buildCommand>
|
13
|
-
</buildSpec>
|
14
|
-
<natures>
|
15
|
-
<nature>org.rubypeople.rdt.core.rubynature</nature>
|
16
|
-
</natures>
|
17
|
-
</projectDescription>
|
data/log/debug.log
DELETED
File without changes
|