Class: ActiveApi::ApiObjectError

Inherits:
Hash
  • Object
show all
Defined in:
lib/api_object.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ApiObjectError

Returns a new instance of ApiObjectError.



180
181
182
183
184
# File 'lib/api_object.rb', line 180

def initialize *args
  options = args.extract_options!
  @errors = options.delete(:errors)
  @klass = options.delete(:class)
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



178
179
180
# File 'lib/api_object.rb', line 178

def errors
  @errors
end

#klassObject (readonly)

Returns the value of attribute klass.



178
179
180
# File 'lib/api_object.rb', line 178

def klass
  @klass
end

Instance Method Details

#[](key) ⇒ Object



190
191
192
# File 'lib/api_object.rb', line 190

def [](key)
  eval("self.#{key.to_s}") if keys.include?(key)
end

#inspectObject



200
201
202
# File 'lib/api_object.rb', line 200

def inspect
  "ApiObjectError: #{@errors}"
end

#keysObject



186
187
188
# File 'lib/api_object.rb', line 186

def keys
  [:errors]
end

#map(&block) ⇒ Object Also known as: collect



194
195
196
# File 'lib/api_object.rb', line 194

def map &block
  klass.new({:errors => @errors})
end

#to_sObject



204
205
206
# File 'lib/api_object.rb', line 204

def to_s
  inspect
end