Exception: Rakuten::ApiError
- Defined in:
- lib/rakuten/api_error.rb
Instance Attribute Summary collapse
-
#help ⇒ Object
readonly
Returns the value of attribute help.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(message, help = nil) ⇒ ApiError
constructor
A new instance of ApiError.
Constructor Details
#initialize(message, help = nil) ⇒ ApiError
Returns a new instance of ApiError.
10 11 12 13 |
# File 'lib/rakuten/api_error.rb', line 10 def initialize , help = nil @help = help super end |
Instance Attribute Details
#help ⇒ Object (readonly)
Returns the value of attribute help.
8 9 10 |
# File 'lib/rakuten/api_error.rb', line 8 def help @help end |
Class Method Details
.[](code) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/rakuten/api_error.rb', line 16 def [] code code = code.to_i return self if code == 0 @errors_by_code ||= Hash.new do |hash, key| error_class = Class.new(self).tap { |c| c.code = key } const_set "E#{key}", error_class hash[key] = error_class end @errors_by_code[code] end |