Class: Asaas::Entity::Data

Inherits:
Virtus::Attribute
  • Object
show all
Defined in:
lib/asaas/entity/meta.rb

Instance Method Summary collapse

Instance Method Details

#coerce(value) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
# File 'lib/asaas/entity/meta.rb', line 4

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