wrest 1.0.0-universal-java-1.6 → 1.0.1-universal-java-1.6

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/CHANGELOG CHANGED
@@ -9,7 +9,7 @@ Features under a numbered section are complete and available in the Wrest gem.
9
9
  * Multi-part post support on curl
10
10
 
11
11
  == In progress
12
- * 304/ETag response caching
12
+ * 304/ETag response caching
13
13
  * Keep-alive support for libcurl
14
14
  * Explicit cookie helpers - #cookie=, #cookie?
15
15
  * Response code checkers: ok?, redirect?, created? etc.
@@ -17,13 +17,19 @@ Features under a numbered section are complete and available in the Wrest gem.
17
17
  * Ensure Components::Container is ActiveModel compliant
18
18
 
19
19
  == Current
20
+ * GH#61 Option propogate while converting uri to UriTemplate and back.
21
+ * GH#64 Removed Caching.
22
+ * GH#32 Callback for response status codes.
23
+
24
+ == 1.0.0
20
25
  * GH#56 Detailed Net::HTTP debug output option added to Wrest::Native:Request.
21
26
  * GH#60 Wrest debug log arrow direction changed to be consistent with Net::HTPP debug log
22
27
  * GH#59 follow_redirects_limit is off by one
23
28
  * GH#24 Add support for xpath based filtering of xml response bodies to the response chain
24
29
  * GH#46 Response.deserialise for Json responses
25
30
  * GH#52 Wrest console (bin/wrest) fails on 1.9.2
26
-
31
+ * GH#55 Fix connection.verify_mode for Net::HTTP https connection to VERIFY_PEER
32
+ * GH#57 Feature #24 doesn't autoload correctly
27
33
  == 1.0.0.beta7
28
34
  * GH#46 Response.deserialise for Json responses
29
35
 
data/README.rdoc CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  Wrest is a ruby REST/HTTP client library which
6
6
 
7
- * Allows allows you to quickly build object oriented wrappers around any web service
7
+ * Allows you to quickly build object oriented wrappers around any web service
8
8
  * Designed to be used as a library, not just a command line REST client (fewer class/static methods, more object oriented)
9
9
  * Is spec driven, strongly favours immutable objects and avoids class methods and setters making it better suited for use as a library, especially in multi-threaded environments
10
10
  * Runs on Ruby 1.8, Ruby 1.9.2, JRuby and Rubinius with MacRuby and IronRuby support on the way
@@ -101,6 +101,20 @@ To find out what actions are permitted on a URI:
101
101
 
102
102
  'http://www.yahoo.com'.to_uri.options.headers['allow']
103
103
 
104
+ ==== Callbacks
105
+
106
+ You can define a Hash of {response code -> action} to be executed after a request is completed.
107
+
108
+ logger=Logger.new("wrest_callbacks.log")
109
+
110
+ actions = { 200 => lambda {|response| logger.info "Ok." },
111
+ 400..499 => lambda {|response| logger.error "Invalid. #{response.body}"},
112
+ 300..302 => lambda {|response| logger.debug "Redirected. #{response.message}" }
113
+ }
114
+
115
+ "http://google.com".to_uri(:callback => actions).get
116
+
117
+ Please note that Wrest is a synchronous library. All requests are blocking, and will not return till the request is completed and appropriate callbacks executed.
104
118
 
105
119
  === Other useful stuff
106
120
 
