Module: ShelbyArena::Client::Contribution
- Included in:
- ShelbyArena::Client
- Defined in:
- lib/shelby_arena/resources/contribution.rb
Instance Method Summary collapse
- #create_contribution(batch_id, person_id:, date:, currency_type_id:, transaction_number:, contribution_funds:) ⇒ Object
- #find_contribution(id, options = {}) ⇒ Object
- #find_contributions_by_batch_id(batch_id, options = {}) ⇒ Object
- #list_contributions(options = {}) ⇒ Object
Instance Method Details
#create_contribution(batch_id, person_id:, date:, currency_type_id:, transaction_number:, contribution_funds:) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/shelby_arena/resources/contribution.rb', line 25 def create_contribution( batch_id, person_id:, date:, currency_type_id:, transaction_number:, contribution_funds: ) path = "batch/#{batch_id}/contribution/add" body = { 'BatchId' => batch_id, 'CurrencyAmount' => sum_of_funds(contribution_funds), 'TransactionNumber' => transaction_number, 'ContributionDate' => date, 'CurrencyTypeId' => currency_type_id, 'PersonId' => person_id, 'ContributionFunds' => translate_funds(contribution_funds) } = {} [:api_sig] = generate_api_sig(path, ) res = json_post("#{path}?api_session=#{[:api_session]}&api_sig=#{[:api_sig]}", body.to_json) res.dig('ModifyResult', 'ObjectID') end |
#find_contribution(id, options = {}) ⇒ Object
19 20 21 22 23 |
# File 'lib/shelby_arena/resources/contribution.rb', line 19 def find_contribution(id, = {}) [:api_sig] = generate_api_sig(contribution_path(id), ) res = get(contribution_path(id), .sort) Response::Contribution.format(res.dig('Contribution')) end |
#find_contributions_by_batch_id(batch_id, options = {}) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/shelby_arena/resources/contribution.rb', line 11 def find_contributions_by_batch_id(batch_id, = {}) path = "batch/#{batch_id}/contribution/list" [:api_sig] = generate_api_sig(path, ) res = get(path, .sort) Response::Contribution.format(res.dig('ContributionListResult', 'Contributions', 'Contribution')) end |
#list_contributions(options = {}) ⇒ Object
5 6 7 8 9 |
# File 'lib/shelby_arena/resources/contribution.rb', line 5 def list_contributions( = {}) [:api_sig] = generate_api_sig(contribution_path, ) res = get(contribution_path, .sort) Response::Contribution.format(res.dig('ContributionListResult', 'Contributions', 'Contribution')) end |