Class: FellowshipOne::PersonWriter

Inherits:
ApiWriter
  • Object
show all
Defined in:
lib/writers/person_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) ⇒ PersonWriter

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
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
51
52
53
54
55
56
57
58
59
60
# File 'lib/writers/person_writer.rb', line 8

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

  @url_data_params = {'person' => data}

  @updatable_fields = [:title,
                       :salutation,
                       :prefix,
                       :first_name, 
                       :last_name,  #required
                       :suffix,
                       :middle_name,
                       :goes_by_name,
                       :former_name,
                       :gender,
                       :date_of_birth,
                       :marital_status,
                       :household_member_type, #required
                       :is_authorized,
                       :status, #required
                       :occupation,
                       :employer,
                       :school,
                       :denomination,
                       :former_church,
                       :bar_code,
                       :member_envelope_code,
                       :default_tag_comment,
                       :weblink,
                       :solicit,
                       :thank,
                       :first_record,
                       :last_match_date,
                       :created_date,
                       :last_updated_date,
                       :id,
                       :uri,
                       :image_uri,
                       :old_id,
                       :i_code,
                       :household_id, #required
                       :old_household_id,
                       :attributes,
                       :addresses,
                       :communications]
end