@@ -0,0 +1,78 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 23
13
+ 5
14
+ 45
15
+ 0
16
+ 1
17
+ 65
18
+ 49
19
+ 2
20
+ 0
21
+ 49
22
+ 3
23
+ 1
24
+ 7
25
+ 4
26
+ 64
27
+ 81
28
+ 5
29
+ 47
30
+ 49
31
+ 6
32
+ 1
33
+ 15
34
+ 2
35
+ 11
36
+ I
37
+ 3
38
+ I
39
+ 0
40
+ I
41
+ 0
42
+ I
43
+ 0
44
+ n
45
+ p
46
+ 7
47
+ x
48
+ 4
49
+ File
50
+ n
51
+ x
52
+ 11
53
+ active_path
54
+ x
55
+ 7
56
+ dirname
57
+ s
58
+ 15
59
+ /wrest_shell.rb
60
+ x
61
+ 1
62
+ +
63
+ x
64
+ 4
65
+ load
66
+ p
67
+ 3
68
+ I
69
+ 0
70
+ I
71
+ 3
72
+ I
73
+ 17
74
+ x
75
+ 31
76
+ /home/jasim/C42/wrest/bin/wrest
77
+ p
78
+ 0
@@ -0,0 +1,659 @@
1
+ !RBIX
2
+ 0
3
+ x
4
+ M
5
+ 1
6
+ n
7
+ n
8
+ x
9
+ 10
10
+ __script__
11
+ i
12
+ 245
13
+ 5
14
+ 7
15
+ 0
16
+ 45
17
+ 1
18
+ 2
19
+ 47
20
+ 49
21
+ 3
22
+ 0
23
+ 7
24
+ 4
25
+ 45
26
+ 5
27
+ 6
28
+ 47
29
+ 49
30
+ 3
31
+ 0
32
+ 7
33
+ 4
34
+ 45
35
+ 7
36
+ 8
37
+ 47
38
+ 49
39
+ 3
40
+ 0
41
+ 63
42
+ 6
43
+ 47
44
+ 49
45
+ 9
46
+ 1
47
+ 15
48
+ 45
49
+ 10
50
+ 11
51
+ 45
52
+ 10
53
+ 12
54
+ 65
55
+ 49
56
+ 13
57
+ 0
58
+ 49
59
+ 14
60
+ 1
61
+ 47
62
+ 49
63
+ 3
64
+ 0
65
+ 7
66
+ 15
67
+ 63
68
+ 2
69
+ 49
70
+ 16
71
+ 1
72
+ 19
73
+ 0
74
+ 15
75
+ 45
76
+ 10
77
+ 17
78
+ 45
79
+ 10
80
+ 18
81
+ 65
82
+ 49
83
+ 13
84
+ 0
85
+ 49
86
+ 14
87
+ 1
88
+ 47
89
+ 49
90
+ 3
91
+ 0
92
+ 7
93
+ 19
94
+ 63
95
+ 2
96
+ 49
97
+ 16
98
+ 1
99
+ 19
100
+ 1
101
+ 15
102
+ 45
103
+ 7
104
+ 20
105
+ 7
106
+ 21
107
+ 13
108
+ 70
109
+ 9
110
+ 110
111
+ 15
112
+ 44
113
+ 43
114
+ 22
115
+ 7
116
+ 23
117
+ 78
118
+ 49
119
+ 24
120
+ 2
121
+ 6
122
+ 21
123
+ 49
124
+ 25
125
+ 1
126
+ 9
127
+ 120
128
+ 7
129
+ 26
130
+ 64
131
+ 8
132
+ 123
133
+ 7
134
+ 27
135
+ 64
136
+ 19
137
+ 2
138
+ 15
139
+ 5
140
+ 7
141
+ 28
142
+ 64
143
+ 47
144
+ 49
145
+ 29
146
+ 1
147
+ 15
148
+ 44
149
+ 43
150
+ 30
151
+ 79
152
+ 49
153
+ 31
154
+ 1
155
+ 13
156
+ 7
157
+ 32
158
+ 20
159
+ 2
160
+ 49
161
+ 33
162
+ 2
163
+ 15
164
+ 19
165
+ 3
166
+ 15
167
+ 45
168
+ 34
169
+ 35
170
+ 56
171
+ 36
172
+ 50
173
+ 24
174
+ 0
175
+ 15
176
+ 7
177
+ 37
178
+ 64
179
+ 19
180
+ 4
181
+ 15
182
+ 20
183
+ 4
184
+ 7
185
+ 38
186
+ 20
187
+ 0
188
+ 47
189
+ 49
190
+ 3
191
+ 0
192
+ 63
193
+ 2
194
+ 49
195
+ 39
196
+ 1
197
+ 15
198
+ 5
199
+ 20
200
+ 1
201
+ 47
202
+ 49
203
+ 29
204
+ 1
205
+ 15
206
+ 5
207
+ 7
208
+ 40
209
+ 45
210
+ 41
211
+ 42
212
+ 43
213
+ 43
214
+ 43
215
+ 44
216
+ 47
217
+ 49
218
+ 3
219
+ 0
220
+ 63
221
+ 2
222
+ 47
223
+ 49
224
+ 9
225
+ 1
226
+ 15
227
+ 5
228
+ 20
229
+ 3
230
+ 7
231
+ 32
232
+ 49
233
+ 45
234
+ 1
235
+ 47
236
+ 49
237
+ 3
238
+ 0
239
+ 7
240
+ 46
241
+ 20
242
+ 4
243
+ 47
244
+ 49
245
+ 3
246
+ 0
247
+ 7
248
+ 47
249
+ 63
250
+ 4
251
+ 47
252
+ 49
253
+ 48
254
+ 1
255
+ 15
256
+ 2
257
+ 11
258
+ I
259
+ c
260
+ I
261
+ 5
262
+ I
263
+ 0
264
+ I
265
+ 0
266
+ n
267
+ p
268
+ 49
269
+ s
270
+ 5
271
+ Ruby
272
+ x
273
+ 12
274
+ RUBY_VERSION
275
+ n
276
+ x
277
+ 4
278
+ to_s
279
+ s
280
+ 2
281
+ ,
282
+ x
283
+ 17
284
+ RUBY_RELEASE_DATE
285
+ n
286
+ x
287
+ 13
288
+ RUBY_PLATFORM
289
+ n
290
+ x
291
+ 4
292
+ puts
293
+ x
294
+ 4
295
+ File
296
+ n
297
+ n
298
+ x
299
+ 11
300
+ active_path
301
+ x
302
+ 7
303
+ dirname
304
+ s
305
+ 16
306
+ /../lib/wrest.rb
307
+ x
308
+ 11
309
+ expand_path
310
+ n
311
+ n
312
+ s
313
+ 24
314
+ /../lib/wrest/version.rb
315
+ n
316
+ n
317
+ x
318
+ 6
319
+ Regexp
320
+ s
321
+ 15
322
+ (:?mswin|mingw)
323
+ x
324
+ 3
325
+ new
326
+ x
327
+ 2
328
+ =~
329
+ s
330
+ 7
331
+ irb.bat
332
+ s
333
+ 3
334
+ irb
335
+ s
336
+ 8
337
+ optparse
338
+ x
339
+ 7
340
+ require
341
+ x
342
+ 4
343
+ Hash
344
+ x
345
+ 16
346
+ new_from_literal
347
+ x
348
+ 3
349
+ irb
350
+ x
351
+ 3
352
+ []=
353
+ x
354
+ 12
355
+ OptionParser
356
+ n
357
+ M
358
+ 1
359
+ p
360
+ 2
361
+ x
362
+ 9
363
+ for_block
364
+ t
365
+ n
366
+ x
367
+ 9
368
+ __block__
369
+ i
370
+ 50
371
+ 57
372
+ 19
373
+ 0
374
+ 15
375
+ 20
376
+ 0
377
+ 7
378
+ 0
379
+ 64
380
+ 13
381
+ 18
382
+ 2
383
+ 49
384
+ 1
385
+ 1
386
+ 15
387
+ 15
388
+ 20
389
+ 0
390
+ 7
391
+ 2
392
+ 21
393
+ 1
394
+ 2
395
+ 47
396
+ 49
397
+ 3
398
+ 0
399
+ 7
400
+ 4
401
+ 63
402
+ 3
403
+ 7
404
+ 5
405
+ 64
406
+ 56
407
+ 6
408
+ 50
409
+ 7
410
+ 2
411
+ 15
412
+ 20
413
+ 0
414
+ 45
415
+ 8
416
+ 9
417
+ 49
418
+ 10
419
+ 1
420
+ 11
421
+ I
422
+ 6
423
+ I
424
+ 1
425
+ I
426
+ 1
427
+ I
428
+ 1
429
+ n
430
+ p
431
+ 11
432
+ s
433
+ 24
434
+ Usage: console [options]
435
+ x
436
+ 7
437
+ banner=
438
+ s
439
+ 7
440
+ --irb=[
441
+ x
442
+ 4
443
+ to_s
444
+ s
445
+ 1
446
+ ]
447
+ s
448
+ 23
449
+ Invoke a different irb.
450
+ M
451
+ 1
452
+ p
453
+ 2
454
+ x
455
+ 9
456
+ for_block
457
+ t
458
+ n
459
+ x
460
+ 9
461
+ __block__
462
+ i
463
+ 19
464
+ 57
465
+ 19
466
+ 0
467
+ 15
468
+ 21
469
+ 2
470
+ 3
471
+ 7
472
+ 0
473
+ 20
474
+ 0
475
+ 13
476
+ 18
477
+ 3
478
+ 49
479
+ 1
480
+ 2
481
+ 15
482
+ 11
483
+ I
484
+ 6
485
+ I
486
+ 1
487
+ I
488
+ 1
489
+ I
490
+ 1
491
+ n
492
+ p
493
+ 2
494
+ x
495
+ 3
496
+ irb
497
+ x
498
+ 3
499
+ []=
500
+ p
501
+ 3
502
+ I
503
+ 0
504
+ I
505
+ c
506
+ I
507
+ 13
508
+ x
509
+ 40
510
+ /home/jasim/C42/wrest/bin/wrest_shell.rb
511
+ p
512
+ 1
513
+ x
514
+ 1
515
+ v
516
+ x
517
+ 2
518
+ on
519
+ x
520
+ 4
521
+ ARGV
522
+ n
523
+ x
524
+ 6
525
+ parse!
526
+ p
527
+ 9
528
+ I
529
+ 0
530
+ I
531
+ a
532
+ I
533
+ 4
534
+ I
535
+ b
536
+ I
537
+ 11
538
+ I
539
+ c
540
+ I
541
+ 29
542
+ I
543
+ d
544
+ I
545
+ 32
546
+ x
547
+ 40
548
+ /home/jasim/C42/wrest/bin/wrest_shell.rb
549
+ p
550
+ 1
551
+ x
552
+ 3
553
+ opt
554
+ s
555
+ 18
556
+ -r irb/completion
557
+ s
558
+ 4
559
+ -r
560
+ x
561
+ 2
562
+ <<
563
+ s
564
+ 14
565
+ Loading Wrest
566
+ x
567
+ 5
568
+ Wrest
569
+ n
570
+ x
571
+ 7
572
+ VERSION
573
+ x
574
+ 6
575
+ STRING
576
+ x
577
+ 2
578
+ []
579
+ s
580
+ 1
581
+
582
+ s
583
+ 16
584
+ --simple-prompt
585
+ x
586
+ 4
587
+ exec
588
+ p
589
+ 25
590
+ I
591
+ 0
592
+ I
593
+ 1
594
+ I
595
+ 23
596
+ I
597
+ 3
598
+ I
599
+ 3e
600
+ I
601
+ 4
602
+ I
603
+ 59
604
+ I
605
+ 6
606
+ I
607
+ 7e
608
+ I
609
+ 8
610
+ I
611
+ 87
612
+ I
613
+ 9
614
+ I
615
+ 9a
616
+ I
617
+ a
618
+ I
619
+ a3
620
+ I
621
+ 10
622
+ I
623
+ a9
624
+ I
625
+ 11
626
+ I
627
+ b9
628
+ I
629
+ 13
630
+ I
631
+ c1
632
+ I
633
+ 14
634
+ I
635
+ d6
636
+ I
637
+ 15
638
+ I
639
+ f5
640
+ x
641
+ 40
642
+ /home/jasim/C42/wrest/bin/wrest_shell.rb
643
+ p
644
+ 5
645
+ x
646
+ 11
647
+ entry_point
648
+ x
649
+ 7
650
+ version
651
+ x
652
+ 3
653
+ irb
654
+ x
655
+ 7
656
+ options
657
+ x
658
+ 4
659
+ libs
@@ -38,6 +38,7 @@ module Wrest
38
38
  self.each{|tuple| mutated_hash.store(*mutator.mutate(tuple))}
