Class: HubSpotSDK::Resources::Crm::Associations

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/crm/associations.rb,
lib/hubspot_sdk/resources/crm/associations/batch.rb

Defined Under Namespace

Classes: Batch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Associations

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Associations.

Parameters:



199
200
201
202
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 199

def initialize(client:)
  @client = client
  @batch = HubSpotSDK::Resources::Crm::Associations::Batch.new(client: client)
end

Instance Attribute Details

#batchHubSpotSDK::Resources::Crm::Associations::Batch (readonly)



8
9
10
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 8

def batch
  @batch
end

Instance Method Details

#delete(to_object_id, object_type:, object_id_:, to_object_type:, request_options: {}) ⇒ nil

Parameters:

  • to_object_id (String)
  • object_type (String)
  • object_id_ (String)
  • to_object_type (String)
  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 70

def delete(to_object_id, params)
  parsed, options = HubSpotSDK::Crm::AssociationDeleteParams.dump_request(params)
  object_type =
    parsed.delete(:object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  object_id_ =
    parsed.delete(:object_id_) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  to_object_type =
    parsed.delete(:to_object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: [
      "crm/objects/2026-03/%1$s/%2$s/associations/%3$s/%4$s",
      object_type,
      object_id_,
      to_object_type,
      to_object_id
    ],
    model: NilClass,
    options: options
  )
end

#list(to_object_type, object_type:, object_id_:, after: nil, limit: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Crm::MultiAssociatedObjectWithLabel>

Some parameter documentations has been truncated, see Models::Crm::AssociationListParams for more details.

Retrieve all associations between a specific record and an object type. Limit 500 per call.

Parameters:

  • to_object_type (String)

    Path param

  • object_type (String)

    Path param

  • object_id_ (String)

    Path param

  • after (String)

    Query param: The paging cursor token of the last successfully read resource will

  • limit (Integer)

    Query param: The maximum number of results to display per page.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 33

def list(to_object_type, params)
  parsed, options = HubSpotSDK::Crm::AssociationListParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  object_type =
    parsed.delete(:object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  object_id_ =
    parsed.delete(:object_id_) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: [
      "crm/objects/2026-03/%1$s/%2$s/associations/%3$s",
      object_type,
      object_id_,
      to_object_type
    ],
    query: query,
    page: HubSpotSDK::Internal::Page,
    model: HubSpotSDK::Crm::MultiAssociatedObjectWithLabel,
    options: options
  )
end

#request_high_usage_report(user_id, request_options: {}) ⇒ HubSpotSDK::Models::Crm::ReportCreationResponse

Requests a report of all objects in the portal which have a high usage of associations

Parameters:

Returns:

See Also:



109
110
111
112
113
114
115
116
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 109

def request_high_usage_report(user_id, params = {})
  @client.request(
    method: :post,
    path: ["crm/associations/2026-03/usage/high-usage-report/%1$s", user_id],
    model: HubSpotSDK::Crm::ReportCreationResponse,
    options: params[:request_options]
  )
end

#search(object_type, after:, filter_groups:, limit:, properties:, sorts:, query: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::CollectionResponseWithTotalSimplePublicObject

Parameters:

  • object_type (String)
  • after (String)

    A paging cursor token for retrieving subsequent pages.

  • filter_groups (Array<HubSpotSDK::Models::Crm::FilterGroup>)

    Up to 6 groups of filters defining additional query criteria.

  • limit (Integer)

    The maximum results to return, up to 200 objects.

  • properties (Array<String>)

    A list of property names to include in the response.

  • sorts (Array<String>)

    Specifies sorting order based on object properties.

  • query (String)

    The search query string, up to 3000 characters.

  • request_options (HubSpotSDK::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



139
140
141
142
143
144
145
146
147
148
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 139

def search(object_type, params)
  parsed, options = HubSpotSDK::Crm::AssociationSearchParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["crm/objects/2026-03/%1$s/search", object_type],
    body: parsed,
    model: HubSpotSDK::Crm::CollectionResponseWithTotalSimplePublicObject,
    options: options
  )
end

#update_association_labels(to_object_id, object_type:, object_id_:, to_object_type:, body:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::LabelsBetweenObjectPair

Parameters:

Returns:

See Also:



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 167

def update_association_labels(to_object_id, params)
  parsed, options = HubSpotSDK::Crm::AssociationUpdateAssociationLabelsParams.dump_request(params)
  object_type =
    parsed.delete(:object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  object_id_ =
    parsed.delete(:object_id_) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  to_object_type =
    parsed.delete(:to_object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :put,
    path: [
      "crm/objects/2026-03/%1$s/%2$s/associations/%3$s/%4$s",
      object_type,
      object_id_,
      to_object_type,
      to_object_id
    ],
    body: parsed[:body],
    model: HubSpotSDK::Crm::LabelsBetweenObjectPair,
    options: options
  )
end