Class: HubSpotSDK::Resources::Cms::Blogs::Posts::Revisions

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/cms/blogs/posts/revisions.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Revisions

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

Parameters:



131
132
133
# File 'lib/hubspot_sdk/resources/cms/blogs/posts/revisions.rb', line 131

def initialize(client:)
  @client = client
end

Instance Method Details

#get_previous_version(revision_id, object_id_:, request_options: {}) ⇒ StringIO

Retrieve a previous version of a blog post.

Parameters:

Returns:

  • (StringIO)

See Also:



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/hubspot_sdk/resources/cms/blogs/posts/revisions.rb', line 20

def get_previous_version(revision_id, params)
  parsed, options = HubSpotSDK::Cms::Blogs::Posts::RevisionGetPreviousVersionParams.dump_request(params)
  object_id_ =
    parsed.delete(:object_id_) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["cms/blogs/2026-03/posts/%1$s/revisions/%2$s", object_id_, revision_id],
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: options
  )
end

#get_previous_versions(object_id_, after: nil, before: nil, limit: nil, request_options: {}) ⇒ StringIO

Some parameter documentations has been truncated, see Models::Cms::Blogs::Posts::RevisionGetPreviousVersionsParams for more details.

Retrieve all the previous versions of a blog post.

Parameters:

  • object_id_ (String)
  • after (String)

    The paging cursor token of the last successfully read resource will be returned

  • before (String)
  • limit (Integer)

    The maximum number of results to display per page.

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

Returns:

  • (StringIO)

See Also:



56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/hubspot_sdk/resources/cms/blogs/posts/revisions.rb', line 56

def get_previous_versions(object_id_, params = {})
  parsed, options = HubSpotSDK::Cms::Blogs::Posts::RevisionGetPreviousVersionsParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["cms/blogs/2026-03/posts/%1$s/revisions", object_id_],
    query: query,
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: options
  )
end

#restore_previous_version(revision_id, object_id_:, request_options: {}) ⇒ StringIO

Restores a blog post to one of its previous versions.

Parameters:

Returns:

  • (StringIO)

See Also:



80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/hubspot_sdk/resources/cms/blogs/posts/revisions.rb', line 80

def restore_previous_version(revision_id, params)
  parsed, options =
    HubSpotSDK::Cms::Blogs::Posts::RevisionRestorePreviousVersionParams.dump_request(params)
  object_id_ =
    parsed.delete(:object_id_) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: ["cms/blogs/2026-03/posts/%1$s/revisions/%2$s/restore", object_id_, revision_id],
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: options
  )
end

#restore_previous_version_to_draft(revision_id, object_id_:, request_options: {}) ⇒ StringIO

Takes a specified version of a blog post, sets it as the new draft version of the blog post.

Parameters:

Returns:

  • (StringIO)

See Also:



108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/hubspot_sdk/resources/cms/blogs/posts/revisions.rb', line 108

def restore_previous_version_to_draft(revision_id, params)
  parsed, options =
    HubSpotSDK::Cms::Blogs::Posts::RevisionRestorePreviousVersionToDraftParams.dump_request(params)
  object_id_ =
    parsed.delete(:object_id_) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :post,
    path: [
      "cms/blogs/2026-03/posts/%1$s/revisions/%2$s/restore-to-draft",
      object_id_,
      revision_id
    ],
    headers: {"accept" => "*/*"},
    model: StringIO,
    options: options
  )
end