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.
10 11 12 |
# File 'lib/open_qq/error.rb', line 10 def initialize(ret, msg, format = 'json') @ret, @msg, @format = ret, msg, format.to_s end |
Instance Method Details
#body ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/open_qq/error.rb', line 14 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 |