Class: Oja::Mock::Response
- Inherits:
-
Object
- Object
- Oja::Mock::Response
- Defined in:
- lib/oja/mock.rb
Instance Attribute Summary collapse
-
#payload ⇒ Object
readonly
Returns the value of attribute payload.
-
#status_code ⇒ Object
readonly
Returns the value of attribute status_code.
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(status_code, payload) ⇒ Response
constructor
A new instance of Response.
- #ok? ⇒ Boolean
Constructor Details
#initialize(status_code, payload) ⇒ Response
Returns a new instance of Response.
9 10 11 12 |
# File 'lib/oja/mock.rb', line 9 def initialize(status_code, payload) @status_code = status_code @payload = payload end |
Instance Attribute Details
#payload ⇒ Object (readonly)
Returns the value of attribute payload.
7 8 9 |
# File 'lib/oja/mock.rb', line 7 def payload @payload end |
#status_code ⇒ Object (readonly)
Returns the value of attribute status_code.
7 8 9 |
# File 'lib/oja/mock.rb', line 7 def status_code @status_code end |
Instance Method Details
#body ⇒ Object
18 19 20 |
# File 'lib/oja/mock.rb', line 18 def body JSON.dump(payload) end |
#ok? ⇒ Boolean
14 15 16 |
# File 'lib/oja/mock.rb', line 14 def ok? 200 == status_code.to_i end |