rightmove_wrangler 0.1.13 → 0.1.14
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rightmove_wrangler.rb +6 -5
- data/lib/rightmove_wrangler/version.rb +1 -1
- metadata +1 -1
data/lib/rightmove_wrangler.rb
CHANGED
@@ -87,7 +87,7 @@ module RightmoveWrangler
|
|
87
87
|
end
|
88
88
|
threads.each do |t|
|
89
89
|
t.join
|
90
|
-
$stdout.puts
|
90
|
+
t[:output].each { |s| $stdout.puts s }
|
91
91
|
end
|
92
92
|
rescue Exception => ex
|
93
93
|
$stderr.puts ex.inspect
|
@@ -185,10 +185,11 @@ module RightmoveWrangler
|
|
185
185
|
end
|
186
186
|
|
187
187
|
def post!(payload)
|
188
|
-
Thread.current[:output]
|
188
|
+
Thread.current[:output] ||= []
|
189
|
+
Thread.current[:output] << "Posting the following data: #{payload.inspect}"
|
189
190
|
|
190
191
|
if @options[:url].nil?
|
191
|
-
Thread.current[:output]
|
192
|
+
Thread.current[:output] << "Missing a URL to post the data to"
|
192
193
|
end
|
193
194
|
|
194
195
|
uri = Addressable::URI.parse(@options[:url])
|
@@ -203,10 +204,10 @@ module RightmoveWrangler
|
|
203
204
|
response = conn.post uri.path, params
|
204
205
|
|
205
206
|
if response.status == 200
|
206
|
-
Thread.current[:output]
|
207
|
+
Thread.current[:output] << "Server returned a successful response"
|
207
208
|
return true
|
208
209
|
else
|
209
|
-
Thread.current[:output]
|
210
|
+
Thread.current[:output] << "Non 200 response returned from API: #{response.inspect}"
|
210
211
|
return false
|
211
212
|
end
|
212
213
|
end
|