Class: FellowshipOne::CommunicationWriter

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

Constructor. Note: writer will get data after it has been mapped to the FellowshipOne resource so the hash keys will be the same as FellowshipOne



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

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

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

  @updatable_fields = []
end