Class: ShelbyArena::Response::Contribution

Inherits:
Base
  • Object
show all
Defined in:
lib/shelby_arena/response/contribution.rb

Constant Summary collapse

MAP =
{
  id: 'ContributionId',
  batch_id: 'BatchId',
  amount: 'CurrencyAmount',
  date: 'ContributionDate',
  memo: 'Memo',
  person_id: 'PersonId',
  person: 'PersonInformation',
  transaction_number: 'TransactionNumber',
  currency_type_id: 'CurrencyTypeId',
  currency_type_value: 'CurrencyTypeValue',
  contribution_funds: 'ContributionFunds'
}.freeze

Instance Attribute Summary

Attributes inherited from Base

#data

Instance Method Summary collapse

Methods inherited from Base

#date_parse, #format, format, #format_list, format_list, #initialize, #to_boolean, #to_h

Constructor Details

This class inherits a constructor from ShelbyArena::Response::Base

Instance Method Details

#format_single(data) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/shelby_arena/response/contribution.rb', line 19

def format_single(data)
  response = to_h(MAP, data)
  response[:contribution_funds] = ContributionFund.format(response[:contribution_funds].dig('ContributionFund')) if response[:contribution_funds]
  response[:person] = Person.format(response[:person])
  response[:amount] = response[:amount].to_f
  response
end