Module: Wrest::Uri::Builders
- Included in:
- Wrest::Uri
- Defined in:
- lib/wrest/uri/builders.rb
Overview
Contains methods that depend on Uri#clone to build new Uris configured in particular ways.
Instance Method Summary collapse
-
#disable_cache ⇒ Object
Disables using the globally configured cache for GET requests made using the Uri returned by this method.
-
#using_cookie(cookie_string) ⇒ Object
Sets the specified string as the cookie for the Uri.
-
#using_em ⇒ Object
Returns a Uri object that uses eventmachine to perform asynchronous requests.
-
#using_hash ⇒ Object
Returns a Uri object that uses hash for caching responses.
-
#using_memcached ⇒ Object
Returns a Uri object that uses memcached for caching responses.
- #using_redis ⇒ Object
-
#using_threads ⇒ Object
Returns a Uri object that uses threads to perform asynchronous requests.
Instance Method Details
#disable_cache ⇒ Object
Disables using the globally configured cache for GET requests made using the Uri returned by this method.
36 37 38 |
# File 'lib/wrest/uri/builders.rb', line 36 def disable_cache clone(:disable_cache => true) end |
#using_cookie(cookie_string) ⇒ Object
Sets the specified string as the cookie for the Uri
41 42 43 |
# File 'lib/wrest/uri/builders.rb', line 41 def () clone(:default_headers => {Wrest::H::Cookie => }) end |
#using_em ⇒ Object
Returns a Uri object that uses eventmachine to perform asynchronous requests. Remember to do Wrest::AsyncRequest.enable_em first so that EventMachine is available for use.
14 15 16 |
# File 'lib/wrest/uri/builders.rb', line 14 def using_em clone(:asynchronous_backend => Wrest::AsyncRequest::EventMachineBackend.new) end |
#using_hash ⇒ Object
Returns a Uri object that uses hash for caching responses.
19 20 21 |
# File 'lib/wrest/uri/builders.rb', line 19 def using_hash clone(:cache_store => {}) end |
#using_memcached ⇒ Object
Returns a Uri object that uses memcached for caching responses. Remember to do Wrest::AsyncRequest.enable_memcached first so that memcached is available for use.
26 27 28 |
# File 'lib/wrest/uri/builders.rb', line 26 def using_memcached clone(:cache_store => Wrest::Caching::Memcached.new) end |
#using_redis ⇒ Object
30 31 32 |
# File 'lib/wrest/uri/builders.rb', line 30 def using_redis clone(:cache_store => Wrest::Caching::Redis.new) end |
#using_threads ⇒ Object
Returns a Uri object that uses threads to perform asynchronous requests.
7 8 9 |
# File 'lib/wrest/uri/builders.rb', line 7 def using_threads clone(:asynchronous_backend => Wrest::AsyncRequest::ThreadBackend.new) end |