Module: KindridClient::Donation

Included in:
Client
Defined in:
lib/kindrid_client/client/donation.rb

Instance Method Summary collapse

Instance Method Details

#donation(id, options = {}) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/kindrid_client/client/donation.rb', line 18

def donation(id, options={})
  params = {}
  params.merge!(options)

  # clear empty key/value pairs
  params.reject! { |key, value| value.nil? }

  get("donations/#{id}", params).results.first 
end

#donations(donor_id = nil, options = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/kindrid_client/client/donation.rb', line 4

def donations(donor_id = nil, options={})
  params = {}
  params.merge!(options)

  # clear empty key/value pairs
  params.reject! { |key, value| value.nil? }
  
  if donor_id.blank?
    get("donations", params).results
  else
    get("donors/#{donor_id}/donations", params).results
  end
end