Class: HubSpotSDK::Resources::Marketing::Campaigns
- Inherits:
-
Object
- Object
- HubSpotSDK::Resources::Marketing::Campaigns
- Defined in:
- lib/hubspot_sdk/resources/marketing/campaigns.rb,
lib/hubspot_sdk/resources/marketing/campaigns/batch.rb,
lib/hubspot_sdk/resources/marketing/campaigns/spend.rb,
lib/hubspot_sdk/resources/marketing/campaigns/assets.rb,
lib/hubspot_sdk/resources/marketing/campaigns/budget.rb,
lib/hubspot_sdk/resources/marketing/campaigns/metrics.rb
Defined Under Namespace
Classes: Assets, Batch, Budget, Metrics, Spend
Instance Attribute Summary collapse
- #assets ⇒ HubSpotSDK::Resources::Marketing::Campaigns::Assets readonly
- #batch ⇒ HubSpotSDK::Resources::Marketing::Campaigns::Batch readonly
- #budget ⇒ HubSpotSDK::Resources::Marketing::Campaigns::Budget readonly
- #metrics ⇒ HubSpotSDK::Resources::Marketing::Campaigns::Metrics readonly
- #spend ⇒ HubSpotSDK::Resources::Marketing::Campaigns::Spend readonly
Instance Method Summary collapse
-
#create(properties:, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::PublicCampaign
Some parameter documentations has been truncated, see Models::Marketing::CampaignCreateParams for more details.
-
#delete(campaign_guid, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::Marketing::CampaignDeleteParams for more details.
-
#get(campaign_guid, end_date: nil, properties: nil, start_date: nil, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::PublicCampaignWithAssets
Some parameter documentations has been truncated, see Models::Marketing::CampaignGetParams for more details.
-
#initialize(client:) ⇒ Campaigns
constructor
private
A new instance of Campaigns.
-
#list(after: nil, limit: nil, name: nil, properties: nil, sort: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Marketing::PublicCampaign>
Some parameter documentations has been truncated, see Models::Marketing::CampaignListParams for more details.
-
#update(campaign_guid, properties:, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::PublicCampaign
Some parameter documentations has been truncated, see Models::Marketing::CampaignUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Campaigns
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 Campaigns.
180 181 182 183 184 185 186 187 |
# File 'lib/hubspot_sdk/resources/marketing/campaigns.rb', line 180 def initialize(client:) @client = client @assets = HubSpotSDK::Resources::Marketing::Campaigns::Assets.new(client: client) @batch = HubSpotSDK::Resources::Marketing::Campaigns::Batch.new(client: client) @budget = HubSpotSDK::Resources::Marketing::Campaigns::Budget.new(client: client) @metrics = HubSpotSDK::Resources::Marketing::Campaigns::Metrics.new(client: client) @spend = HubSpotSDK::Resources::Marketing::Campaigns::Spend.new(client: client) end |
Instance Attribute Details
#assets ⇒ HubSpotSDK::Resources::Marketing::Campaigns::Assets (readonly)
8 9 10 |
# File 'lib/hubspot_sdk/resources/marketing/campaigns.rb', line 8 def assets @assets end |
#batch ⇒ HubSpotSDK::Resources::Marketing::Campaigns::Batch (readonly)
11 12 13 |
# File 'lib/hubspot_sdk/resources/marketing/campaigns.rb', line 11 def batch @batch end |
#budget ⇒ HubSpotSDK::Resources::Marketing::Campaigns::Budget (readonly)
14 15 16 |
# File 'lib/hubspot_sdk/resources/marketing/campaigns.rb', line 14 def budget @budget end |
#metrics ⇒ HubSpotSDK::Resources::Marketing::Campaigns::Metrics (readonly)
17 18 19 |
# File 'lib/hubspot_sdk/resources/marketing/campaigns.rb', line 17 def metrics @metrics end |
#spend ⇒ HubSpotSDK::Resources::Marketing::Campaigns::Spend (readonly)
20 21 22 |
# File 'lib/hubspot_sdk/resources/marketing/campaigns.rb', line 20 def spend @spend end |
Instance Method Details
#create(properties:, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::PublicCampaign
Some parameter documentations has been truncated, see Models::Marketing::CampaignCreateParams for more details.
Create a campaign with the specified properties and receive a copy of the campaign object, including its ID. Note that the ‘hs_goal’ property is deprecated and will be ignored if provided.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/hubspot_sdk/resources/marketing/campaigns.rb', line 38 def create(params) parsed, = HubSpotSDK::Marketing::CampaignCreateParams.dump_request(params) @client.request( method: :post, path: "marketing/campaigns/2026-03", body: parsed, model: HubSpotSDK::Marketing::PublicCampaign, options: ) end |
#delete(campaign_guid, request_options: {}) ⇒ nil
Some parameter documentations has been truncated, see Models::Marketing::CampaignDeleteParams for more details.
Delete a specified campaign from the system. This call will return a 204 No Content response regardless of whether the campaignGuid provided corresponds to an existing campaign or not.
132 133 134 135 136 137 138 139 |
# File 'lib/hubspot_sdk/resources/marketing/campaigns.rb', line 132 def delete(campaign_guid, params = {}) @client.request( method: :delete, path: ["marketing/campaigns/2026-03/%1$s", campaign_guid], model: NilClass, options: params[:request_options] ) end |
#get(campaign_guid, end_date: nil, properties: nil, start_date: nil, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::PublicCampaignWithAssets
Some parameter documentations has been truncated, see Models::Marketing::CampaignGetParams for more details.
Get a campaign identified by a specific campaignGuid with the given properties. Along with the campaign information, it also returns information about assets. Depending on the query parameters used, this can also be used to return information about the corresponding assets’ metrics. Metrics are available only if startDate and endDate are provided.
165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/hubspot_sdk/resources/marketing/campaigns.rb', line 165 def get(campaign_guid, params = {}) parsed, = HubSpotSDK::Marketing::CampaignGetParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["marketing/campaigns/2026-03/%1$s", campaign_guid], query: query.transform_keys(end_date: "endDate", start_date: "startDate"), model: HubSpotSDK::Marketing::PublicCampaignWithAssets, options: ) end |
#list(after: nil, limit: nil, name: nil, properties: nil, sort: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Marketing::PublicCampaign>
Some parameter documentations has been truncated, see Models::Marketing::CampaignListParams for more details.
Retrieve a paginated list of campaigns from your HubSpot account. This endpoint allows you to specify sorting, pagination, and filtering options to tailor the results to your needs.
103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/hubspot_sdk/resources/marketing/campaigns.rb', line 103 def list(params = {}) parsed, = HubSpotSDK::Marketing::CampaignListParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "marketing/campaigns/2026-03", query: query, page: HubSpotSDK::Internal::Page, model: HubSpotSDK::Marketing::PublicCampaign, options: ) end |
#update(campaign_guid, properties:, request_options: {}) ⇒ HubSpotSDK::Models::Marketing::PublicCampaign
Some parameter documentations has been truncated, see Models::Marketing::CampaignUpdateParams for more details.
Perform a partial update of a campaign identified by the specified campaignGuid. Provided property values will be overwritten. Read-only and non-existent properties will cause 400 error. If an empty string is passed for any property in the Batch Update, it will reset that property’s value.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/hubspot_sdk/resources/marketing/campaigns.rb', line 68 def update(campaign_guid, params) parsed, = HubSpotSDK::Marketing::CampaignUpdateParams.dump_request(params) @client.request( method: :patch, path: ["marketing/campaigns/2026-03/%1$s", campaign_guid], body: parsed, model: HubSpotSDK::Marketing::PublicCampaign, options: ) end |