Class: FellowshipOne::ContributionWriter

Inherits:
ApiWriter
  • Object
show all
Defined in:
lib/writers/contribution_writer.rb

Instance Attribute Summary

Attributes inherited from ApiWriter

#error_messages, #response_code

Instance Method Summary collapse

Methods inherited from ApiWriter

#delete_object, #save_object

Constructor Details

#initialize(data) ⇒ ContributionWriter

Constructor.

Parameters:

  • data

    The json object data to save.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/writers/contribution_writer.rb', line 8

def initialize(data)
  if data[:id]
    @url_action = :put
    @url_data_path = "/giving/v1/contributionreceipts/#{data[:id]}"
  else
    @url_action = :post
    @url_data_path = "/giving/v1/contributionreceipts"
  end
  @url_data_delete_path = "/giving/v1/contributionreceipts/#{data[:id]}"

  @url_data_params = @url_data_params = {:contributionReceipt => data}

  @updatable_fields = [:amount,
                       :fund,              #required
                       :received_date,     #required
                       :contribution_type, #required
                       :memo] 
end