Class: HubSpotSDK::Resources::Cms::Blogs::Posts
- Inherits:
-
Object
- Object
- HubSpotSDK::Resources::Cms::Blogs::Posts
- Defined in:
- lib/hubspot_sdk/resources/cms/blogs/posts.rb,
lib/hubspot_sdk/resources/cms/blogs/posts/batch.rb,
lib/hubspot_sdk/resources/cms/blogs/posts/revisions.rb,
lib/hubspot_sdk/resources/cms/blogs/posts/multi_language.rb
Defined Under Namespace
Classes: Batch, MultiLanguage, Revisions
Instance Attribute Summary collapse
- #batch ⇒ HubSpotSDK::Resources::Cms::Blogs::Posts::Batch readonly
- #multi_language ⇒ HubSpotSDK::Resources::Cms::Blogs::Posts::MultiLanguage readonly
- #revisions ⇒ HubSpotSDK::Resources::Cms::Blogs::Posts::Revisions readonly
Instance Method Summary collapse
-
#clone_(id:, clone_name: nil, request_options: {}) ⇒ StringIO
Clone a blog post, making a copy of it in a new blog post.
-
#create(id:, ab_status:, ab_test_id:, archived_at:, archived_in_dashboard:, attached_stylesheets:, author_name:, blog_author_id:, 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_google_amp_output_override:, 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:, password:, post_body:, post_summary:, public_access_rules:, public_access_rules_enabled:, publish_date:, publish_immediately:, rss_body:, rss_summary:, slug:, state:, tag_ids:, theme_settings_values:, translated_from_id:, translations:, updated:, updated_by_id:, url:, use_featured_image:, widget_containers:, widgets:, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostCreateParams for more details.
-
#delete(object_id_, archived: nil, request_options: {}) ⇒ nil
Delete a blog post by ID.
-
#get(object_id_, archived: nil, property: nil, request_options: {}) ⇒ StringIO
Retrieve a blog post by the post ID.
-
#get_draft_by_id(object_id_, request_options: {}) ⇒ StringIO
Retrieve the full draft version of a blog post.
-
#initialize(client:) ⇒ Posts
constructor
private
A new instance of Posts.
-
#list(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostListParams for more details.
-
#list_authors(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostListAuthorsParams for more details.
-
#list_tags(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostListTagsParams for more details.
-
#push_live(object_id_, request_options: {}) ⇒ nil
Publish the draft version of the blog post, sending its content to the live page.
-
#query(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostQueryParams for more details.
-
#query_authors(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostQueryAuthorsParams for more details.
-
#query_tags(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostQueryTagsParams for more details.
-
#reset_draft(object_id_, request_options: {}) ⇒ nil
Discard all drafted content, resetting the draft to contain the content in the currently published version.
-
#schedule(id:, publish_date:, request_options: {}) ⇒ nil
Schedule a blog post to be published at a specified time.
-
#update(object_id_, id:, ab_status:, ab_test_id:, archived_at:, archived_in_dashboard:, attached_stylesheets:, author_name:, blog_author_id:, 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_google_amp_output_override:, 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:, password:, post_body:, post_summary:, public_access_rules:, public_access_rules_enabled:, publish_date:, publish_immediately:, rss_body:, rss_summary:, slug:, state:, tag_ids:, theme_settings_values:, translated_from_id:, translations:, updated:, updated_by_id:, url:, use_featured_image:, widget_containers:, widgets:, archived: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostUpdateParams for more details.
-
#update_draft(object_id_, id:, ab_status:, ab_test_id:, archived_at:, archived_in_dashboard:, attached_stylesheets:, author_name:, blog_author_id:, 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_google_amp_output_override:, 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:, password:, post_body:, post_summary:, public_access_rules:, public_access_rules_enabled:, publish_date:, publish_immediately:, rss_body:, rss_summary:, slug:, state:, tag_ids:, theme_settings_values:, translated_from_id:, translations:, updated:, updated_by_id:, url:, use_featured_image:, widget_containers:, widgets:, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostUpdateDraftParams for more details.
Constructor Details
#initialize(client:) ⇒ Posts
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 Posts.
944 945 946 947 948 949 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 944 def initialize(client:) @client = client @batch = HubSpotSDK::Resources::Cms::Blogs::Posts::Batch.new(client: client) @multi_language = HubSpotSDK::Resources::Cms::Blogs::Posts::MultiLanguage.new(client: client) @revisions = HubSpotSDK::Resources::Cms::Blogs::Posts::Revisions.new(client: client) end |
Instance Attribute Details
#batch ⇒ HubSpotSDK::Resources::Cms::Blogs::Posts::Batch (readonly)
9 10 11 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 9 def batch @batch end |
#multi_language ⇒ HubSpotSDK::Resources::Cms::Blogs::Posts::MultiLanguage (readonly)
12 13 14 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 12 def multi_language @multi_language end |
#revisions ⇒ HubSpotSDK::Resources::Cms::Blogs::Posts::Revisions (readonly)
15 16 17 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 15 def revisions @revisions end |
Instance Method Details
#clone_(id:, clone_name: nil, request_options: {}) ⇒ StringIO
Clone a blog post, making a copy of it in a new blog post.
407 408 409 410 411 412 413 414 415 416 417 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 407 def clone_(params) parsed, = HubSpotSDK::Cms::Blogs::PostCloneParams.dump_request(params) @client.request( method: :post, path: "cms/blogs/2026-03/posts/clone", headers: {"content-type" => "*/*", "accept" => "*/*"}, body: parsed, model: StringIO, options: ) end |
#create(id:, ab_status:, ab_test_id:, archived_at:, archived_in_dashboard:, attached_stylesheets:, author_name:, blog_author_id:, 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_google_amp_output_override:, 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:, password:, post_body:, post_summary:, public_access_rules:, public_access_rules_enabled:, publish_date:, publish_immediately:, rss_body:, rss_summary:, slug:, state:, tag_ids:, theme_settings_values:, translated_from_id:, translations:, updated:, updated_by_id:, url:, use_featured_image:, widget_containers:, widgets:, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostCreateParams for more details.
Create a new blog post, specifying its content in the request body.
151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 151 def create(params) parsed, = HubSpotSDK::Cms::Blogs::PostCreateParams.dump_request(params) @client.request( method: :post, path: "cms/blogs/2026-03/posts", headers: {"content-type" => "*/*", "accept" => "*/*"}, body: parsed, model: StringIO, options: ) end |
#delete(object_id_, archived: nil, request_options: {}) ⇒ nil
Delete a blog post by ID.
382 383 384 385 386 387 388 389 390 391 392 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 382 def delete(object_id_, params = {}) parsed, = HubSpotSDK::Cms::Blogs::PostDeleteParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :delete, path: ["cms/blogs/2026-03/posts/%1$s", object_id_], query: query, model: NilClass, options: ) end |
#get(object_id_, archived: nil, property: nil, request_options: {}) ⇒ StringIO
Retrieve a blog post by the post ID.
434 435 436 437 438 439 440 441 442 443 444 445 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 434 def get(object_id_, params = {}) parsed, = HubSpotSDK::Cms::Blogs::PostGetParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["cms/blogs/2026-03/posts/%1$s", object_id_], query: query, headers: {"accept" => "*/*"}, model: StringIO, options: ) end |
#get_draft_by_id(object_id_, request_options: {}) ⇒ StringIO
Retrieve the full draft version of a blog post.
457 458 459 460 461 462 463 464 465 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 457 def get_draft_by_id(object_id_, params = {}) @client.request( method: :get, path: ["cms/blogs/2026-03/posts/%1$s/draft", object_id_], headers: {"accept" => "*/*"}, model: StringIO, options: params[:request_options] ) end |
#list(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostListParams for more details.
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 349 def list(params = {}) parsed, = HubSpotSDK::Cms::Blogs::PostListParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "cms/blogs/2026-03/posts/cursor", query: query.transform_keys( created_after: "createdAfter", created_at: "createdAt", created_before: "createdBefore", updated_after: "updatedAfter", updated_at: "updatedAt", updated_before: "updatedBefore" ), headers: {"accept" => "*/*"}, model: StringIO, options: ) end |
#list_authors(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostListAuthorsParams for more details.
499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 499 def (params = {}) parsed, = HubSpotSDK::Cms::Blogs::PostListAuthorsParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "cms/blogs/2026-03/authors/cursor", query: query.transform_keys( created_after: "createdAfter", created_at: "createdAt", created_before: "createdBefore", updated_after: "updatedAfter", updated_at: "updatedAt", updated_before: "updatedBefore" ), headers: {"accept" => "*/*"}, model: StringIO, options: ) end |
#list_tags(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostListTagsParams for more details.
551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 551 def (params = {}) parsed, = HubSpotSDK::Cms::Blogs::PostListTagsParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "cms/blogs/2026-03/tags/cursor", query: query.transform_keys( created_after: "createdAfter", created_at: "createdAt", created_before: "createdBefore", updated_after: "updatedAfter", updated_at: "updatedAt", updated_before: "updatedBefore" ), headers: {"accept" => "*/*"}, model: StringIO, options: ) end |
#push_live(object_id_, request_options: {}) ⇒ nil
Publish the draft version of the blog post, sending its content to the live page.
582 583 584 585 586 587 588 589 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 582 def push_live(object_id_, params = {}) @client.request( method: :post, path: ["cms/blogs/2026-03/posts/%1$s/draft/push-live", object_id_], model: NilClass, options: params[:request_options] ) end |
#query(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostQueryParams for more details.
623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 623 def query(params = {}) parsed, = HubSpotSDK::Cms::Blogs::PostQueryParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "cms/blogs/2026-03/posts/cursor/query", query: query.transform_keys( created_after: "createdAfter", created_at: "createdAt", created_before: "createdBefore", updated_after: "updatedAfter", updated_at: "updatedAt", updated_before: "updatedBefore" ), headers: {"accept" => "*/*"}, model: StringIO, options: ) end |
#query_authors(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostQueryAuthorsParams for more details.
675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 675 def (params = {}) parsed, = HubSpotSDK::Cms::Blogs::PostQueryAuthorsParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "cms/blogs/2026-03/authors/cursor/query", query: query.transform_keys( created_after: "createdAfter", created_at: "createdAt", created_before: "createdBefore", updated_after: "updatedAfter", updated_at: "updatedAt", updated_before: "updatedBefore" ), headers: {"accept" => "*/*"}, model: StringIO, options: ) end |
#query_tags(after: nil, archived: nil, created_after: nil, created_at: nil, created_before: nil, limit: nil, property: nil, sort: nil, updated_after: nil, updated_at: nil, updated_before: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostQueryTagsParams for more details.
727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 727 def (params = {}) parsed, = HubSpotSDK::Cms::Blogs::PostQueryTagsParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "cms/blogs/2026-03/tags/cursor/query", query: query.transform_keys( created_after: "createdAfter", created_at: "createdAt", created_before: "createdBefore", updated_after: "updatedAfter", updated_at: "updatedAt", updated_before: "updatedBefore" ), headers: {"accept" => "*/*"}, model: StringIO, options: ) end |
#reset_draft(object_id_, request_options: {}) ⇒ nil
Discard all drafted content, resetting the draft to contain the content in the currently published version.
758 759 760 761 762 763 764 765 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 758 def reset_draft(object_id_, params = {}) @client.request( method: :post, path: ["cms/blogs/2026-03/posts/%1$s/draft/reset", object_id_], model: NilClass, options: params[:request_options] ) end |
#schedule(id:, publish_date:, request_options: {}) ⇒ nil
Schedule a blog post to be published at a specified time.
780 781 782 783 784 785 786 787 788 789 790 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 780 def schedule(params) parsed, = HubSpotSDK::Cms::Blogs::PostScheduleParams.dump_request(params) @client.request( method: :post, path: "cms/blogs/2026-03/posts/schedule", headers: {"content-type" => "*/*"}, body: parsed, model: NilClass, options: ) end |
#update(object_id_, id:, ab_status:, ab_test_id:, archived_at:, archived_in_dashboard:, attached_stylesheets:, author_name:, blog_author_id:, 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_google_amp_output_override:, 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:, password:, post_body:, post_summary:, public_access_rules:, public_access_rules_enabled:, publish_date:, publish_immediately:, rss_body:, rss_summary:, slug:, state:, tag_ids:, theme_settings_values:, translated_from_id:, translations:, updated:, updated_by_id:, url:, use_featured_image:, widget_containers:, widgets:, archived: nil, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostUpdateParams for more details.
Partially updates a single blog post by ID. You only need to specify the values that you want to update.
302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 302 def update(object_id_, params) query_params = [:archived] parsed, = HubSpotSDK::Cms::Blogs::PostUpdateParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :patch, path: ["cms/blogs/2026-03/posts/%1$s", object_id_], query: query, headers: {"content-type" => "*/*", "accept" => "*/*"}, body: parsed.except(*query_params), model: StringIO, options: ) end |
#update_draft(object_id_, id:, ab_status:, ab_test_id:, archived_at:, archived_in_dashboard:, attached_stylesheets:, author_name:, blog_author_id:, 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_google_amp_output_override:, 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:, password:, post_body:, post_summary:, public_access_rules:, public_access_rules_enabled:, publish_date:, publish_immediately:, rss_body:, rss_summary:, slug:, state:, tag_ids:, theme_settings_values:, translated_from_id:, translations:, updated:, updated_by_id:, url:, use_featured_image:, widget_containers:, widgets:, request_options: {}) ⇒ StringIO
Some parameter documentations has been truncated, see Models::Cms::Blogs::PostUpdateDraftParams for more details.
Partially updates the draft version of a single blog post by ID. You only need to specify the values that you want to update.
929 930 931 932 933 934 935 936 937 938 939 |
# File 'lib/hubspot_sdk/resources/cms/blogs/posts.rb', line 929 def update_draft(object_id_, params) parsed, = HubSpotSDK::Cms::Blogs::PostUpdateDraftParams.dump_request(params) @client.request( method: :patch, path: ["cms/blogs/2026-03/posts/%1$s/draft", object_id_], headers: {"content-type" => "*/*", "accept" => "*/*"}, body: parsed, model: StringIO, options: ) end |