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.
38 39 40 |
# File 'lib/wrest/uri/builders.rb', line 38 def disable_cache clone(disable_cache: true) end |
#using_cookie(cookie_string) ⇒ Object
Sets the specified string as the cookie for the Uri
43 44 45 |
# File 'lib/wrest/uri/builders.rb', line 43 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.
16 17 18 |
# File 'lib/wrest/uri/builders.rb', line 16 def using_em clone(asynchronous_backend: Wrest::AsyncRequest::EventMachineBackend.new) end |
#using_hash ⇒ Object
Returns a Uri object that uses hash for caching responses.
21 22 23 |
# File 'lib/wrest/uri/builders.rb', line 21 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.
28 29 30 |
# File 'lib/wrest/uri/builders.rb', line 28 def using_memcached clone(cache_store: Wrest::Caching::Memcached.new) end |
#using_redis ⇒ Object
32 33 34 |
# File 'lib/wrest/uri/builders.rb', line 32 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.
9 10 11 |
# File 'lib/wrest/uri/builders.rb', line 9 def using_threads clone(asynchronous_backend: Wrest::AsyncRequest::ThreadBackend.new) end |