Sha256: 1d7810da3a3094d9f7a5d00fc33397d3a4abb403bef12acbe273ea1ffdc61fb5
Contents?: true
Size: 895 Bytes
Versions: 14
Compression:
Stored size: 895 Bytes
Contents
module Asaas module Entity class Data < Virtus::Attribute def coerce(value) value.map do |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) if Asaas::Configuration.api_version == 2 "Asaas::Entity::#{type.capitalize}".constantize else "Asaas::#{type.capitalize}".constantize end rescue Asaas::Entity::Base 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
14 entries across 14 versions & 1 rubygems