Sha256: 18f361246c3b5da83879832f0e547832d8776e19f2724012a278a21251b0511c
Contents?: true
Size: 512 Bytes
Versions: 10
Compression:
Stored size: 512 Bytes
Contents
module Paddle class Collection attr_reader :data, :total def self.from_response(response, type:) body = response.body data = body["data"].map { |attrs| type.new(attrs) } if body["meta"]["pagination"] total = body["meta"]["pagination"]["estimated_total"] else total = body["data"].count end new( data: data, total: total ) end def initialize(data:, total:) @data = data @total = total end end end
Version data entries
10 entries across 10 versions & 1 rubygems