Sha256: 6c58f356c78ee48744df6f4fdaa78b474c078e6c6ae17c6aa8379a3887ab6689
Contents?: true
Size: 746 Bytes
Versions: 6
Compression:
Stored size: 746 Bytes
Contents
module Asaas module Entity class Data < Virtus::Attribute def coerce(value) value.map do |hash| ap hash if hash.has_key? "object" entity = convert_data_to_entity(hash["object"]) entity.new(hash) else entity = convert_data_to_entity(hash.keys.first) entity.new(hash.values.first) end end end protected def convert_data_to_entity(type) "Asaas::Entity::#{type.capitalize}".constantize end end class Meta include Virtus.model attribute :limit, Integer attribute :offset, Integer attribute :hasMore, Axiom::Types::Boolean attribute :data, Data end end end
Version data entries
6 entries across 6 versions & 1 rubygems