Sha256: ed6705b1ab887baa7dbe9bc025089f1afcbfcda1d6ba5b9bb795d1d3d35d2edb
Contents?: true
Size: 431 Bytes
Versions: 2
Compression:
Stored size: 431 Bytes
Contents
module StreamElements class Collection attr_reader :data, :total def self.from_response(response, type:, name: nil) if name.nil? body = response.body else body = response.body[name] end new( data: body.map { |attrs| type.new(attrs) }, total: body.count, ) end def initialize(data:, total:) @data = data @total = total end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
streamelements-0.2.0 | lib/stream_elements/collection.rb |
streamelements-0.1.0 | lib/stream_elements/collection.rb |