Sha256: d6e86e0a7bfc91d79a89a70699010dcdf80b96fe7261865921aebae3ec6fe9b0

Contents?: true

Size: 529 Bytes

Versions: 5

Compression:

Stored size: 529 Bytes

Contents

require 'rom/http/support/transformations'

module ROM
  module HTTP
    class Dataset
      module ResponseTransformers
        class Schemaless
          def call(response, dataset)
            if dataset.projections.empty?
              response
            else
              t(:map_array, t(:accept_keys, dataset.projections)).call(response)
            end
          end

          private

          def t(*args)
            ROM::HTTP::Support::Transformations[*args]
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rom-http-0.5.0 lib/rom/http/dataset/response_transformers/schemaless.rb
rom-http-0.4.0 lib/rom/http/dataset/response_transformers/schemaless.rb
rom-http-0.3.0 lib/rom/http/dataset/response_transformers/schemaless.rb
rom-http-0.2.0 lib/rom/http/dataset/response_transformers/schemaless.rb
rom-http-0.2.0.beta1 lib/rom/http/dataset/response_transformers/schemaless.rb