Sha256: 91ddd4a2aec74873f3b84fd3d28caa02b6816c90adedee1fade0627a45d23316
Contents?: true
Size: 637 Bytes
Versions: 19
Compression:
Stored size: 637 Bytes
Contents
module Paddle module Classic class Collection attr_reader :data, :total def self.from_response(response, type:, key: nil) body = response.body if key.is_a?(String) data = body["response"][key].map { |attrs| type.new(attrs) } total = body["response"]["total"] else data = body["response"].map { |attrs| type.new(attrs) } total = body["response"].count end new( data: data, total: total ) end def initialize(data:, total:) @data = data @total = total end end end end
Version data entries
19 entries across 19 versions & 1 rubygems