39
39
  mutated_hash
40
40
  end
41
+
41
42
  end
42
43
  end
43
44
  end
@@ -9,14 +9,14 @@
9
9
 
10
10
  module Wrest::Native
11
11
  module ConnectionFactory
12
- def create_connection(options = {:timeout => 60, :verify_mode => 'VERIFY_PEER'})
12
+ def create_connection(options = {:timeout => 60, :verify_mode => OpenSSL::SSL::VERIFY_NONE})
13
13
  options[:timeout] ||= 60
14
14
  connection = Net::HTTP.new(self.host, self.port)
15
15
  connection.read_timeout = options[:timeout]
16
16
  if self.https?
17
17
  connection.use_ssl = true
18
- connection.verify_mode = OpenSSL::SSL::VERIFY_PEER
19
- connection.verify_mode = OpenSSL::SSL::VERIFY_NONE if options[:verify_mode] == 'VERIFY_NONE'
18
+ connection.verify_mode = options[:verify_mode]? options[:verify_mode] : OpenSSL::SSL::VERIFY_PEER
19
+
20
20
  end
21
21
  connection
22
22
  end
@@ -21,30 +21,5 @@ module Wrest::Native
21
21
  options
22
22
  )
23
23
  end
24
-
25
- def invoke_with_cache_check
26
- cached_response = get_cached_response
27
- if cached_response.nil? then
28
- response = invoke_without_cache_check
29
- cache_response(response) if !response.nil? && response.cacheable?
30
- response
31
- else
32
- cached_response
33
- end
34
- end
35
-
36
- def get_cached_response
37
- response = nil
38
- if cache_store.has_key?(@uri)
39
- response = cache_store.fetch(@uri)
40
- end
41
- response
42
- end
43
-
44
- def cache_response(response)
45
- cache_store[@uri] = response
46
- end
47
-
48
- alias_method_chain :invoke, :cache_check
49
24
  end
