Module: Desk::Client::Case

Included in:
Desk::Client
Defined in:
lib/desk/client/case.rb

Overview

Defines methods related to cases

Instance Method Summary collapse

Instance Method Details

#case_endpointsObject



6
7
8
9
10
11
12
13
# File 'lib/desk/client/case.rb', line 6

def case_endpoints
  [ :list, :search, :create, :update, :delete,
    :list_replies, :show_reply, :create_reply, :update_reply,
    :list_notes, :show_note, :create_note,
    :list_attachments, :show_attachment, :create_attachment, :delete_attachment,
    :list_history
  ]
end

#case_url(case_id) ⇒ Object



67
68
69
# File 'lib/desk/client/case.rb', line 67

def case_url(case_id)
  "https://#{subdomain}.#{domain}/agent/case/#{case_id}"
end

#create_case_message_attachment(case_id, *args) ⇒ Object



49
50
51
52
# File 'lib/desk/client/case.rb', line 49

def create_case_message_attachment(case_id, *args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  post("cases/#{case_id}/message/attachments", options)
end

#create_case_reply_attachment(case_id, reply_id, *args) ⇒ Object



54
55
56
57
# File 'lib/desk/client/case.rb', line 54

def create_case_reply_attachment(case_id, reply_id, *args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  post("cases/#{case_id}/replies/#{reply_id}/attachments", options)
end

#delete_case_message_attachment(case_id, attachment_id) ⇒ Object



59
60
61
# File 'lib/desk/client/case.rb', line 59

def delete_case_message_attachment(case_id, attachment_id)
  delete("cases/#{case_id}/message/attachments/#{attachment_id}")
end

#delete_case_reply_attachment(case_id, reply_id, attachment_id) ⇒ Object



63
64
65
# File 'lib/desk/client/case.rb', line 63

def delete_case_reply_attachment(case_id, reply_id, attachment_id)
  delete("cases/#{case_id}/replies/#{reply_id}/attachments/#{attachment_id}")
end

#list_case_message_attachments(case_id, *args) ⇒ Object Also known as: case_message_attachments



27
28
29
30
# File 'lib/desk/client/case.rb', line 27

def list_case_message_attachments(case_id, *args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  get("cases/#{case_id}/message/attachments", options)
end

#list_case_reply_attachments(case_id, reply_id, *args) ⇒ Object Also known as: case_reply_attachments



33
34
35
36
# File 'lib/desk/client/case.rb', line 33

def list_case_reply_attachments(case_id, reply_id, *args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  get("cases/#{case_id}/replies/#{reply_id}/attachments", options)
end

#show_case(case_id, *args) ⇒ Object Also known as: case



15
16
17
18
19
# File 'lib/desk/client/case.rb', line 15

def show_case(case_id, *args)
  options = args.last.is_a?(Hash) ? args.pop : {}
  case_id = "e-#{case_id}" if options[:by] == "external_id"
  get("cases/#{case_id}")
end

#show_case_message(case_id) ⇒ Object Also known as: case_message



22
23
24
# File 'lib/desk/client/case.rb', line 22

def show_case_message(case_id)
  get("cases/#{case_id}/message")
end

#show_case_message_attachment(case_id, attachment_id) ⇒ Object Also known as: case_message_attachment



39
40
41
# File 'lib/desk/client/case.rb', line 39

def show_case_message_attachment(case_id, attachment_id)
  get("cases/#{case_id}/message/attachments/#{attachment_id}")
end

#show_case_reply_attachment(case_id, reply_id, attachment_id) ⇒ Object Also known as: case_reply_attachment



44
45
46
# File 'lib/desk/client/case.rb', line 44

def show_case_reply_attachment(case_id, reply_id, attachment_id)
  get("cases/#{case_id}/replies/#{reply_id}/attachments/#{attachment_id}")
end