Module: Resourceful
- Extended by:
- Simple
- Defined in:
- lib/resourceful.rb,
lib/resourceful.rb,
lib/resourceful/header.rb,
lib/resourceful/simple.rb,
lib/resourceful/request.rb,
lib/resourceful/resource.rb,
lib/resourceful/response.rb,
lib/resourceful/exceptions.rb,
lib/resourceful/cache_manager.rb,
lib/resourceful/http_accessor.rb,
lib/resourceful/net_http_adapter.rb,
lib/resourceful/abstract_form_data.rb,
lib/resourceful/multipart_form_data.rb,
lib/resourceful/urlencoded_form_data.rb,
lib/resourceful/authentication_manager.rb,
lib/resourceful/memcache_cache_manager.rb,
lib/resourceful/stubbed_resource_proxy.rb
Overview
Represents the header fields of an HTTP message. To access a field you can use ‘#[]` and `#[]=`. For example, to get the content type of a response you can do
response.header['Content-Type'] # => "application/xml"
Lookups and modifications done in this way are case insensitive, so ‘Content-Type’, ‘content-type’ and :content_type are all equivalent.
Multi-valued fields
Multi-value fields (e.g. Accept) are always returned as an Array regardless of the number of values, if the field is present. Single-value fields (e.g. Content-Type) are always returned as strings. The multi/single valueness of a header field is determined by the way it is defined in the HTTP spec. Unknown fields are treated as multi-valued.
(This behavior is new in 0.6 and may be slightly incompatible with the way previous versions worked in some situations.)
For example
h = Resourceful::Header.new
h['Accept'] = "application/xml"
h['Accept'] # => ["application/xml"]
Defined Under Namespace
Modules: Simple Classes: AbstractCacheManager, AbstractFormData, AuthenticationManager, BasicAuthenticator, BitBucketLogger, CacheEntry, CacheEntryCollection, DigestAuthenticator, FileCacheManager, Header, HttpAccessor, InMemoryCacheManager, MalformedServerResponse, MemcacheCacheManager, MissingContentType, MultipartFormData, NetHttpAdapter, NullCacheManager, Request, Resource, Response, StdOutLogger, StubbedResourceProxy, UnsuccessfulHttpRequestError, UnsupportedContentCoding, UrlencodedFormData
Constant Summary collapse
- VERSION =
"1.0.1"
- RESOURCEFUL_USER_AGENT_TOKEN =
"Resourceful/#{VERSION}(Ruby/#{RUBY_VERSION})"
Method Summary
Methods included from Simple
add_authenticator, default_accessor, delete, get, head, post, put, request