wrest 2.1.9 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69a30e75377430e134d3be264b50b1e97e823152
4
- data.tar.gz: f721a616192a527d21afa74c0adba3dd3dfd5b41
3
+ metadata.gz: 74d6752f1e1d310a56a31c8b5d412bc33f4c6405
4
+ data.tar.gz: 82875275d48826a8154e481982f6e69ccfd60de2
5
5
  SHA512:
6
- metadata.gz: 94db9fae0c8540e80497fb182b2d8634fbc6fdc8e7fd374fe13931b348244513ffaab8128c76369a92b2fb45bd018cbd7817d6529fc80b4ad5077f085fb47165
7
- data.tar.gz: 1e411d00090ff33e317774678a9072b20689862f3e2879715f4b5d95baea7b90459a52d7a0e00e21a85b9ac9922d55305018dcf83d99c21ca0eca04e2d83a4ce
6
+ metadata.gz: c5c9cbc733ef503e952a52d45db4376fe1513584bccd3fce9c3692f51ebfd2c9dc067026d7c1e42e82cb9664e631f7f336e8b82f2622cc66d034619b1684e7a9
7
+ data.tar.gz: 9a813bde3499e6fbc91e5782c26bf1b6f185ffdd6bcb384db857756b154d8d6757e063a579ba1a70f40bafaf5ede38e8dbaf18acb0ed8c5c5d9aaa9c4ede05c6
data/CHANGELOG CHANGED
@@ -2,6 +2,9 @@ Features under the section marked 'Current' are completed but pending release as
2
2
 
3
3
  Features under a numbered section are complete and available in the Wrest gem.
4
4
 
5
+ == 2.2.0
6
+ * Add support for HTTP PATCH [Aditi Raveesh]
7
+
5
8
  == 2.1.9
6
9
  * Switch to using concurrent-ruby
7
10
 
