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)

Instance Method Details

- (Object) disable_cache

Disables using the globally configured cache for GET requests made using the Uri returned by this method.



32
33
34
# File 'lib/wrest/uri/builders.rb', line 32

def disable_cache
  clone(:disable_cache => true)
end

Sets the specified string as the cookie for the Uri



37
38
39
# File 'lib/wrest/uri/builders.rb', line 37

def using_cookie(cookie_string)
  clone(:default_headers => {Wrest::H::Cookie => cookie_string})
end

- (Object) using_em

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

- (Object) using_hash

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

- (Object) using_memcached

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

- (Object) using_threads

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