class Myfinance::Entities::ReconcileCollection

Public Instance Methods

build_collection() click to toggle source
# File lib/myfinance/entities/reconcile_collection.rb, line 4
def build_collection
  response.parsed_body.each do |attributes|
    type = attributes.first
    if type == "financial_transactions" || type == "financial_accounts"
      create_collection(type, attributes)
    end
  end
end

Private Instance Methods

create_collection(type, attributes) click to toggle source
# File lib/myfinance/entities/reconcile_collection.rb, line 15
def create_collection(type, attributes)
  klass = klass_name(type)

  attributes.delete(attributes.first)
  attributes.each do |attribute|
    collection.push(klass.new(attribute.first))
  end
end
klass_name(type) click to toggle source
# File lib/myfinance/entities/reconcile_collection.rb, line 24
def klass_name(type)
  return Myfinance::Entities::FinancialTransaction if type == "financial_transactions"
  Myfinance::Entities::FinancialAccount
end