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:



150
151
152
# File 'lib/hubspot_sdk/resources/marketing/campaigns/budget.rb', line 150

def initialize(client:)
  @client = client
end

Instance Method Details

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

Add a new budget item to the campaign

Parameters:

  • campaign_guid (String)
  • 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:



27
28
29
30
31
32
33
34
35
36
# File 'lib/hubspot_sdk/resources/marketing/campaigns/budget.rb', line 27

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

Delete a specific budget item by ID

Parameters:

Returns:

  • (nil)

See Also:



85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/hubspot_sdk/resources/marketing/campaigns/budget.rb', line 85

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

Get a specific budget item by ID

Parameters:

Returns:

See Also:



110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/hubspot_sdk/resources/marketing/campaigns/budget.rb', line 110

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

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:

Returns:

See Also:



138
139
140
141
142
143
144
145
# File 'lib/hubspot_sdk/resources/marketing/campaigns/budget.rb', line 138

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

Update a specific budget item by ID

Parameters:

  • budget_id (Integer)

    Path param

  • campaign_guid (String)

    Path param

  • 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:



59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/hubspot_sdk/resources/marketing/campaigns/budget.rb', line 59

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