Class: CassetteRack::Decorator::Response
- Inherits:
-
Object
- Object
- CassetteRack::Decorator::Response
- Defined in:
- lib/cassette-rack/decorator/response.rb
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
- #status_code ⇒ Object
- #status_message ⇒ Object
- #to_liquid ⇒ Object
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
6 7 8 |
# File 'lib/cassette-rack/decorator/response.rb', line 6 def initialize(response) @response = response end |
Instance Method Details
#body ⇒ Object
26 27 28 29 30 |
# File 'lib/cassette-rack/decorator/response.rb', line 26 def body JSON.pretty_generate JSON.parse(@response.body) rescue @response.body end |
#status_code ⇒ Object
18 19 20 |
# File 'lib/cassette-rack/decorator/response.rb', line 18 def status_code @response.status.code end |
#status_message ⇒ Object
22 23 24 |
# File 'lib/cassette-rack/decorator/response.rb', line 22 def @response.status. end |
#to_liquid ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/cassette-rack/decorator/response.rb', line 10 def to_liquid { 'status_code' => status_code, 'status_message' => , 'body' => body, } end |