Class: HubSpotSDK::Resources::Cms::Pages::SitePages::Draft

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Draft

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

Parameters:



212
213
214
# File 'lib/hubspot_sdk/resources/cms/pages/site_pages/draft.rb', line 212

def initialize(client:)
  @client = client
end

Instance Method Details

#get_draft(object_id_, request_options: {}) ⇒ HubSpotSDK::Models::Cms::PagesPage

Retrieve the full draft version of a website page, specified by its ID.

Parameters:

Returns:

See Also:



19
20
21
22
23
24
25
26
# File 'lib/hubspot_sdk/resources/cms/pages/site_pages/draft.rb', line 19

def get_draft(object_id_, params = {})
  @client.request(
    method: :get,
    path: ["cms/pages/2026-03/site-pages/%1$s/draft", object_id_],
    model: HubSpotSDK::Cms::PagesPage,
    options: params[:request_options]
  )
end

#publish_draft(object_id_, request_options: {}) ⇒ nil

Take any changes from the draft version of the website page and apply them to the live version.

Parameters:

Returns:

  • (nil)

See Also:



39
40
41
42
43
44
45
46
# File 'lib/hubspot_sdk/resources/cms/pages/site_pages/draft.rb', line 39

def publish_draft(object_id_, params = {})
  @client.request(
    method: :post,
    path: ["cms/pages/2026-03/site-pages/%1$s/draft/push-live", object_id_],
    model: NilClass,
    options: params[:request_options]
  )
end

#reset_site_page_draft(object_id_, request_options: {}) ⇒ nil

Discards any edits and resets the draft to match the live version.

Parameters:

Returns:

  • (nil)

See Also:



58
59
60
61
62
63
64
65
# File 'lib/hubspot_sdk/resources/cms/pages/site_pages/draft.rb', line 58

def reset_site_page_draft(object_id_, params = {})
  @client.request(
    method: :post,
    path: ["cms/pages/2026-03/site-pages/%1$s/draft/reset", object_id_],
    model: NilClass,
    options: params[:request_options]
  )
end

#update_draft(object_id_, id:, ab_status:, ab_test_id:, archived_at:, archived_in_dashboard:, attached_stylesheets:, author_name:, campaign:, category_id:, content_group_id:, content_type_category:, created:, created_by_id:, currently_published:, current_state:, domain:, dynamic_page_data_source_id:, dynamic_page_data_source_type:, dynamic_page_hub_db_table_id:, enable_domain_stylesheets:, enable_layout_stylesheets:, featured_image:, featured_image_alt_text:, folder_id:, footer_html:, head_html:, html_title:, include_default_custom_css:, language:, layout_sections:, link_rel_canonical_url:, mab_experiment_id:, meta_description:, name:, page_expiry_date:, page_expiry_enabled:, page_expiry_redirect_id:, page_expiry_redirect_url:, page_redirected:, password:, public_access_rules:, public_access_rules_enabled:, publish_date:, publish_immediately:, slug:, state:, subcategory:, template_path:, theme_settings_values:, translated_from_id:, translations:, updated:, updated_by_id:, url:, use_featured_image:, widget_containers:, widgets:, request_options: {}) ⇒ HubSpotSDK::Models::Cms::PagesPage

Some parameter documentations has been truncated, see Models::Cms::Pages::SitePages::DraftUpdateDraftParams for more details.

Partially update the draft version of a website page, specified by page ID. You only need to specify the values for the details that you’re modifying.