data/README.md CHANGED
@@ -1,15 +1,14 @@
1
1
  [![Build Status](https://travis-ci.org/c42/wrest.svg?branch=master)](https://travis-ci.org/c42/wrest)
2
2
 
3
- # Wrest 2.1.9
3
+ # Wrest 2.2.0
4
4
 
5
5
  (c) Copyright 2009-2016 [Sidu Ponnappa](http://twitter.com/ponnappa). All Rights Reserved.
6
6
 
7
- Wrest is a ruby REST/HTTP client library which
7
+ Wrest is a ruby REST/HTTP client library. It is currently in use at substantial scale across all Ruby/JRuby systems at [GO-JEK](https://twitter.com/GojekTech).
8
8
 
9
- * Allows you to use Net::HTTP
10
- * Allows you to pick your Ruby: use 2.x.x, JRuby 9.x.x
9
+ * Allows you to pick your Ruby: use CRuby or JRuby
11
10
  * Supports RFC 2616 based [caching](https://github.com/kaiwren/wrest/blob/caching/Caching.markdown)
12
- * Async http calls using Threads (reliable only on JRuby) or EventMachine
11
+ * Async http calls using Threads (truly useful only on JRuby due to [GIL](https://en.wikipedia.org/wiki/Global_interpreter_lock) limitations on CRuby) or EventMachine
13
12
  * Allows you to quickly build object oriented wrappers around any web service
14
13
  * Is designed to be used as a library, not just a command line REST client (fewer class/static methods, more object oriented)
15
14
  * 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
@@ -17,7 +16,7 @@ Wrest is a ruby REST/HTTP client library which
17
16
 
18
17
  To receive notifications whenever new features are added to Wrest, please subscribe to my [twitter feed](http://twitter.com/ponnappa).
19
18
 
20
- ##Examples
19
+ ## Examples
21
20
 
22
21
  For Facebook, Twitter, Delicious, GitHub and other API examples, see http://github.com/c42/wrest/tree/master/examples
23
22
 
@@ -37,7 +36,7 @@ For Facebook, Twitter, Delicious, GitHub and other API examples, see http://gith
37
36
  * Timeout support
38
37
 
39
38
  ```
40
- 'https://api.github.com/repos/c42/wrest/issues'.to_uri.get(timeout: 5).body
39
+ 'https://api.github.com/repos/c42/wrest/issues'.to_uri(timeout: 5).get.body
41
40
  ```
42
41
 
43
42
  * Redirect support
@@ -137,7 +136,7 @@ Wrest supports caching with the following pluggable back-ends:
137
136
  - Memcached
138
137
  - Redis
139
138
 
140
- ####Hash
139
+ #### Hash
141
140
 
142
141
  Use the following method to enable caching for all requests, and set Hash as the default cache store.
143
142
  Note: Hash should NEVER be used in a production environment. It is unbounded and will keep increasing in size.
@@ -153,7 +152,7 @@ To use Hash as a cache store in an explicit request (without setting hash as def
153
152
  r1 = "http://c42.in".to_uri.using_hash.get
154
153
  ```
155
154
 
156
- ####Memcached
155
+ #### Memcached
157
156
 
158
157
  A Memcached based caching back-end is available in Wrest. You can get instructions on how to install Memcached on your system [here](http://code.google.com/p/memcached/wiki/NewInstallFromPackage).
159
158
  The Dalli gem is used by Wrest to interface with Memcached. Install dalli using 'gem install dalli'.
@@ -171,7 +170,7 @@ To use Memcached as a cache store in an explicit request (without setting memcac
171
170
  r2 = "http://c42.in".to_uri.using_memcached.get
172
171
  ```
173
172
 
174
- ####Redis
173
+ #### Redis
175
174
 
176
175
  Wrest also supports a Redis based caching back-end. Follow the guide [here](http://redis.io/topics/quickstart) to install Redis in your system.
177
176
  It uses [redis-rd](https://github.com/redis/redis-rb) to interface with Redis. Install redis-rb using `gem install redis`.
@@ -396,24 +395,31 @@ You can launch the interactive Wrest shell by running bin/wrest if you have the
396
395
 
397
396
  Start the Sinatra test server for functional test. The dependencies for the test app are managed separately by a Gemfile under spec/sample_app.
398
397
 
398
+ To start the sample application:
399
+
399
400
  ```
400
- rake -f spec/sample_app/Rakefile # runs on port 3000
401
+ cd spec/sample_app
402
+ bundle install
403
+ bundle exec rake # runs sample app on port 3000
401
404
  ```
402
405
 
403
- Start a memcached daemon/process on port 11211
406
+ Start a memcached daemon/process on port 11211 and redis on 6379 (both default ports)
404
407
 
405
408
  ```
406
- /usr/local/bin/memcached
409
+ brew install memcached
410
+ brew install redis
411
+ brew services start memcached
412
+ brew services start redis
407
413
  ```
408
414
 
409
415
  Run the tests in a different terminal:
410
416
 
411
417
  ```
412
418
  # Run the normal test suite.
413
- rake
419
+ bundle exec rake
414
420
 
415
421
  # Runs the functional test suite.
416
- rake rspec:functional
422
+ bundle exec rake rspec:functional
417
423
  ```
418
424
 
419
425
  ## Contributors
@@ -24,6 +24,7 @@ require "wrest/native/redirection"
24
24
  require "wrest/native/request"
25
25
  require "wrest/native/get"
26
26
  require "wrest/native/put"
27
+ require "wrest/native/patch"
27
28
  require "wrest/native/post"
28
29
  require "wrest/native/delete"
29
30
  require "wrest/native/options"
@@ -0,0 +1,23 @@
1
+ # Copyright 2009 Sidu Ponnappa
2
+
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ # Unless required by applicable law or agreed to in writing, software distributed under the License
7
+ # is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
8
+ # See the License for the specific language governing permissions and limitations under the License.
9
+
10
+ module Wrest::Native
11
+ class Patch < Request
12
+ def initialize(wrest_uri, body = '', headers = {}, parameters = {}, options = {})
13
+ super(
14
+ wrest_uri,
15
+ Net::HTTP::Patch,
16
+ parameters,
17
+ body,
18
+ headers,
19
+ options
20
+ )
21
+ end
22
+ end
23
+ end
@@ -115,6 +115,11 @@ module Wrest #:nodoc:
115
115
  def build_put(body = '', headers = {}, parameters = {}, &block)
116
116
  Http::Put.new(self, body.to_s, default_headers.merge(headers), parameters, block ? @options.merge(:callback_block => block) : @options)
117
117
  end
118
+
119
+ #:nodoc:
120
+ def build_patch(body = '', headers = {}, parameters = {}, &block)
121
+ Http::Patch.new(self, body.to_s, default_headers.merge(headers), parameters, block ? @options.merge(:callback_block => block) : @options)
122
+ end
118
123
 
119
124
  #:nodoc:
120
125
  def build_post(body = '', headers = {}, parameters = {}, &block)
@@ -171,6 +176,24 @@ module Wrest #:nodoc:
171
176
  @asynchronous_backend.execute(build_put(body, headers, parameters, &block))
172
177
  end
173
178
 
179
+ # Make a PATCH request to this URI. This is a convenience API
180
+ # that creates a Wrest::Native::Patch, executes it and returns a Wrest::Native::Response.
181
+ #
182
+ # Remember to escape all parameter strings if necessary, using URI.escape
183
+ def patch(body = '', headers = {}, parameters = {}, &block)
184
+ build_patch(body, headers, parameters, &block).invoke
185
+ end
186
+
187
+ # Make a PATCH request to this URI. This is a convenience API
188
+ # that creates a Wrest::Native::Patch.
189
+ #
190
+ # Remember to escape all parameter strings if necessary, using URI.escape
191
+ #
192
+ # Note: patch_async does not return a response and the response should be accessed through callbacks.
193
+ def patch_async(body = '', headers = {}, parameters = {}, &block)
194
+ @asynchronous_backend.execute(build_patch(body, headers, parameters, &block))
195
+ end
196
+
174
197
  # Makes a POST request to this URI. This is a convenience API
175
198
  # that creates a Wrest::Native::Post, executes it and returns a Wrest::Native::Response.
176
199
  #
@@ -8,5 +8,5 @@
8
8
  # See the License for the specific language governing permissions and limitations under the License.
9
9
 
10
10
  module Wrest
11
- VERSION = "2.1.9"
11
+ VERSION = "2.2.0"
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.9
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sidu Ponnappa
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-01-13 00:00:00.000000000 Z
12
+ date: 2017-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -39,20 +39,6 @@ dependencies:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: 1.0.0
42
- - !ruby/object:Gem::Dependency
43
- name: metric_fu
44
- requirement: !ruby/object:Gem::Requirement
45
- requirements:
46
- - - ">="
47
- - !ruby/object:Gem::Version
48
- version: '0'
49
- type: :development
50
- prerelease: false
51
- version_requirements: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - ">="
54
- - !ruby/object:Gem::Version
55
- version: '0'
56
42
  - !ruby/object:Gem::Dependency
57
43
  name: activesupport
58
44
  requirement: !ruby/object:Gem::Requirement
@@ -127,7 +113,7 @@ description: Wrest is a fluent, easy-to-use, object oriented Ruby HTTP/REST clie
127
113
  library with support for RFC2616 HTTP caching, multiple HTTP backends and async
128
114
  calls. It runs on CRuby and JRuby and is in production use at substantial scale.
129
115
  email:
130
- - sidu@c42.in
116
+ - ckponnappa@gmail.com
131
117
  executables:
132
118
  - wrest
133
119
  extensions: []
@@ -180,6 +166,7 @@ files:
180
166
  - lib/wrest/native/delete.rb
181
167
  - lib/wrest/native/get.rb
182
168
  - lib/wrest/native/options.rb
169
+ - lib/wrest/native/patch.rb
183
170
  - lib/wrest/native/post.rb
184
171
  - lib/wrest/native/post_multipart.rb
185
172
  - lib/wrest/native/put.rb
@@ -204,7 +191,7 @@ files:
204
191
  - lib/wrest/xml_mini/rexml.rb
205
192
  - lib/wrest/xml_mini/rexml/xpath_filter.rb
206
193
  - lib/wrest_no_ext.rb
207
- homepage: http://c42.in/open_source
194
+ homepage: https://github.com/gojek-engineering/wrest
208
195
  licenses: []
209
196
  metadata: {}
210
197
  post_install_message:
@@ -224,14 +211,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
211
  version: 1.3.0
225
212
  requirements:
226
213
  - To use Memcached as caching back-end, install the 'dalli' gem.
214
+ - To use Redis as caching back-end, install the 'redis' gem.
227
215
  - To use multipart post, install the 'multipart-post' gem.
228
- - To use curl as the http engine, install the 'patron' gem. This feature is not available
229
- (and should be unneccessary) on jruby.
230
216
  - To use eventmachine as a parallel backend, install the 'eventmachine' gem.
231
217
  rubyforge_project: wrest
232
218
  rubygems_version: 2.6.8
233
219
  signing_key:
234
220
  specification_version: 4
235
- summary: Wrest is a fluent, object oriented HTTP client library for 2.x.x, JRuby 1.7.6
236
- (and higher), JRuby 9.0.0.0.pre2.
221
+ summary: Wrest is a fluent, object oriented HTTP client library for 2.x.x, JRuby 9.x
237
222
  test_files: []