Class: HubSpotSDK::Resources::Cms::Blogs::Posts::Batch

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Batch

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

Parameters:



116
117
118
# File 'lib/hubspot_sdk/resources/cms/blogs/posts/batch.rb', line 116

def initialize(client:)
  @client = client
end

Instance Method Details

#create(inputs:, request_options: {}) ⇒ StringIO

Create a batch of blog posts, specifying their content in the request body.

Parameters:

Returns:

  • (StringIO)

See Also:



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

def create(params)
  parsed, options = HubSpotSDK::Cms::Blogs::Posts::BatchCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "cms/blogs/2026-03/posts/batch/create",
    headers: {"content-type" => "*/*", "accept" => "*/*"},
    body: parsed,
    model: StringIO,
    options: options
  )
end

#delete(inputs:, request_options: {}) ⇒ nil

Delete a blog post by ID. Note: This is not the same as the in-app ‘archive` function. To perform a dashboard `archive` send an normal update with the `archivedInDashboard` field set to `true`.

Parameters:

Returns:

  • (nil)

See Also:



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

def delete(params)
  parsed, options = HubSpotSDK::Cms::Blogs::Posts::BatchDeleteParams.dump_request(params)
  @client.request(
    method: :post,
    path: "cms/blogs/2026-03/posts/batch/archive",
    headers: {"content-type" => "*/*"},
    body: parsed,
    model: NilClass,
    options: options
  )
end

#get(inputs:, archived: nil, request_options: {}) ⇒ StringIO

Retrieve a batch of blog posts by ID. identified in the request body.

Parameters:

  • inputs (Array<String>)

    Body param: Strings to input.

  • archived (Boolean)

    Query param: Whether to return only results that have been archived.

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

Returns:

  • (StringIO)

See Also:



98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/hubspot_sdk/resources/cms/blogs/posts/batch.rb', line 98

def get(params)
  query_params = [:archived]
  parsed, options = HubSpotSDK::Cms::Blogs::Posts::BatchGetParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :post,
    path: "cms/blogs/2026-03/posts/batch/read",
    query: query,
    headers: {"content-type" => "*/*", "accept" => "*/*"},
    body: parsed.except(*query_params),
    model: StringIO,
    options: options
  )
end

#update(inputs:, archived: nil, request_options: {}) ⇒ StringIO

Update a batch of blog posts.

Parameters:

  • inputs (Array<Object>)

    Body param: JSON nodes to input.

  • archived (Boolean)

    Query param: Whether to return only results that have been archived.

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

Returns:

  • (StringIO)

See Also:



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/hubspot_sdk/resources/cms/blogs/posts/batch.rb', line 45

def update(params)
  query_params = [:archived]
  parsed, options = HubSpotSDK::Cms::Blogs::Posts::BatchUpdateParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :post,
    path: "cms/blogs/2026-03/posts/batch/update",
    query: query,
    headers: {"content-type" => "*/*", "accept" => "*/*"},
    body: parsed.except(*query_params),
    model: StringIO,
    options: options
  )
end