Class: Shaf::Responder::Response
- Inherits:
-
Object
- Object
- Shaf::Responder::Response
- Defined in:
- lib/shaf/responder/base.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#preload_links ⇒ Object
Returns the value of attribute preload_links.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#serialized_hash ⇒ Object
readonly
Returns the value of attribute serialized_hash.
Instance Method Summary collapse
-
#initialize(content_type:, body:, serialized_hash: {}, resource: nil) ⇒ Response
constructor
A new instance of Response.
- #log_entry ⇒ Object
Constructor Details
#initialize(content_type:, body:, serialized_hash: {}, resource: nil) ⇒ Response
Returns a new instance of Response.
7 8 9 10 11 12 13 |
# File 'lib/shaf/responder/base.rb', line 7 def initialize(content_type:, body:, serialized_hash: {}, resource: nil) @content_type = content_type @body = body @serialized_hash = serialized_hash @resource = resource @preload_links = [] end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
4 5 6 |
# File 'lib/shaf/responder/base.rb', line 4 def body @body end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
4 5 6 |
# File 'lib/shaf/responder/base.rb', line 4 def content_type @content_type end |
#preload_links ⇒ Object
Returns the value of attribute preload_links.
5 6 7 |
# File 'lib/shaf/responder/base.rb', line 5 def preload_links @preload_links end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
4 5 6 |
# File 'lib/shaf/responder/base.rb', line 4 def resource @resource end |
#serialized_hash ⇒ Object (readonly)
Returns the value of attribute serialized_hash.
4 5 6 |
# File 'lib/shaf/responder/base.rb', line 4 def serialized_hash @serialized_hash end |
Instance Method Details
#log_entry ⇒ Object
15 16 17 |
# File 'lib/shaf/responder/base.rb', line 15 def log_entry "Response (#{resource.class}) payload: #{body}" end |