50
25
  end
@@ -31,8 +31,12 @@ module Wrest::Native
31
31
  # in the event of a connection failing to open. Defaulted to 60 by Uri#create_connection.
32
32
  # :connection => The HTTP Connection object to use. This is how a keep-alive connection can be
33
33
  # used for multiple requests.
34
- # :cache_store => The object which should be used as cache store for cacheable responses
34
+ # :verify_mode => The verification mode to be used for Net::HTTP https connections. Defaults to OpenSSL::SSL::VERIFY_PEER
35
+ # :cache_store => The object which should be used as cache store for cacheable responses (caching is not supported in this version)
35
36
  # :detailed_http_logging => nil/$stdout/$stderr or File/Logger/IO object. Defaults to nil (recommended).
37
+ # :callback => A Hash whose keys are the response codes (or Range of response codes),
38
+ # and the values are the callback functions to be executed.
39
+ # eg: { <response code> => lambda { |response| some_operation } }
36
40
  #
37
41
  # *WARNING* : detailed_http_logging causes serious security hole. Never use it in production code.
38
42
  #
@@ -51,10 +55,14 @@ module Wrest::Native
51
55
  @connection = @options[:connection]
52
56
  @http_request = self.build_request(http_request_klass, @uri, @parameters, @headers)
53
57
  @cache_store = options[:cache_store]
