Class: Fellowshipone::Contribution
- Inherits:
-
Object
- Object
- Fellowshipone::Contribution
- Defined in:
- lib/fellowshipone/responses/contribution.rb
Class Method Summary collapse
Class Method Details
.format(res) ⇒ Object
3 4 5 6 7 8 9 10 |
# 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) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# 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 |