Class: OpenQq::Error
- Inherits:
-
Object
- Object
- OpenQq::Error
- Defined in:
- lib/open_qq/error.rb
Overview
behavior response to body method
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(ret, msg, format = 'json') ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(ret, msg, format = 'json') ⇒ Error
Returns a new instance of Error.
11 12 13 |
# File 'lib/open_qq/error.rb', line 11 def initialize(ret, msg, format = 'json') @ret, @msg, @format = ret, msg, format.to_s end |
Instance Method Details
#body ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/open_qq/error.rb', line 15 def body if @format == 'xml' %Q(<?xml version="1.0" encoding="UTF-8"?><data><ret>#{@ret}</ret><msg>#{@msg}</msg></data>) else {:ret => @ret, :msg => @msg}.to_json end end |