Class: PersonaApi::CasesResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/persona_api/resources/cases.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#delete_request, #get_request, #handle_response, #initialize, #patch_request, #post_request, #put_request

Constructor Details

This class inherits a constructor from PersonaApi::Resource

Instance Method Details

#add_persona_objects(case_id:, **attributes) ⇒ Object



3
4
5
# File 'lib/persona_api/resources/cases.rb', line 3

def add_persona_objects(case_id:, **attributes)
  Case.new post_request("cases/#{case_id}/add-objects", body: attributes).body.dig("data")
end

#assign(case_id:, **attributes) ⇒ Object



7
8
9
# File 'lib/persona_api/resources/cases.rb', line 7

def assign(case_id:, **attributes)
  Case.new post_request("cases/#{case_id}/assign", body: attributes).body.dig("data")
end

#create(**attributes) ⇒ Object



11
12
13
14
# File 'lib/persona_api/resources/cases.rb', line 11

def create(**attributes)
  # cases attributes must include the 'case-template-id'
  Case.new post_request("cases", body: attributes).body
end

#list(**params) ⇒ Object



16
17
18
# File 'lib/persona_api/resources/cases.rb', line 16

def list(**params)
  Collection.from_response get_request("cases", params: params), key: "data", type: Case
end

#retrieve(case_id:) ⇒ Object



20
21
22
# File 'lib/persona_api/resources/cases.rb', line 20

def retrieve(case_id:)
  Case.new get_request("cases/#{case_id}").body
end

#set_status(case_id:, **attributes) ⇒ Object



24
25
26
# File 'lib/persona_api/resources/cases.rb', line 24

def set_status(case_id:, **attributes)
  Case.new post_request("cases/#{case_id}/set-status", body: attributes).body.dig("data")
end