Class: Restapi::ErrorDescription
- Inherits:
-
Object
- Object
- Restapi::ErrorDescription
- Defined in:
- lib/restapi/error_description.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
Instance Method Summary collapse
-
#initialize(args) ⇒ ErrorDescription
constructor
A new instance of ErrorDescription.
Constructor Details
#initialize(args) ⇒ ErrorDescription
Returns a new instance of ErrorDescription.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/restapi/error_description.rb', line 7 def initialize(args) if args.first.is_a? Hash args = args.first elsif args.count == 2 args = {:code => args.first, :description => args.second} else raise ArgumentError "RestapiError: Bad use of error method." end @code = args[:code] || args['code'] @description = args[:desc] || args[:description] || args['desc'] || args['description'] end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
5 6 7 |
# File 'lib/restapi/error_description.rb', line 5 def code @code end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
5 6 7 |
# File 'lib/restapi/error_description.rb', line 5 def description @description end |