wrest 2.1.9 → 2.2.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG +3 -0
- data/README.md +21 -15
- data/lib/wrest/native.rb +1 -0
- data/lib/wrest/native/patch.rb +23 -0
- data/lib/wrest/uri.rb +23 -0
- data/lib/wrest/version.rb +1 -1
- metadata +7 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74d6752f1e1d310a56a31c8b5d412bc33f4c6405
|
4
|
+
data.tar.gz: 82875275d48826a8154e481982f6e69ccfd60de2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
[](https://travis-ci.org/c42/wrest)
|
2
2
|
|
3
|
-
# Wrest 2.
|
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
|
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
|
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 (
|
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
|
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
|
-
|
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
|
-
|
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
|
data/lib/wrest/native.rb
CHANGED
@@ -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
|
data/lib/wrest/uri.rb
CHANGED
@@ -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
|
#
|
data/lib/wrest/version.rb
CHANGED
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.
|
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-
|
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
|
-
-
|
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:
|
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
|
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: []
|