Exception: MediawikiApi::ApiError
- Inherits:
-
StandardError
- Object
- StandardError
- MediawikiApi::ApiError
- Defined in:
- lib/mediawiki_api/exceptions.rb
Overview
generic MediaWiki api errors
Direct Known Subclasses
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #code ⇒ Object
- #info ⇒ Object
-
#initialize(response = nil) ⇒ ApiError
constructor
A new instance of ApiError.
- #to_s ⇒ Object
Constructor Details
#initialize(response = nil) ⇒ ApiError
Returns a new instance of ApiError.
6 7 8 |
# File 'lib/mediawiki_api/exceptions.rb', line 6 def initialize(response = nil) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/mediawiki_api/exceptions.rb', line 4 def response @response end |
Instance Method Details
#code ⇒ Object
10 11 12 |
# File 'lib/mediawiki_api/exceptions.rb', line 10 def code response_data['code'] || '000' end |
#info ⇒ Object
14 15 16 |
# File 'lib/mediawiki_api/exceptions.rb', line 14 def info response_data['info'] || 'unknown API error' end |
#to_s ⇒ Object
18 19 20 |
# File 'lib/mediawiki_api/exceptions.rb', line 18 def to_s "#{info} (#{code})" end |