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:



183
184
185
# File 'lib/hubspot_sdk/resources/crm/associations/batch.rb', line 183

def initialize(client:)
  @client = client
end

Instance Method Details

#create(to_object_id, from_object_type:, from_object_id:, to_object_type:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::BatchResponsePublicDefaultAssociation

Parameters:

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

Returns:

See Also:



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/hubspot_sdk/resources/crm/associations/batch.rb', line 19

def create(to_object_id, 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
  from_object_id =
    parsed.delete(:from_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/default/%3$s/%4$s",
      from_object_type,
      from_object_id,
      to_object_type,
      to_object_id
    ],
    model: HubSpotSDK::Crm::BatchResponsePublicDefaultAssociation,
    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:



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/hubspot_sdk/resources/crm/associations/batch.rb', line 92

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:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/hubspot_sdk/resources/crm/associations/batch.rb', line 62

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:



127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/hubspot_sdk/resources/crm/associations/batch.rb', line 127

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:



165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/hubspot_sdk/resources/crm/associations/batch.rb', line 165

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