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

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Batch

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 Batch.

Parameters:



174
175
176
# File 'lib/hubspot_sdk/resources/crm/associations/batch.rb', line 174

def initialize(client:)
  @client = client
end

Instance Method Details

#create(to_object_type, from_object_type:, inputs:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::BatchResponseLabelsBetweenObjectPair

Batch create associations for objects

Parameters:

Returns:

See Also:



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/hubspot_sdk/resources/crm/associations/batch.rb', line 23

def create(to_object_type, params)
  parsed, options = HubSpotSDK::Crm::Associations::BatchCreateParams.dump_request(params)
  from_object_type =
    parsed.delete(:from_object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["crm/associations/2026-03/%1$s/%2$s/batch/create", from_object_type, to_object_type],
    body: parsed,
    model: HubSpotSDK::Crm::BatchResponseLabelsBetweenObjectPair,
    options: options
  )
end

#create_default(to_object_type, from_object_type:, inputs:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::BatchResponsePublicDefaultAssociation

Create the default (most generic) association type between two object types

Parameters:

Returns:

See Also:



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/hubspot_sdk/resources/crm/associations/batch.rb', line 83

def create_default(to_object_type, params)
  parsed, options = HubSpotSDK::Crm::Associations::BatchCreateDefaultParams.dump_request(params)
  from_object_type =
    parsed.delete(:from_object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: [
      "crm/associations/2026-03/%1$s/%2$s/batch/associate/default",
      from_object_type,
      to_object_type
    ],
    body: parsed,
    model: HubSpotSDK::Crm::BatchResponsePublicDefaultAssociation,
    options: options
  )
end

#delete(to_object_type, from_object_type:, inputs:, request_options: {}) ⇒ nil

Batch delete associations for objects

Parameters:

Returns:

  • (nil)

See Also:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/hubspot_sdk/resources/crm/associations/batch.rb', line 53

def delete(to_object_type, params)
  parsed, options = HubSpotSDK::Crm::Associations::BatchDeleteParams.dump_request(params)
  from_object_type =
    parsed.delete(:from_object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["crm/associations/2026-03/%1$s/%2$s/batch/archive", from_object_type, to_object_type],
    body: parsed,
    model: NilClass,
    options: options
  )
end

#delete_labels(to_object_type, from_object_type:, inputs:, request_options: {}) ⇒ nil

Batch delete specific association labels for objects. Deleting an unlabeled association will also delete all labeled associations between those two objects

Parameters:

Returns:

  • (nil)

See Also:



118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# File 'lib/hubspot_sdk/resources/crm/associations/batch.rb', line 118

def delete_labels(to_object_type, params)
  parsed, options = HubSpotSDK::Crm::Associations::BatchDeleteLabelsParams.dump_request(params)
  from_object_type =
    parsed.delete(:from_object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: [
      "crm/associations/2026-03/%1$s/%2$s/batch/labels/archive",
      from_object_type,
      to_object_type
    ],
    body: parsed,
    model: NilClass,
    options: options
  )
end

#get(to_object_type, from_object_type:, inputs:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::BatchResponsePublicAssociationMultiWithLabel

Batch read associations for objects to specific object type. The ‘after’ field in a returned paging object can be added alongside the ‘id’ to retrieve the next page of associations from that objectId. The ‘link’ field is deprecated and should be ignored. Note: The ‘paging’ field will only be present if there are more pages and absent otherwise.

Parameters:

Returns:

See Also:



156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/hubspot_sdk/resources/crm/associations/batch.rb', line 156

def get(to_object_type, params)
  parsed, options = HubSpotSDK::Crm::Associations::BatchGetParams.dump_request(params)
  from_object_type =
    parsed.delete(:from_object_type) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["crm/associations/2026-03/%1$s/%2$s/batch/read", from_object_type, to_object_type],
    body: parsed,
    model: HubSpotSDK::Crm::BatchResponsePublicAssociationMultiWithLabel,
    options: options
  )
end