58
+ @verify_mode = @options[:verify_mode]
54
59
  @detailed_http_logging = options[:detailed_http_logging]
60
+ @callback = key_ranges_to_array(@options[:callback] || {})
55
61
  end
56
62
 
57
- # Makes a request and returns a Wrest::Native::Response.
63
+ # Makes a request, runs the appropriate callback if any and
64
+ # returns a Wrest::Native::Response.
65
+ #
58
66
  # Data about the request is and logged to Wrest.logger
59
67
  # The log entry contains the following information:
60
68
  #
@@ -62,7 +70,7 @@ module Wrest::Native
62
70
  # <-- indicates a response
63
71
  #
64
72
  # The type of request is mentioned in caps, followed by a hash
65
- # uniquely uniquely identifying a particular request/response pair.
73
+ # uniquely identifying a particular request/response pair.
66
74
  # In a multi-process or multi-threaded scenario, this can be used
67
75
  # to identify request-response pairs.
68
76
  #
@@ -73,10 +81,8 @@ module Wrest::Native
73
81
  # This is followed by the response code, the payload size and the time taken.
74
82
  def invoke
75
83
  response = nil
76
-
77
- @connection ||= @uri.create_connection({:timeout => timeout})
84
+ @connection ||= @uri.create_connection({:timeout => timeout, :verify_mode => @verify_mode})
78
85
  @connection.set_debug_output @detailed_http_logging
79
-
80
86
  http_request.basic_auth username, password unless username.nil? || password.nil?
81
87
 
82
88
  prefix = "#{http_request.method} #{http_request.hash} #{@connection.hash}"
@@ -85,6 +91,8 @@ module Wrest::Native
85
91
  time = Benchmark.realtime { response = Wrest::Native::Response.new( do_request ) }
86
92
  Wrest.logger.debug "-> (#{prefix}) %d %s (%d bytes %.2fs)" % [response.code, response.message, response.body ? response.body.length : 0, time]
87
93
 
94
+ execute_callback_if_any(response)
95
+
88
96
  @follow_redirects ? response.follow(@options) : response
89
97
  rescue Timeout::Error => e
90
98
  raise Wrest::Exceptions::Timeout.new(e)
@@ -101,5 +109,41 @@ module Wrest::Native
101
109
  def do_request
102
110
  @connection.request(@http_request, @body)
103
111
  end
