Class: Riddl::Protocols::XMPP::Error
- Inherits:
-
Object
- Object
- Riddl::Protocols::XMPP::Error
- Defined in:
- lib/ruby/riddl/protocols/xmpp/generator.rb
Constant Summary collapse
- MAPPING =
{ 302 => ['redirect' , 'modify' , '302 Redirect' ], 400 => ['bad-request' , 'modify' , '400 Bad Request' ], 401 => ['not-authorized' , 'auth' , '401 Not Authorized ' ], 402 => ['payment-required' , 'auth' , '402 Payment Required' ], 403 => ['forbidden' , 'auth' , '403 Forbidden' ], 404 => ['item-not-found' , 'cancel' , '404 Not Found' ], 405 => ['not-allowed' , 'cancel' , '405 Not Allowed' ], 406 => ['not-acceptable' , 'modify' , '406 Not Acceptable' ], 407 => ['registration-required' , 'auth' , '407 Registration Required' ], 408 => ['remote-server-timeout' , 'wait' , '408 Request Timeout' ], 409 => ['conflict' , 'cancel' , '409 Conflict' ], 500 => ['internal-server-error' , 'wait' , '500 Internal Server Error' ], 501 => ['feature-not-implemented' , 'cancel' , '501 Not Implemented' ], 502 => ['service-unavailable' , 'wait' , '502 Remote Server Error' ], 503 => ['service-unavailable' , 'cancel' , '503 Service Unavailable' ], 504 => ['remote-server-timeout' , 'wait' , '504 Remote Server Timeout' ], 510 => ['service-unavailable' , 'cancel' , '510 Disconnected' ] }.freeze
- UNDEFINED =
[ 'undefined-condition', 'modify' ].freeze
Instance Method Summary collapse
- #generate ⇒ Object
-
#initialize(err) ⇒ Error
constructor
A new instance of Error.
Constructor Details
#initialize(err) ⇒ Error
Returns a new instance of Error.
44 45 46 47 48 49 50 51 |
# File 'lib/ruby/riddl/protocols/xmpp/generator.rb', line 44 def initialize(err) m = Stanza.new @stanza = if MAPPING[err] Blather::StanzaError.new(m,*MAPPING[err]).to_node else Blather::StanzaError.new(m,*UNDEFINED,'#{err} see http://www.iana.org/assignments/http-status-codes/http-status-codes.xml').to_node end end |
Instance Method Details
#generate ⇒ Object
53 54 55 |
# File 'lib/ruby/riddl/protocols/xmpp/generator.rb', line 53 def generate @stanza end |