Class: Loqate::Mappers::ErrorMapper Private
- Inherits:
-
Object
- Object
- Loqate::Mappers::ErrorMapper
- Defined in:
- lib/loqate/mappers/error_mapper.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Transforms erroneous responses into concrete error objects.
Instance Method Summary collapse
-
#map(items) ⇒ Array<Error>
private
Creates errors from an API response.
-
#map_one(item) ⇒ Error
private
Creates an error from an API response.
Instance Method Details
#map(items) ⇒ Array<Error>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates errors from an API response
16 17 18 |
# File 'lib/loqate/mappers/error_mapper.rb', line 16 def map(items) items.map { |item| map_one(item) } end |
#map_one(item) ⇒ Error
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates an error from an API response
24 25 26 27 28 29 |
# File 'lib/loqate/mappers/error_mapper.rb', line 24 def map_one(item) attributes = item.transform_keys { |attribute| Util.underscore(attribute) } attributes[:id] = attributes.delete(:error).to_i Loqate::Error.new(**attributes) end |