Module: Fellowshipone::Client::Contribution
- Included in:
- Fellowshipone::Client
- Defined in:
- lib/fellowshipone/resources/contribution.rb
Instance Method Summary collapse
- #create_contribution(contribution_params) ⇒ Object
- #get_contribution(contribution_id) ⇒ Object
- #new_contribution ⇒ Object
-
#search_contributions(individual_id: nil, household_id: nil, start_date: nil, end_date: nil, page: 1) ⇒ Object
startReceivedDate, endReceivedDate, page, individualID, householdID, recordsPerPage.
- #update_contribution(contribution_id, contribution_params) ⇒ Object
Instance Method Details
#create_contribution(contribution_params) ⇒ Object
13 14 15 |
# File 'lib/fellowshipone/resources/contribution.rb', line 13 def create_contribution(contribution_params) post("/giving/v1/contributionreceipts.json", contribution_params) end |
#get_contribution(contribution_id) ⇒ Object
5 6 7 |
# File 'lib/fellowshipone/resources/contribution.rb', line 5 def get_contribution(contribution_id) get("/giving/v1/contributionreceipts/#{contribution_id}.json") end |
#new_contribution ⇒ Object
9 10 11 |
# File 'lib/fellowshipone/resources/contribution.rb', line 9 def new_contribution get("/giving/v1/contributionreceipts/new.json") end |
#search_contributions(individual_id: nil, household_id: nil, start_date: nil, end_date: nil, page: 1) ⇒ Object
startReceivedDate, endReceivedDate, page, individualID, householdID, recordsPerPage
22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/fellowshipone/resources/contribution.rb', line 22 def search_contributions(individual_id: nil, household_id: nil, start_date: nil, end_date: nil, page: 1) = {recordsPerPage: 500} .merge!(page: page) if page .merge!(individualID: individual_id) if individual_id .merge!(householdID: household_id) if household_id .merge!(startReceivedDate: start_date) if start_date .merge!(endReceivedDate: end_date) if end_date params = Addressable::URI.form_encode() response = get("/giving/v1/contributionreceipts/search.json?#{params}").results Fellowshipone::Contribution.format(response) end |
#update_contribution(contribution_id, contribution_params) ⇒ Object
17 18 19 |
# File 'lib/fellowshipone/resources/contribution.rb', line 17 def update_contribution(contribution_id, contribution_params) put("/giving/v1/contributionreceipts/#{contribution_id}.json", contribution_params) end |