Class: Jsonorama::JsonResponse
- Inherits:
-
Object
- Object
- Jsonorama::JsonResponse
- Defined in:
- lib/jsonorama/json_response.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#message ⇒ Object
Returns the value of attribute message.
-
#status_code ⇒ Object
Returns the value of attribute status_code.
Instance Method Summary collapse
- #client_error? ⇒ Boolean
-
#initialize {|_self| ... } ⇒ JsonResponse
constructor
A new instance of JsonResponse.
- #server_error? ⇒ Boolean
Constructor Details
#initialize {|_self| ... } ⇒ JsonResponse
Returns a new instance of JsonResponse.
6 7 8 9 10 11 12 13 14 |
# File 'lib/jsonorama/json_response.rb', line 6 def initialize self. = nil self.errors = nil self.data = Blobject.new self.exception = nil self.status_code = nil yield self if block_given? self end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
4 5 6 |
# File 'lib/jsonorama/json_response.rb', line 4 def data @data end |
#errors ⇒ Object
Returns the value of attribute errors.
4 5 6 |
# File 'lib/jsonorama/json_response.rb', line 4 def errors @errors end |
#exception ⇒ Object
Returns the value of attribute exception.
4 5 6 |
# File 'lib/jsonorama/json_response.rb', line 4 def exception @exception end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/jsonorama/json_response.rb', line 4 def @message end |
#status_code ⇒ Object
Returns the value of attribute status_code.
4 5 6 |
# File 'lib/jsonorama/json_response.rb', line 4 def status_code @status_code end |
Instance Method Details
#client_error? ⇒ Boolean
16 17 18 |
# File 'lib/jsonorama/json_response.rb', line 16 def client_error? self.status_code.to_s.starts_with? '4' end |
#server_error? ⇒ Boolean
20 21 22 |
# File 'lib/jsonorama/json_response.rb', line 20 def server_error? self.status_code.to_s.starts_with? '5' end |