Module: Constituencies

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

Instance Method Summary collapse

Instance Method Details

#create_constituencies(constituency, id, options = {}) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/tessitura_rest/crm/constituencies.rb', line 8

def create_constituencies(constituency, id, options = {})
  parameters =
    {
      'ConstituencyType': {
        'Id': constituency,
      },
      'Constituent': {
        'Id': id,
      },
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint('CRM/Constituencies'), options)
end

#get_constituencies(id, options = {}) ⇒ Object



2
3
4
5
6
# File 'lib/tessitura_rest/crm/constituencies.rb', line 2

def get_constituencies(id, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  response = self.class.get(base_api_endpoint("CRM/Constituencies?constituentId=#{id}"), options)
  JSON.parse(response.body)
end