Parameters:

  • object_id_ (String)
  • id (String)

    The unique ID of the page.

  • ab_status (Symbol, HubSpotSDK::Models::Cms::PagesPage::AbStatus)

    The status of the AB test associated with this page, if applicable

  • ab_test_id (String)

    The ID of the AB test associated with this page, if applicable

  • archived_at (Time)

    The timestamp (ISO8601 format) when this page was deleted.

  • archived_in_dashboard (Boolean)

    If True, the page will not show up in your dashboard, although the page could st

  • attached_stylesheets (Array<Hash{Symbol=>Object}>)

    List of stylesheets to attach to this page. These stylesheets are attached to ju

  • author_name (String)

    The name of the user that updated this page.

  • campaign (String)

    The GUID of the marketing campaign this page is a part of.

  • category_id (Integer)

    ID of the type of object this is. Should always .

  • content_group_id (String)

    The unique identifier for the content group associated with the page.

  • content_type_category (Symbol, HubSpotSDK::Models::Cms::PagesPage::ContentTypeCategory)

    An ENUM descibing the type of this object. Should be either LANDING_PAGE or SITE

  • created (Time)

    The timestamp indicating when the page was created.

  • created_by_id (String)

    The ID of the user that created this page.

  • currently_published (Boolean)

    Indicates whether the page is currently published.

  • current_state (Symbol, HubSpotSDK::Models::Cms::PagesPage::CurrentState)

    A generated ENUM descibing the current state of this page.

  • domain (String)

    The domain this page will resolve to. If null, the page will default to the prim

  • dynamic_page_data_source_id (String)

    The identifier for the data source used by the dynamic page.

  • dynamic_page_data_source_type (Integer)

    The type of data source used by the dynamic page.

  • dynamic_page_hub_db_table_id (String)

    The ID of the HubDB table this page references, if applicable

  • enable_domain_stylesheets (Boolean)

    Boolean to determine whether or not the styles from the template should be appli

  • enable_layout_stylesheets (Boolean)

    Boolean to determine whether or not the styles from the template should be appli

  • featured_image (String)

    The featuredImage of this page.

  • featured_image_alt_text (String)

    Alt Text of the featuredImage.

  • folder_id (String)

    The ID of the associated folder this landing page is organized under in the app

  • footer_html (String)

    Custom HTML for embed codes, javascript that should be placed before the </body>

  • head_html (String)

    Custom HTML for embed codes, javascript, etc. that goes in the <head> tag of the

  • html_title (String)

    The html title of this page.

  • include_default_custom_css (Boolean)

    Boolean to determine whether or not the Primary CSS Files should be applied.

  • language (Symbol, HubSpotSDK::Models::Cms::PagesPage::Language)

    The explicitly defined ISO 639 language code of the page. If null, the page will

  • layout_sections (Hash{Symbol=>HubSpotSDK::Models::Cms::LayoutSection})

    A structure detailing the layout sections of the page.

  • link_rel_canonical_url (String)

    Optional override to set the URL to be used in the rel=canonical link tag on the

  • mab_experiment_id (String)

    The ID of the MAB test (or dynamic test) associated with this page, if applicabl

  • meta_description (String)

    A description that goes in <meta> tag on the page.

  • name (String)

    The internal name of the page.

  • page_expiry_date (Integer)

    The date at which this page should expire and begin redirecting to another url o

  • page_expiry_enabled (Boolean)

    Boolean describing if the page expiration feature is enabled for this page

  • page_expiry_redirect_id (Integer)

    The ID of another page this page’s url should redirect to once this page expires

  • page_expiry_redirect_url (String)

    The URL this page’s url should redirect to once this page expires. Should only s

  • page_redirected (Boolean)

    A generated Boolean describing whether or not this page is currently expired and

  • password (String)

    Set this to create a password protected page. Entering the password will be requ

  • public_access_rules (Array<Object>)

    Rules for require member registration to access private content.

  • public_access_rules_enabled (Boolean)

    Boolean to determine whether or not to respect publicAccessRules.

  • publish_date (Time)

    The date (ISO8601 format) the page is to be published at.

  • publish_immediately (Boolean)

    Set this to true if you want to be published immediately when the schedule publi

  • slug (String)

    The path of the this page. This field is appended to the domain to construct the

  • state (String)

    An ENUM descibing the current state of this page.

  • subcategory (String)

    Details the type of page this is. Should always be landing_page or site_page

  • template_path (String)

    String detailing the path of the template used for this page.

  • theme_settings_values (Hash{Symbol=>Object})

    A collection of settings specific to the theme applied to the page.

  • translated_from_id (String)

    ID of the primary page this object was translated from.

  • translations (Hash{Symbol=>HubSpotSDK::Models::Cms::ContentLanguageVariation})

    A map of translations for the page, each associated with a specific language var

  • updated (Time)

    The timestamp indicating when the page was last updated.

  • updated_by_id (String)

    The ID of the user that updated this page.

  • url (String)

    A generated field representing the URL of this page.

  • use_featured_image (Boolean)

    Boolean to determine if this page should use a featuredImage.

  • widget_containers (Hash{Symbol=>Object})

    A data structure containing the data for all the modules inside the containers f

  • widgets (Hash{Symbol=>Object})

    A data structure containing the data for all the modules for this page.

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

Returns:

See Also:



197
198
199
200
201
202
203
204
205
206
207
# File 'lib/hubspot_sdk/resources/cms/pages/site_pages/draft.rb', line 197

def update_draft(object_id_, params)
  parsed, options = HubSpotSDK::Cms::Pages::SitePages::DraftUpdateDraftParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["cms/pages/2026-03/site-pages/%1$s/draft", object_id_],
    headers: {"content-type" => "*/*"},
    body: parsed,
    model: HubSpotSDK::Cms::PagesPage,
    options: options
  )
end