Class: PersonaApi::AccountsResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/persona_api/resources/accounts.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_tag(act_id:, **attributes) ⇒ Object



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

def add_tag(act_id:, **attributes)
  post_request("accounts/#{act_id}/add-tag", body: attributes)
  true
end

#consolidate_accounts(act_id:, **attributes) ⇒ Object



8
9
10
# File 'lib/persona_api/resources/accounts.rb', line 8

def consolidate_accounts(act_id:, **attributes)
  post_request("accounts/#{act_id}/consolidate", body: attributes).body.dig("data")
end

#create(**attributes) ⇒ Object



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

def create(**attributes)
  Account.new post_request("accounts", body: attributes).body.dig("data")
end

#list(**params) ⇒ Object



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

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

#redact(act_id:) ⇒ Object



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

def redact(act_id:)
  delete_request("accounts/#{act_id}")
end

#remove_tag(act_id:, **attributes) ⇒ Object



28
29
30
31
# File 'lib/persona_api/resources/accounts.rb', line 28

def remove_tag(act_id:, **attributes)
  post_request("accounts/#{act_id}/remove-tag", body: attributes)
  true
end

#retrieve(act_id:) ⇒ Object



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

def retrieve(act_id:)
  Account.new get_request("accounts/#{act_id}").body.dig("data")
end

#set_all_tags(act_id:, **attributes) ⇒ Object



33
34
35
36
# File 'lib/persona_api/resources/accounts.rb', line 33

def set_all_tags(act_id:, **attributes)
  post_request("accounts/#{act_id}/set-tags", body: attributes)
  true
end

#update(act_id:, **attributes) ⇒ Object



38
39
40
# File 'lib/persona_api/resources/accounts.rb', line 38

def update(act_id:, **attributes)
  patch_request("accounts/#{act_id}", body: attributes).body.dig("data")
end