Class: HubSpotSDK::Resources::Crm::Objects::Contacts::Batch

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/crm/objects/contacts/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:



124
125
126
# File 'lib/hubspot_sdk/resources/crm/objects/contacts/batch.rb', line 124

def initialize(client:)
  @client = client
end

Instance Method Details

#create(inputs:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::BatchResponseSimplePublicObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/hubspot_sdk/resources/crm/objects/contacts/batch.rb', line 17

def create(params)
  parsed, options = HubSpotSDK::Crm::Objects::Contacts::BatchCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "crm/objects/2026-03/contacts/batch/create",
    body: parsed,
    model: HubSpotSDK::Crm::BatchResponseSimplePublicObject,
    options: options
  )
end

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

Archive a batch of contacts

Parameters:

Returns:

  • (nil)

See Also:



57
58
59
60
61
62
63
64
65
66
# File 'lib/hubspot_sdk/resources/crm/objects/contacts/batch.rb', line 57

def delete(params)
  parsed, options = HubSpotSDK::Crm::Objects::Contacts::BatchDeleteParams.dump_request(params)
  @client.request(
    method: :post,
    path: "crm/objects/2026-03/contacts/batch/archive",
    body: parsed,
    model: NilClass,
    options: options
  )
end

#get(inputs:, properties:, properties_with_history:, archived: nil, id_property: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::BatchResponseSimplePublicObject

Some parameter documentations has been truncated, see Models::Crm::Objects::Contacts::BatchGetParams for more details.

Parameters:

  • inputs (Array<HubSpotSDK::Models::Crm::SimplePublicObjectID>)

    Body param

  • properties (Array<String>)

    Body param: Key-value pairs for setting properties for the new object.

  • properties_with_history (Array<String>)

    Body param: Key-value pairs for setting properties for the new object and their

  • archived (Boolean)

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

  • id_property (String)

    Body param: When using a custom unique value property to retrieve records, the n

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

Returns:

See Also:



88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/hubspot_sdk/resources/crm/objects/contacts/batch.rb', line 88

def get(params)
  query_params = [:archived]
  parsed, options = HubSpotSDK::Crm::Objects::Contacts::BatchGetParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :post,
    path: "crm/objects/2026-03/contacts/batch/read",
    query: query,
    body: parsed.except(*query_params),
    model: HubSpotSDK::Crm::BatchResponseSimplePublicObject,
    options: options
  )
end

#update(inputs:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::BatchResponseSimplePublicObject



36
37
38
39
40
41
42
43
44
45
# File 'lib/hubspot_sdk/resources/crm/objects/contacts/batch.rb', line 36

def update(params)
  parsed, options = HubSpotSDK::Crm::Objects::Contacts::BatchUpdateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "crm/objects/2026-03/contacts/batch/update",
    body: parsed,
    model: HubSpotSDK::Crm::BatchResponseSimplePublicObject,
    options: options
  )
end

#upsert(inputs:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::BatchResponseSimplePublicUpsertObject



110
111
112
113
114
115
116
117
118
119
# File 'lib/hubspot_sdk/resources/crm/objects/contacts/batch.rb', line 110

def upsert(params)
  parsed, options = HubSpotSDK::Crm::Objects::Contacts::BatchUpsertParams.dump_request(params)
  @client.request(
    method: :post,
    path: "crm/objects/2026-03/contacts/batch/upsert",
    body: parsed,
    model: HubSpotSDK::Crm::BatchResponseSimplePublicUpsertObject,
    options: options
  )
end