Class: XResponse
- Inherits:
-
Object
- Object
- XResponse
- Defined in:
- lib/merb-ext-direct/xresponse.rb
Overview
XResponse A standard response class suitable for Ext.Direct AJAX responses.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#errors ⇒ Object
Returns the value of attribute errors.
-
#message ⇒ Object
Returns the value of attribute message.
-
#result ⇒ Object
Returns the value of attribute result.
-
#status ⇒ Object
Returns the value of attribute status.
-
#success ⇒ Object
Returns the value of attribute success.
-
#tid ⇒ Object
readonly
Returns the value of attribute tid.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(req) ⇒ XResponse
constructor
A new instance of XResponse.
- #to_h ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(req) ⇒ XResponse
Returns a new instance of XResponse.
10 11 12 13 14 15 16 17 |
# File 'lib/merb-ext-direct/xresponse.rb', line 10 def initialize(req) @tid = req.tid @type = req.type @status = false @message = '' @result = [] @errors = [] end |
Instance Attribute Details
#errors ⇒ Object
Returns the value of attribute errors.
7 8 9 |
# File 'lib/merb-ext-direct/xresponse.rb', line 7 def errors @errors end |
#message ⇒ Object
Returns the value of attribute message.
7 8 9 |
# File 'lib/merb-ext-direct/xresponse.rb', line 7 def @message end |
#result ⇒ Object
Returns the value of attribute result.
7 8 9 |
# File 'lib/merb-ext-direct/xresponse.rb', line 7 def result @result end |
#status ⇒ Object
Returns the value of attribute status.
7 8 9 |
# File 'lib/merb-ext-direct/xresponse.rb', line 7 def status @status end |
#success ⇒ Object
Returns the value of attribute success.
7 8 9 |
# File 'lib/merb-ext-direct/xresponse.rb', line 7 def success @success end |
#tid ⇒ Object (readonly)
Returns the value of attribute tid.
8 9 10 |
# File 'lib/merb-ext-direct/xresponse.rb', line 8 def tid @tid end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/merb-ext-direct/xresponse.rb', line 7 def type @type end |
Instance Method Details
#to_h ⇒ Object
19 20 21 |
# File 'lib/merb-ext-direct/xresponse.rb', line 19 def to_h {:tid => @tid, :status => @status, :type => @type, :message => @message, :result => @result, :errors => @errors} end |
#to_json ⇒ Object
23 24 25 |
# File 'lib/merb-ext-direct/xresponse.rb', line 23 def to_json self.to_h.to_json end |