Class: Facile::Response
- Inherits:
-
Object
- Object
- Facile::Response
- Defined in:
- lib/facile/response.rb
Defined Under Namespace
Classes: Wrapper
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#raw_body ⇒ Object
readonly
Returns the value of attribute raw_body.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(options) ⇒ Response
constructor
A new instance of Response.
- #method_missing(method, *args, &block) ⇒ Object
- #wrap_body(body) ⇒ Object
Constructor Details
#initialize(options) ⇒ Response
Returns a new instance of Response.
4 5 6 7 8 9 10 |
# File 'lib/facile/response.rb', line 4 def initialize() .each do |k,v| self.send("#{k}=", v) end wrap_body(raw_body) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
16 17 18 19 20 |
# File 'lib/facile/response.rb', line 16 def method_missing(method, *args, &block) if body.respond_to?(method) body.send(method, args.first) end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
22 23 24 |
# File 'lib/facile/response.rb', line 22 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
22 23 24 |
# File 'lib/facile/response.rb', line 22 def headers @headers end |
#raw_body ⇒ Object
Returns the value of attribute raw_body.
22 23 24 |
# File 'lib/facile/response.rb', line 22 def raw_body @raw_body end |
#request ⇒ Object
Returns the value of attribute request.
22 23 24 |
# File 'lib/facile/response.rb', line 22 def request @request end |
#response ⇒ Object
Returns the value of attribute response.
22 23 24 |
# File 'lib/facile/response.rb', line 22 def response @response end |
#status ⇒ Object
Returns the value of attribute status.
22 23 24 |
# File 'lib/facile/response.rb', line 22 def status @status end |