Class: HubSpotSDK::Resources::Marketing::Campaigns::Budget

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/marketing/campaigns/budget.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Budget

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

Parameters:



171
172
173
# File 'lib/hubspot_sdk/resources/marketing/campaigns/budget.rb', line 171

def initialize(client:)
  @client = client
end

Instance Method Details

#create(campaign_guid, amount:, name:, order:, description: nil, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::PublicBudgetItem

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

Add a new budget item to the campaign

Parameters:

  • campaign_guid (String)

    The UUID of the campaign, required

  • amount (Float)

    The monetary value assigned to the budget item.

  • name (String)

    The name of the budget item.

  • order (Integer)

    The sequence number indicating the order of the budget item.

  • description (String)

    A detailed explanation or notes about the budget item.

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

Returns:

See Also:



30
31
32
33
34
35
36
37
38
39
# File 'lib/hubspot_sdk/resources/marketing/campaigns/budget.rb', line 30

def create(campaign_guid, params)
  parsed, options = HubSpotSDK::Marketing::Campaigns::BudgetCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["marketing/campaigns/2026-03/%1$s/budget", campaign_guid],
    body: parsed,
    model: HubSpotSDK::Marketing::PublicBudgetItem,
    options: options
  )
end

#delete(budget_id, campaign_guid:, request_options: {}) ⇒ nil

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

Delete a specific budget item by ID

Parameters:

  • budget_id (Integer)

    The ID of the budget item, required. Example: 352

  • campaign_guid (String)

    The UUID of the campaign, required

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

Returns:

  • (nil)

See Also:



96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/hubspot_sdk/resources/marketing/campaigns/budget.rb', line 96

def delete(budget_id, params)
  parsed, options = HubSpotSDK::Marketing::Campaigns::BudgetDeleteParams.dump_request(params)
  campaign_guid =
    parsed.delete(:campaign_guid) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["marketing/campaigns/2026-03/%1$s/budget/%2$s", campaign_guid, budget_id],
    model: NilClass,
    options: options
  )
end

#get(budget_id, campaign_guid:, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::PublicBudgetItem

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

Get a specific budget item by ID

Parameters:

  • budget_id (Integer)

    The ID of the budget item, required. Example: 352

  • campaign_guid (String)

    The UUID of the campaign, required

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

Returns:

See Also:



126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/hubspot_sdk/resources/marketing/campaigns/budget.rb', line 126

def get(budget_id, params)
  parsed, options = HubSpotSDK::Marketing::Campaigns::BudgetGetParams.dump_request(params)
  campaign_guid =
    parsed.delete(:campaign_guid) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["marketing/campaigns/2026-03/%1$s/budget/%2$s", campaign_guid, budget_id],
    model: HubSpotSDK::Marketing::PublicBudgetItem,
    options: options
  )
end

#get_totals(campaign_guid, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::PublicBudgetTotals

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

Retrieve detailed information about the budget and spend items for a specified campaign, including the total budget, total spend, and remaining budget. Budget and Spend items may be returned in any order, but the order field specifies their sequence based on the creation date. The item with order 0 is the oldest, and items with higher order values are newer

Parameters:

  • campaign_guid (String)

    The UUID of the campaign, required

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

Returns:

See Also:



159
160
161
162
163
164
165
166
# File 'lib/hubspot_sdk/resources/marketing/campaigns/budget.rb', line 159

def get_totals(campaign_guid, params = {})
  @client.request(
    method: :get,
    path: ["marketing/campaigns/2026-03/%1$s/budget/totals", campaign_guid],
    model: HubSpotSDK::Marketing::PublicBudgetTotals,
    options: params[:request_options]
  )
end

#update(budget_id, campaign_guid:, amount:, name:, order:, description: nil, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::PublicBudgetItem

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

Update a specific budget item by ID

Parameters:

  • budget_id (Integer)

    Path param: The ID of the budget item, required. Example: 352

  • campaign_guid (String)

    Path param: The UUID of the campaign, required

  • amount (Float)

    Body param: The monetary value assigned to the budget item.

  • name (String)

    Body param: The name of the budget item.

  • order (Integer)

    Body param: The sequence number indicating the order of the budget item.

  • description (String)

    Body param: A detailed explanation or notes about the budget item.

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

Returns:

See Also:



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/hubspot_sdk/resources/marketing/campaigns/budget.rb', line 65

def update(budget_id, params)
  parsed, options = HubSpotSDK::Marketing::Campaigns::BudgetUpdateParams.dump_request(params)
  campaign_guid =
    parsed.delete(:campaign_guid) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :put,
    path: ["marketing/campaigns/2026-03/%1$s/budget/%2$s", campaign_guid, budget_id],
    body: parsed,
    model: HubSpotSDK::Marketing::PublicBudgetItem,
    options: options
  )
end