Class: Umengo::Res
- Inherits:
-
Object
- Object
- Umengo::Res
- Defined in:
- lib/umengo/res.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(response, uri) ⇒ Res
constructor
A new instance of Res.
- #json_body ⇒ Object
- #ok? ⇒ Boolean
Constructor Details
#initialize(response, uri) ⇒ Res
Returns a new instance of Res.
5 6 7 8 9 |
# File 'lib/umengo/res.rb', line 5 def initialize(response, uri) @type = uri @status = response.status @body = response.body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/umengo/res.rb', line 3 def body @body end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
3 4 5 |
# File 'lib/umengo/res.rb', line 3 def status @status end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/umengo/res.rb', line 3 def type @type end |
Instance Method Details
#json_body ⇒ Object
15 16 17 |
# File 'lib/umengo/res.rb', line 15 def json_body Oj.load(@body) end |
#ok? ⇒ Boolean
11 12 13 |
# File 'lib/umengo/res.rb', line 11 def ok? status == 200 end |