Class: Restapi::ErrorDescription

Inherits:
Object
  • Object
show all
Defined in:
lib/restapi/error_description.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#codeObject (readonly)

Returns the value of attribute code.



5
6
7
# File 'lib/restapi/error_description.rb', line 5

def code
  @code
end

#descriptionObject (readonly)

Returns the value of attribute description.



5
6
7
# File 'lib/restapi/error_description.rb', line 5

def description
  @description
end