Class: Acfs::Response
- Inherits:
-
Object
- Object
- Acfs::Response
- Defined in:
- lib/acfs/response.rb,
lib/acfs/response/status.rb,
lib/acfs/response/formats.rb
Overview
This represents a response. In addition to an standard HTTP it has a field ‘data` for storing the encoded body.
Defined Under Namespace
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#data ⇒ Object
Returns the value of attribute data.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(request, **opts) ⇒ Response
constructor
delegate :status, :status_message, :success?, :modified?, :timed_out?, :response_body, :response_headers, :response_code, :headers, to: :response.
Methods included from Status
#modified?, #status_code, #success?
Methods included from Formats
Constructor Details
#initialize(request, **opts) ⇒ Response
delegate :status, :status_message, :success?, :modified?, :timed_out?,
:response_body, :response_headers, :response_code, :headers,
to: :response
22 23 24 25 26 27 28 |
# File 'lib/acfs/response.rb', line 22 def initialize(request, **opts) @request = request @status = opts[:status] || 0 @headers = opts[:headers] || {} @body = opts[:body] || '' @data = opts[:data] || nil end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
13 14 15 |
# File 'lib/acfs/response.rb', line 13 def body @body end |
#data ⇒ Object
Returns the value of attribute data.
12 13 14 |
# File 'lib/acfs/response.rb', line 12 def data @data end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
13 14 15 |
# File 'lib/acfs/response.rb', line 13 def headers @headers end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
13 14 15 |
# File 'lib/acfs/response.rb', line 13 def request @request end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
13 14 15 |
# File 'lib/acfs/response.rb', line 13 def status @status end |