Class: ActiveApi::ApiObjectError
- Inherits:
-
Hash
- Object
- Hash
- ActiveApi::ApiObjectError
- Defined in:
- lib/api_object.rb
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(*args) ⇒ ApiObjectError
constructor
A new instance of ApiObjectError.
- #inspect ⇒ Object
- #keys ⇒ Object
- #map(&block) ⇒ Object (also: #collect)
- #to_s ⇒ Object
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 = args. @errors = .delete(:errors) @klass = .delete(:class) end |
Instance Attribute Details
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
178 179 180 |
# File 'lib/api_object.rb', line 178 def errors @errors end |
#klass ⇒ Object (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 |
#inspect ⇒ Object
200 201 202 |
# File 'lib/api_object.rb', line 200 def inspect "ApiObjectError: #{@errors}" end |
#keys ⇒ Object
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_s ⇒ Object
204 205 206 |
# File 'lib/api_object.rb', line 204 def to_s inspect end |