Class: HubSpotSDK::Resources::Crm::Objects::Projects

Inherits:
Object
  • Object
show all
Defined in:
lib/hubspot_sdk/resources/crm/objects/projects.rb,
lib/hubspot_sdk/resources/crm/objects/projects/batch.rb

Defined Under Namespace

Classes: Batch

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Projects

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

Parameters:



235
236
237
238
# File 'lib/hubspot_sdk/resources/crm/objects/projects.rb', line 235

def initialize(client:)
  @client = client
  @batch = HubSpotSDK::Resources::Crm::Objects::Projects::Batch.new(client: client)
end

Instance Attribute Details

#batchHubSpotSDK::Resources::Crm::Objects::Projects::Batch (readonly)



9
10
11
# File 'lib/hubspot_sdk/resources/crm/objects/projects.rb', line 9

def batch
  @batch
end

Instance Method Details

#create(associations:, properties:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject

Create a project with the given properties and return a copy of the object, including the ID.

Parameters:

Returns:

See Also:



25
26
27
28
29
30
31
32
33
34
# File 'lib/hubspot_sdk/resources/crm/objects/projects.rb', line 25

def create(params)
  parsed, options = HubSpotSDK::Crm::Objects::ProjectCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "crm/objects/2026-03/projects",
    body: parsed,
    model: HubSpotSDK::Crm::SimplePublicObject,
    options: options
  )
end

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

Move an Object identified by ‘projectId` to the recycling bin.

Parameters:

Returns:

  • (nil)

See Also:



122
123
124
125
126
127
128
129
# File 'lib/hubspot_sdk/resources/crm/objects/projects.rb', line 122

def delete(project_id, params = {})
  @client.request(
    method: :delete,
    path: ["crm/objects/2026-03/projects/%1$s", project_id],
    model: NilClass,
    options: params[:request_options]
  )
end

#get(project_id, archived: nil, associations: nil, id_property: nil, properties: nil, properties_with_history: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObjectWithAssociations

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

Read an Object identified by ‘projectId`. `projectId` refers to the internal object ID by default, or optionally any unique property value as specified by the `idProperty` query param. Control what is returned via the `properties` query param.

Parameters:

  • project_id (String)
  • archived (Boolean)

    Whether to return only results that have been archived.

  • associations (Array<String>)

    A comma separated list of object types to retrieve associated IDs for. If any of

  • id_property (String)

    The name of a property whose values are unique for this object type

  • properties (Array<String>)

    A comma separated list of the properties to be returned in the response. If any

  • properties_with_history (Array<String>)

    A comma separated list of the properties to be returned along with their history

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

Returns:

See Also:



158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/hubspot_sdk/resources/crm/objects/projects.rb', line 158

def get(project_id, params = {})
  parsed, options = HubSpotSDK::Crm::Objects::ProjectGetParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: ["crm/objects/2026-03/projects/%1$s", project_id],
    query: query.transform_keys(
      id_property: "idProperty",
      properties_with_history: "propertiesWithHistory"
    ),
    model: HubSpotSDK::Crm::SimplePublicObjectWithAssociations,
    options: options
  )
end

#list(after: nil, archived: nil, associations: nil, limit: nil, properties: nil, properties_with_history: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Crm::SimplePublicObjectWithAssociations>

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

Read a page of projects. Control what is returned via the ‘properties` query param.

Parameters:

  • after (String)

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

  • archived (Boolean)

    Whether to return only results that have been archived.

  • associations (Array<String>)

    A comma separated list of object types to retrieve associated IDs for. If any of

  • limit (Integer)

    The maximum number of results to display per page.

  • properties (Array<String>)

    A comma separated list of the properties to be returned in the response. If any

  • properties_with_history (Array<String>)

    A comma separated list of the properties to be returned along with their history

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

Returns:

See Also:



99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/hubspot_sdk/resources/crm/objects/projects.rb', line 99

def list(params = {})
  parsed, options = HubSpotSDK::Crm::Objects::ProjectListParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "crm/objects/2026-03/projects",
    query: query.transform_keys(properties_with_history: "propertiesWithHistory"),
    page: HubSpotSDK::Internal::Page,
    model: HubSpotSDK::Crm::SimplePublicObjectWithAssociations,
    options: options
  )
end

#merge(object_id_to_merge:, primary_object_id:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject

Merge two project records. Learn more about [merging records](knowledge.hubspot.com/records/merge-records).

Parameters:

  • object_id_to_merge (String)

    The ID of the company to merge into the primary.

  • primary_object_id (String)

    The ID of the primary company, which the other will merge into.

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

Returns:

See Also:



187
188
189
190
191
192
193
194
195
196
# File 'lib/hubspot_sdk/resources/crm/objects/projects.rb', line 187

def merge(params)
  parsed, options = HubSpotSDK::Crm::Objects::ProjectMergeParams.dump_request(params)
  @client.request(
    method: :post,
    path: "crm/objects/2026-03/projects/merge",
    body: parsed,
    model: HubSpotSDK::Crm::SimplePublicObject,
    options: options
  )
end

#search(after:, filter_groups:, limit:, properties:, sorts:, query: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::CollectionResponseWithTotalSimplePublicObject

Search for projects by filtering on properties, searching through associations, and sorting results. Learn more about [CRM search](developers.hubspot.com/docs/guides/api/crm/search#make-a-search-request).

Parameters:

  • after (String)

    A paging cursor token for retrieving subsequent pages.

  • filter_groups (Array<HubSpotSDK::Models::Crm::FilterGroup>)

    Up to 6 groups of filters defining additional query criteria.

  • limit (Integer)

    The maximum results to return, up to 200 objects.

  • properties (Array<String>)

    A list of property names to include in the response.

  • sorts (Array<String>)

    Specifies sorting order based on object properties.

  • query (String)

    The search query string, up to 3000 characters.

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

Returns:

See Also:



221
222
223
224
225
226
227
228
229
230
# File 'lib/hubspot_sdk/resources/crm/objects/projects.rb', line 221

def search(params)
  parsed, options = HubSpotSDK::Crm::Objects::ProjectSearchParams.dump_request(params)
  @client.request(
    method: :post,
    path: "crm/objects/2026-03/projects/search",
    body: parsed,
    model: HubSpotSDK::Crm::CollectionResponseWithTotalSimplePublicObject,
    options: options
  )
end

#update(project_id, properties:, id_property: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject

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

Perform a partial update of an Object identified by ‘projectId`or optionally a unique property value as specified by the `idProperty` query param. `projectId` refers to the internal object ID by default, and the `idProperty` query param refers to a property whose values are unique for the object. Provided property values will be overwritten. Read-only and non-existent properties will result in an error. Properties values can be cleared by passing an empty string.

Parameters:

  • project_id (String)

    Path param

  • properties (Hash{Symbol=>String})

    Body param: Key value pairs representing the properties of the object.

  • id_property (String)

    Query param: The name of a property whose values are unique for this object type

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

Returns:

See Also:



60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/hubspot_sdk/resources/crm/objects/projects.rb', line 60

def update(project_id, params)
  query_params = [:id_property]
  parsed, options = HubSpotSDK::Crm::Objects::ProjectUpdateParams.dump_request(params)
  query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params))
  @client.request(
    method: :patch,
    path: ["crm/objects/2026-03/projects/%1$s", project_id],
    query: query.transform_keys(id_property: "idProperty"),
    body: parsed.except(*query_params),
    model: HubSpotSDK::Crm::SimplePublicObject,
    options: options
  )
end