112
+
113
+ private
114
+
115
+ def execute_callback_if_any(actual_response)
116
+ @callback.each do |callback_response_range, action|
117
+ action.call(actual_response) if callback_response_range.include?(actual_response.code.to_i)
118
+ end
119
+ end
120
+
121
+ # Returns a new Hash with all the keys converted into an Array.
122
+ # Keys who are of type Range are expanded, existing Arrays are kept as such.
123
+ #
124
+ # Use case:
125
+ # Converts Wrest#Uri callback array from
126
+ # { 200 => lambda { xyz }, 500..502 => lambda { abc } }
127
+ # into
128
+ # { [200] => lambda { xyz }, [500, 501, 502] => lambda { abc } }
129
+ #
130
+ def key_ranges_to_array(callback_hash)
131
+ result = {}
132
+
133
+ callback_hash.each do |key, value|
134
+ new_key =
135
+ if key.is_a?(Range)
136
+ key.to_a
137
+ elsif key.is_a?(Array)
138
+ key
139
+ else
140
+ [key]
141
+ end
142
+
143
+ result[new_key] = value
144
+ end
145
+
146
+ result
147
+ end
104
148
  end
105
149
  end
data/lib/wrest/uri.rb CHANGED
@@ -22,7 +22,7 @@ module Wrest #:nodoc:
22
22
  #
23
23
  # You can find examples that use real APIs (like delicious) under the wrest/examples directory.
24
24
  class Uri
25
- attr_reader :uri, :username, :password, :uri_string, :uri_path, :query
25
+ attr_reader :uri, :username, :password, :uri_string, :uri_path, :query
26
26
 
27
27
  # See Wrest::Native::Request for the available options and their default values.
28
28
  def initialize(uri_string, options = {})
@@ -39,7 +39,7 @@ module Wrest #:nodoc:
39
39
 
40
40
  def to_template(pattern)
41
41
  template_pattern = URI.join(uri_string,pattern).to_s
42
- UriTemplate.new(template_pattern)
42
+ UriTemplate.new(template_pattern, @options)
43
43
  end
44
44
 
45
45
  # Build a new Wrest::Uri by appending _path_ to
@@ -10,8 +10,9 @@
10
10
  module Wrest
11
11
  class UriTemplate
12
12
  attr_reader :uri_pattern
13
- def initialize(uri_pattern)
13
+ def initialize(uri_pattern, options = {})
14
14
  @uri_pattern = uri_pattern.clone
15
+ @options = options.clone
15
16
  end
16
17
 
17
18
  # Builds a new Wrest::Uri from this uri template
@@ -29,7 +30,6 @@ module Wrest
29
30
  #
30
31
  # Note that beacuse because both HTTP Auth and UriTemplate
31
32
  # use ':' as a delimiter, the pattern does look slightly weird, but it still works.
32
- #
33
33
  # Example:
34
34
  # template = UriTemplate.new("http://:username::password@coathangers.com/:resource/:id.:format")
35
35
  # template.to_uri(
@@ -40,10 +40,11 @@ module Wrest
40
40
  # )
41
41
  # => #<Wrest::Uri:0x18e0bec @uri=#<URI::HTTP:0x18e09a8 URL:http://kaiwren:fupuppies@coathangers.com/portal/1>>
42
42
  def to_uri(options = {})
43
- Wrest::Uri.new(options.inject(uri_pattern.clone) do |uri_string, tuple|
43
+ merged_options = @options.merge(options)
44
+ Wrest::Uri.new(merged_options.inject(uri_pattern.clone) do |uri_string, tuple|
44
45
  key, value = tuple
45
46
  uri_string.gsub(":#{key.to_s}", value.to_s)
46
- end)
47
+ end , @options)
47
48
  end
48
49
 
49
50
  def [](path)
data/lib/wrest/version.rb CHANGED
@@ -12,7 +12,7 @@ module Wrest
12
12
  unless defined? MAJOR
13
13
  MAJOR = 1
14
14
  MINOR = 0
15
- TINY = 0
15
+ TINY = 1
16
16
  BUILD = nil
17
17
 
18
18
  STRING = [MAJOR, MINOR, TINY, BUILD].compact.join('.')
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 0
8
- - 0
9
- version: 1.0.0
8
+ - 1
9
+ version: 1.0.1
10
10
  platform: universal-java-1.6
11
11
  authors:
12
12
  - Sidu Ponnappa
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-24 00:00:00 +05:30
18
+ date: 2011-01-04 00:00:00 +05:30
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -102,7 +102,9 @@ extensions: []
102
102
  extra_rdoc_files:
103
103
  - README.rdoc
104
104
  files:
105
+ - bin/wrest.compiled.rbc
105
106
  - bin/wrest_shell.rb
107
+ - bin/wrest_shell.rbc
106
108
  - bin/wrest
107
109
  - lib/wrest_no_ext.rb
108
110
  - lib/wrest.rb