Class: HubSpotSDK::Resources::Cms::Pages::ABTests

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/cms/pages/a_b_tests.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ ABTests

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

Parameters:



163
164
165
# File 'lib/hubspot_sdk/resources/cms/pages/a_b_tests.rb', line 163

def initialize(client:)
  @client = client
end

Instance Method Details

#create_landing_page_variation(content_id:, variation_name:, request_options: {}) ⇒ HubSpotSDK::Models::Cms::PageData

Create a new A/B test variation based on the information provided in the request body.

Parameters:

  • content_id (String)

    ID of the object to test.

  • variation_name (String)

    Name of A/B test variation.

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

Returns:

See Also:



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/hubspot_sdk/resources/cms/pages/a_b_tests.rb', line 22

def create_landing_page_variation(params)
  parsed, options = HubSpotSDK::Cms::Pages::ABTestCreateLandingPageVariationParams.dump_request(params)
  @client.request(
    method: :post,
    path: "cms/pages/2026-03/landing-pages/ab-test/create-variation",
    headers: {"content-type" => "*/*"},
    body: parsed,
    model: HubSpotSDK::Cms::PageData,
    options: options
  )
end

#create_site_page_variation(content_id:, variation_name:, request_options: {}) ⇒ HubSpotSDK::Models::Cms::PageData

Create a new A/B test variation based on the information provided in the request body.

Parameters:

  • content_id (String)

    ID of the object to test.

  • variation_name (String)

    Name of A/B test variation.

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

Returns:

See Also:



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/hubspot_sdk/resources/cms/pages/a_b_tests.rb', line 48

def create_site_page_variation(params)
  parsed, options = HubSpotSDK::Cms::Pages::ABTestCreateSitePageVariationParams.dump_request(params)
  @client.request(
    method: :post,
    path: "cms/pages/2026-03/site-pages/ab-test/create-variation",
    headers: {"content-type" => "*/*"},
    body: parsed,
    model: HubSpotSDK::Cms::PageData,
    options: options
  )
end

#end_landing_page_test(ab_test_id:, winner_id:, request_options: {}) ⇒ nil

End an active A/B test and designate a winner.

Parameters:

  • ab_test_id (String)

    ID of the test to end.

  • winner_id (String)

    ID of the object to designate as the test winner.

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

Returns:

  • (nil)

See Also:



73
74
75
76
77
78
79
80
81
82
83
# File 'lib/hubspot_sdk/resources/cms/pages/a_b_tests.rb', line 73

def end_landing_page_test(params)
  parsed, options = HubSpotSDK::Cms::Pages::ABTestEndLandingPageTestParams.dump_request(params)
  @client.request(
    method: :post,
    path: "cms/pages/2026-03/landing-pages/ab-test/end",
    headers: {"content-type" => "*/*"},
    body: parsed,
    model: NilClass,
    options: options
  )
end

#end_site_page_test(ab_test_id:, winner_id:, request_options: {}) ⇒ nil

End an active A/B test and designate a winner.

Parameters:

  • ab_test_id (String)

    ID of the test to end.

  • winner_id (String)

    ID of the object to designate as the test winner.

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

Returns:

  • (nil)

See Also:



98
99
100
101
102
103
104
105
106
107
108
# File 'lib/hubspot_sdk/resources/cms/pages/a_b_tests.rb', line 98

def end_site_page_test(params)
  parsed, options = HubSpotSDK::Cms::Pages::ABTestEndSitePageTestParams.dump_request(params)
  @client.request(
    method: :post,
    path: "cms/pages/2026-03/site-pages/ab-test/end",
    headers: {"content-type" => "*/*"},
    body: parsed,
    model: NilClass,
    options: options
  )
end

#rerun_landing_page_test(ab_test_id:, variation_id:, request_options: {}) ⇒ nil

Rerun a previous A/B test.

Parameters:

  • ab_test_id (String)

    ID of the test to rerun.

  • variation_id (String)

    ID of the object to reactivate as a test variation.

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

Returns:

  • (nil)

See Also:



123
124
125
126
127
128
129
130
131
132
133
# File 'lib/hubspot_sdk/resources/cms/pages/a_b_tests.rb', line 123

def rerun_landing_page_test(params)
  parsed, options = HubSpotSDK::Cms::Pages::ABTestRerunLandingPageTestParams.dump_request(params)
  @client.request(
    method: :post,
    path: "cms/pages/2026-03/landing-pages/ab-test/rerun",
    headers: {"content-type" => "*/*"},
    body: parsed,
    model: NilClass,
    options: options
  )
end

#rerun_site_page_test(ab_test_id:, variation_id:, request_options: {}) ⇒ nil

Rerun a previous A/B test.

Parameters:

  • ab_test_id (String)

    ID of the test to rerun.

  • variation_id (String)

    ID of the object to reactivate as a test variation.

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

Returns:

  • (nil)

See Also:



148
149
150
151
152
153
154
155
156
157
158
# File 'lib/hubspot_sdk/resources/cms/pages/a_b_tests.rb', line 148

def rerun_site_page_test(params)
  parsed, options = HubSpotSDK::Cms::Pages::ABTestRerunSitePageTestParams.dump_request(params)
  @client.request(
    method: :post,
    path: "cms/pages/2026-03/site-pages/ab-test/rerun",
    headers: {"content-type" => "*/*"},
    body: parsed,
    model: NilClass,
    options: options
  )
end