Sha256: 347eab56c5d4d8cea34873e373e8122cbca89db6825947bc1c48ca24627e1ed7

Contents?: true

Size: 385 Bytes

Versions: 1

Compression:

Stored size: 385 Bytes

Contents

module SantanderChile
  module ApiClient
    class Collection
      attr_reader :data

      def initialize(data:)
        @data = data
      end

      def self.from_response(response, keys_to:, type:)
        body = response.body
        new(
          data: body.dig(*keys_to).map {
            |attrs|
            type.new(attrs)
          },
        )
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
santander_chile-api_client-0.0.2 lib/santander_chile/api_client/collection.rb