Module: Issues

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

Instance Method Summary collapse

Instance Method Details

#create_issue(activity_type, category_id, constituent_id, contact_type, notes, origin_id, options = {}) ⇒ Object



7
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
# File 'lib/tessitura_rest/crm/issues.rb', line 7

def create_issue(activity_type, category_id, constituent_id, contact_type, notes, origin_id, options = {})
  parameters =
    {
      'ActivityType': {
        'Id': activity_type,
        'Category': {
          'Id': category_id,
        },
      },
      'ContactType': {
        'Id': contact_type,
      },
      'Constituent': {
        'Id': constituent_id,
      },
      'Origin': {
        'Id': origin_id,
      },
      'Notes': notes,
    }
  parameters.delete(:Origin) unless origin_id.present?
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  response = self.class.post(base_api_endpoint('CRM/Issues'), options)
  JSON.parse(response.body)
end

#create_issue_step(constituent_id, issue_id, options = {}) ⇒ Object



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
# File 'lib/tessitura_rest/crm/issues.rb', line 34

def create_issue_step(constituent_id, issue_id, options = {})
  parameters =
    {
      'Issue': {
        'Id': issue_id,
      },
      'Constituent': {
        'Id': constituent_id,
      },
      'Type': {
        'Id': 330,
      },
      'Priority': {
        'Id': 2,
      },
      'Recurrence': 'N',
      'Description': 'Email Sent',
      'StepDateTime': DateTime.now.strftime('%m/%d/%Y %H:%M:%S'),
      'CompletedOnDateTime': DateTime.now.strftime('%m/%d/%Y %H:%M:%S'),
      'Notes': "See Email for IsAc_no: #{issue_id}",
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.post(base_api_endpoint('CRM/IssueSteps'), options)
end

#get_issue(issue_id, options = {}) ⇒ Object



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

def get_issue(issue_id, options = {})
  options.merge!(basic_auth: @auth, headers: @headers)
  self.class.get(base_api_endpoint("CRM/Issues/#{issue_id}"), options)
end

#update_issue(issue_id, is_closed, activity_type, category_id, contact_type, constituent_id, updated_datetime, notes, options = {}) ⇒ Object



60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/tessitura_rest/crm/issues.rb', line 60

def update_issue(issue_id, is_closed, activity_type, category_id, contact_type, constituent_id, updated_datetime, notes, options = {})
  parameters =
    {
      'Id': issue_id,
      'IsClosed': is_closed,
      'UpdatedDateTime': updated_datetime,
      'Notes': notes,
      'ActivityType': {
        'Id': activity_type,
        'Category': {
          'Id': category_id,
        },
      },
      'ContactType': {
        'Id': contact_type,
      },
      'Constituent': {
        'Id': constituent_id,
      },
    }
  options.merge!(basic_auth: @auth, headers: @headers)
  options.merge!(:body => parameters.to_json)
  self.class.put(base_api_endpoint("CRM/Issues/#{issue_id}"), options)
end