Sha256: 71c8a9eeee8d5b0b97a08283d63d0255cb1d0c7ea3f94161d8c364836a22ebd8
Contents?: true
Size: 621 Bytes
Versions: 1
Compression:
Stored size: 621 Bytes
Contents
require 'loqate/mappers/generic_mapper' require 'loqate/error' require 'loqate/util' module Loqate module Mappers # Transforms erroneous responses into concrete error objects. # # @api private # class ErrorMapper # Creates errors from an API response # # @return [Array<Error>] An array of errors # def map(items) items.map do |item| attributes = item.transform_keys { |attribute| Util.underscore(attribute) } attributes[:id] = attributes.delete(:error).to_i Loqate::Error.new(attributes) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
loqate-0.2.0 | lib/loqate/mappers/error_mapper.rb |