Instances of the Hoodoo::Services::Request class are passed to service interface implementations when requests come in via Rack, after basic checks have been passed and a particular interface implementation has been identified by endpoint.
Descriptions of default values expected out of accessors herein refer to
the use case when driven through Hoodoo::Services::Middleware. If the class is
instantiated “bare” it gains no default values at all (all read accessors
would report nil
).
[RW] | body | Parsed payload hash, for create and update actions only; else
|
[RW] | embeds | Array of strings giving requested embedded items; [] if there are none requested. |
[RW] | headers | Hash of HTTP headers in Rack format - e.g.
|
[R] | ident | The first entry in the uri_path_components
array, or |
[RW] | list | The Hoodoo::Services::Request::ListParameters instance associated with this request. |
[RW] | locale | Requested locale for internationalised operations; +“en-nz”+ by default. |
[RW] | references | Array of strings giving requested referenced items; [] if there are none requested. |
[R] | uri_path_components | An array of zero or more path components making up the URI after the service endpoint has been accounted for. For example, with a service endpoint of “products”, this URI:
…would lead to this path component array:
The first element of the path components array is exposed in the read-only ident accessor. |
[RW] | uri_path_extension | A filename extension on the URI path component, if any, else an empty string. The first dot in the last path component is looked for (see also uri_path_components), so for example this URI:
…would lead to this URI path extension string:
|
Set up defaults in this instance.
Source: show
# File lib/hoodoo/services/services/request.rb, line 255 def initialize self.locale = 'en-nz' self.uri_path_components = [] self.uri_path_extension = '' self.list = Hoodoo::Services::Request::ListParameters.new self.embeds = [] self.references = [] self.headers = {}.freeze end
Set the array returned by uri_path_components and record the first element in the value returned by ident.
ary
-
Path component array to record. If
nil
or not an array,nil
is stored for #uri_path_components and ident.
Source: show
# File lib/hoodoo/services/services/request.rb, line 190 def uri_path_components=( ary ) if ary.is_a?( ::Array ) @uri_path_components = ary @ident = ary.first else @uri_path_components = nil @ident = nil end end