Module: Attributes

Included in:
TessituraRest
Defined in:
lib/tessitura_rest/crm/attributes.rb

Instance Method Summary collapse

Instance Method Details

#add_attribute(constituent_id, attribute_id, value, options = {}) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/tessitura_rest/crm/attributes.rb', line 2

def add_attribute(constituent_id, attribute_id, value, options = {})
  parameters =
    {
      'Keyword' => {
        'Id' => attribute_id,
      },
      'Constituent' => {
        'Id' => constituent_id,
      },
      'Value' => value,
      'UpdatedDateTime' => DateTime.now.to_s,
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  response = self.class.post(base_api_endpoint('CRM/Attributes'), options)
  JSON.parse(response.body)
end