Class: Expedition::Response
- Inherits:
-
Object
- Object
- Expedition::Response
- Defined in:
- lib/expedition/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(normalized, raw) ⇒ Response
constructor
A new instance of Response.
- #method_missing(method_name, *arguments, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *arguments, &block) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/expedition/response.rb', line 35 def method_missing(method_name, *arguments, &block) if respond_to_missing?(method_name) body.send(method_name, *arguments, &block) else super end end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
8 9 10 |
# File 'lib/expedition/response.rb', line 8 def body @body end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
10 11 12 |
# File 'lib/expedition/response.rb', line 10 def raw @raw end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
12 13 14 |
# File 'lib/expedition/response.rb', line 12 def status @status end |
Class Method Details
.parse(raw) ⇒ Object
14 15 16 17 18 |
# File 'lib/expedition/response.rb', line 14 def self.parse(raw) normalized = normalize(raw) normalized = yield normalized if block_given? new(normalized, raw) end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
31 32 33 |
# File 'lib/expedition/response.rb', line 31 def respond_to_missing?(method_name, include_private = false) body.respond_to?(method_name) || super end |