Class: HighLevel::Resources::Associations

Inherits:
Base
  • Object
show all
Defined in:
lib/high_level/resources/associations.rb

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from HighLevel::Resources::Base

Instance Method Details

#create_association(body:, **_opts) ⇒ Object

Create Association

Allow you to create contact - contact , contact - custom objects associations, will add more in the future.Documentation Link - doc.clickup.com/8631005/d/h/87cpx-293776/cd0f4122abc04d3



116
117
118
119
120
121
122
123
# File 'lib/high_level/resources/associations.rb', line 116

def create_association(body:, **_opts)
  request(
    method: :post,
    path: "/associations/",
    security: ["bearer"],
    body: body
  )
end

#create_relation(body:, **_opts) ⇒ Object

Create Relation for you associated entities.

Create Relation.Documentation Link - doc.clickup.com/8631005/d/h/87cpx-293776/cd0f4122abc04d3



12
13
14
15
16
17
18
19
# File 'lib/high_level/resources/associations.rb', line 12

def create_relation(body:, **_opts)
  request(
    method: :post,
    path: "/associations/relations",
    security: ["bearer"],
    body: body
  )
end

#delete_association(association_id:, **_opts) ⇒ Object

Delete Association

Delete USER_DEFINED Association By Id, deleting an association will also all the relations for that association



93
94
95
96
97
98
99
# File 'lib/high_level/resources/associations.rb', line 93

def delete_association(association_id:, **_opts)
  request(
    method: :delete,
    path: "/associations/#{association_id}",
    security: ["bearer"]
  )
end

#delete_relation(relation_id:, location_id: nil, **_opts) ⇒ Object

Delete Relation



34
35
36
37
38
39
40
41
# File 'lib/high_level/resources/associations.rb', line 34

def delete_relation(relation_id:, location_id: nil, **_opts)
  request(
    method: :delete,
    path: "/associations/relations/#{relation_id}",
    security: ["bearer"],
    params: { "locationId" => location_id }.compact
  )
end

#find_associations(location_id: nil, skip: nil, limit: nil, **_opts) ⇒ Object

Get all associations for a sub-account / location

Get all Associations



104
105
106
107
108
109
110
111
# File 'lib/high_level/resources/associations.rb', line 104

def find_associations(location_id: nil, skip: nil, limit: nil, **_opts)
  request(
    method: :get,
    path: "/associations/",
    security: ["bearer"],
    params: { "locationId" => location_id, "skip" => skip, "limit" => limit }.compact
  )
end

#get_association_by_id(association_id:, **_opts) ⇒ Object

Get association by ID

Using this api you can get SYSTEM_DEFINED / USER_DEFINED association by id



70
71
72
73
74
75
76
# File 'lib/high_level/resources/associations.rb', line 70

def get_association_by_id(association_id:, **_opts)
  request(
    method: :get,
    path: "/associations/#{association_id}",
    security: ["bearer"]
  )
end

#get_association_by_object_keys(object_key:, location_id: nil, **_opts) ⇒ Object

Get association by object keys

Get association by object keys like contacts, custom objects and opportunities. Documentation Link - doc.clickup.com/8631005/d/h/87cpx-293776/cd0f4122abc04d3



58
59
60
61
62
63
64
65
# File 'lib/high_level/resources/associations.rb', line 58

def get_association_by_object_keys(object_key:, location_id: nil, **_opts)
  request(
    method: :get,
    path: "/associations/objectKey/#{object_key}",
    security: ["bearer"],
    params: { "locationId" => location_id }.compact
  )
end

#get_association_key_by_key_name(key_name:, location_id: nil, **_opts) ⇒ Object

Get association key by key name

Using this api you can get standard / user defined association by key



46
47
48
49
50
51
52
53
# File 'lib/high_level/resources/associations.rb', line 46

def get_association_key_by_key_name(key_name:, location_id: nil, **_opts)
  request(
    method: :get,
    path: "/associations/key/#{key_name}",
    security: ["bearer"],
    params: { "locationId" => location_id }.compact
  )
end

#get_relations_by_record_id(record_id:, location_id: nil, skip: nil, limit: nil, association_ids: nil, **_opts) ⇒ Object

Get all relations By record Id

Get all relations by record Id



24
25
26
27
28
29
30
31
# File 'lib/high_level/resources/associations.rb', line 24

def get_relations_by_record_id(record_id:, location_id: nil, skip: nil, limit: nil, association_ids: nil, **_opts)
  request(
    method: :get,
    path: "/associations/relations/#{record_id}",
    security: ["bearer"],
    params: { "locationId" => location_id, "skip" => skip, "limit" => limit, "associationIds" => association_ids }.compact
  )
end

#update_association(association_id:, body:, **_opts) ⇒ Object

Update Association By Id

Update Association , Allows you to update labels of an associations. Documentation Link - doc.clickup.com/8631005/d/h/87cpx-293776/cd0f4122abc04d3



81
82
83
84
85
86
87
88
# File 'lib/high_level/resources/associations.rb', line 81

def update_association(association_id:, body:, **_opts)
  request(
    method: :put,
    path: "/associations/#{association_id}",
    security: ["bearer"],
    body: body
  )
end