Sha256: eb34264c4c2e82f4afe58096bd346dda30b67b551ef7c48fb7d82237308ed3da

Contents?: true

Size: 534 Bytes

Versions: 2

Compression:

Stored size: 534 Bytes

Contents

module RockRMS
  class Donation
    def self.format(response)
      if response.is_a?(Array)
        response.map{|donation| format_donation(donation) }
      else
        format_donation(response)
      end
    end

    def self.format_donation(donation)
      {
        id:     donation["Id"],
        date:   donation["TransactionDateTime"],
        amount: donation["TransactionDetails"].reduce(0){|sum, td| sum + td["Amount"]},
        person_id: donation["AuthorizedPersonAliasId"],
        fund:   ""
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rock_rms-0.0.2 lib/rock_rms/responses/donation.rb
rock_rms-0.0.1 lib/rock_rms/responses/donation.rb