Class: TheCity::UserWriter

Inherits:
ApiWriter show all
Defined in:
lib/writers/user_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) ⇒ UserWriter

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
# File 'lib/writers/user_writer.rb', line 8

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

  @url_data_params = data

  @updatable_fields = [:title,
                       :first,
                       :middle,
                       :last,
                       :nickname,
                       :gender,
                       :email,
                       :staff,
                       :primary_campus_id,
                       :member_since,
                       :birthdate,
                       :primary_phone,
                       :primary_phone_type,
                       :secondary_phone,
                       :secondary_phone_type,
                       :external_id_1,
                       :external_id_2,
                       :external_id_3,
                       :marital_status,
                       :is_an_organization]      
end