class Fellowshipone::Contribution

Public Class Methods

format(res) click to toggle source
# File lib/fellowshipone/responses/contribution.rb, line 3
def self.format(res)
  response = res['contributionReceipt']
  if response.is_a?(Array)
    response.map{|contribution| format_contribution(contribution) }
  else
    format_contribution(response)
  end
end
format_contribution(contribution) click to toggle source
# File lib/fellowshipone/responses/contribution.rb, line 12
def self.format_contribution(contribution)
  OpenStruct.new(
    id:       contribution['@id'],
    amount:   contribution['amount'],
    fund:     contribution['fund']['name'],
    sub_fund: contribution['subFund']['name'],
    date:     contribution['receivedDate'],
    fund_type_id: contribution['fund']['fundTypeID']
  )
end