Class: HubSpotSDK::Resources::Marketing::Campaigns::Batch

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/marketing/campaigns/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:



133
134
135
# File 'lib/hubspot_sdk/resources/marketing/campaigns/batch.rb', line 133

def initialize(client:)
  @client = client
end

Instance Method Details

#create(inputs:, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::BatchResponsePublicCampaign

Some parameter documentations has been truncated, see Models::Marketing::Campaigns::BatchCreateParams for more details.

This endpoint creates a batch of campaigns. The maximum number of items in a batch request is 50. The campaigns in the response are not guaranteed to be in the same order as they were provided in the request.

Parameters:

Returns:

See Also:



24
25
26
27
28
29
30
31
32
33
# File 'lib/hubspot_sdk/resources/marketing/campaigns/batch.rb', line 24

def create(params)
  parsed, options = HubSpotSDK::Marketing::Campaigns::BatchCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "marketing/campaigns/2026-03/batch/create",
    body: parsed,
    model: HubSpotSDK::Marketing::BatchResponsePublicCampaign,
    options: options
  )
end

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

Some parameter documentations has been truncated, see Models::Marketing::Campaigns::BatchDeleteParams for more details.

This endpoint deletes a batch of campaigns. The maximum number of items in a batch request is 50. The response will always be 204 No Content, regardless of whether the campaigns exist or not, whether they were successfully deleted or not, or if only some of the campaigns in the batch were deleted.

Parameters:

Returns:

  • (nil)

See Also:



80
81
82
83
84
85
86
87
88
89
# File 'lib/hubspot_sdk/resources/marketing/campaigns/batch.rb', line 80

def delete(params)
  parsed, options = HubSpotSDK::Marketing::Campaigns::BatchDeleteParams.dump_request(params)
  @client.request(
    method: :post,
    path: "marketing/campaigns/2026-03/batch/archive",
    body: parsed,
    model: NilClass,
    options: options
  )
end

#get(inputs:, end_date: nil, properties: nil, start_date: nil, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::BatchResponsePublicCampaignWithAssets

Some parameter documentations has been truncated, see Models::Marketing::Campaigns::BatchGetParams for more details.

This endpoint reads a batch of campaigns based on the provided input data and returns the campaigns along with their associated assets. The maximum number of items in a batch request is 50. The campaigns in the response are not guaranteed to be in the same order as they were provided in the request. If duplicate campaign IDs are provided in the request, duplicates will be ignored. The response will include only unique IDs and will be returned without duplicates.

Parameters:

Returns:

See Also:



116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/hubspot_sdk/resources/marketing/campaigns/batch.rb', line 116

def get(params)
  query_params = [:end_date, :properties, :start_date]
  parsed, options = HubSpotSDK::Marketing::Campaigns::BatchGetParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :post,
    path: "marketing/campaigns/2026-03/batch/read",
    query: query.transform_keys(end_date: "endDate", start_date: "startDate"),
    body: parsed.except(*query_params),
    model: HubSpotSDK::Marketing::BatchResponsePublicCampaignWithAssets,
    options: options
  )
end

#update(inputs:, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::BatchResponsePublicCampaign

Some parameter documentations has been truncated, see Models::Marketing::Campaigns::BatchUpdateParams for more details.

This endpoint updates a batch of campaigns based on the provided input data. The maximum number of items in a batch request is 50. If an empty string (“”) is passed for any property in the Batch Update, it will reset that property’s value.

Parameters:

Returns:

See Also:



52
53
54
55
56
57
58
59
60
61
# File 'lib/hubspot_sdk/resources/marketing/campaigns/batch.rb', line 52

def update(params)
  parsed, options = HubSpotSDK::Marketing::Campaigns::BatchUpdateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "marketing/campaigns/2026-03/batch/update",
    body: parsed,
    model: HubSpotSDK::Marketing::BatchResponsePublicCampaign,
    options: options
  )
end