Sha256: 1e68771a874bff73c3e624cbfb9a6c2ac913490627373c8b7f39a43ac5249784

Contents?: true

Size: 1.7 KB

Versions: 6

Compression:

Stored size: 1.7 KB

Contents

module FellowshipOne

  class ContributionListReader < ApiReader

    # Constructor.
    #
    # Options:
    # :page - (optional) The page number to get.  The default is 1.
    # :per_page - (optional) The number of items to return per page.
    # :individual_id - (optional) search for receipts containing the individualID that is passed with this parameter.
    # :household_id - (optional) search for receipts containing the householdID that is passed with this parameter.
    # :start_date - (optional) search for receipts with a received date greater than or equal to this parameter.
    # :end_date - (optional) search for receipts with a received date less than or equal to this parameter. Must be used in conjunction with startReceivedDate.
    def initialize(options = {})
      page = options[:page] || 1
      per_page = options[:per_page] || 500

      @url_data_params = {}
      @url_data_path = '/giving/v1/contributionreceipts/search'
      if options[:household_id].nil? and
         options[:individual_id].nil? and 
         options[:start_date].nil? and 
         options[:end_date].nil? 
          @url_data_path = '/giving/v1/contributionreceipts'
      end
            
      @url_data_params.merge!({:page => page}) if page
      @url_data_params.merge!({:recordsPerPage => per_page}) if per_page      
      @url_data_params.merge!({:individualID => options[:individual_id]}) if options[:individual_id]
      @url_data_params.merge!({:householdID => options[:household_id]}) if options[:household_id]
      @url_data_params.merge!({:startReceivedDate => options[:start_date]}) if options[:start_date]
      @url_data_params.merge!({:endReceivedDate => options[:end_date]}) if options[:end_date]
    end

  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fellowshipone-api-0.9.0 lib/readers/contribution_list_reader.rb
fellowshipone-api-0.8.0 lib/readers/contribution_list_reader.rb
fellowshipone-api-0.7.0 lib/readers/contribution_list_reader.rb
fellowshipone-api-0.6.4 lib/readers/contribution_list_reader.rb
fellowshipone-api-0.6.3 lib/readers/contribution_list_reader.rb
fellowshipone-api-0.6.2 lib/readers/contribution_list_reader.rb