Class: HubSpotSDK::Resources::Crm::Objects::GenericObjects
- Inherits:
-
Object
- Object
- HubSpotSDK::Resources::Crm::Objects::GenericObjects
- Defined in:
- lib/hubspot_sdk/resources/crm/objects/generic_objects.rb,
lib/hubspot_sdk/resources/crm/objects/generic_objects/batch.rb
Defined Under Namespace
Classes: Batch
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(object_type, associations:, properties:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject
Create a CRM object with the given properties and return a copy of the object, including the ID.
-
#delete(object_id_, object_type:, request_options: {}) ⇒ nil
Move an Object identified by ‘objectId` to the recycling bin.
-
#get(object_id_, object_type:, 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::GenericObjectGetParams for more details.
-
#initialize(client:) ⇒ GenericObjects
constructor
private
A new instance of GenericObjects.
-
#list(object_type, 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::GenericObjectListParams for more details.
- #search(object_type, after:, filter_groups:, limit:, properties:, sorts:, query: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::CollectionResponseWithTotalSimplePublicObject
-
#update(object_id_, object_type:, properties:, id_property: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject
Some parameter documentations has been truncated, see Models::Crm::Objects::GenericObjectUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ GenericObjects
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 GenericObjects.
230 231 232 233 |
# File 'lib/hubspot_sdk/resources/crm/objects/generic_objects.rb', line 230 def initialize(client:) @client = client @batch = HubSpotSDK::Resources::Crm::Objects::GenericObjects::Batch.new(client: client) end |
Instance Attribute Details
#batch ⇒ HubSpotSDK::Resources::Crm::Objects::GenericObjects::Batch (readonly)
9 10 11 |
# File 'lib/hubspot_sdk/resources/crm/objects/generic_objects.rb', line 9 def batch @batch end |
Instance Method Details
#create(object_type, associations:, properties:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject
Create a CRM object with the given properties and return a copy of the object, including the ID. Documentation and examples for creating standard objects is provided.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/hubspot_sdk/resources/crm/objects/generic_objects.rb', line 28 def create(object_type, params) parsed, = HubSpotSDK::Crm::Objects::GenericObjectCreateParams.dump_request(params) @client.request( method: :post, path: ["crm/objects/2026-03/%1$s", object_type], body: parsed, model: HubSpotSDK::Crm::SimplePublicObject, options: ) end |
#delete(object_id_, object_type:, request_options: {}) ⇒ nil
Move an Object identified by ‘objectId` to the recycling bin.
133 134 135 136 137 138 139 140 141 142 143 144 145 |
# File 'lib/hubspot_sdk/resources/crm/objects/generic_objects.rb', line 133 def delete(object_id_, params) parsed, = HubSpotSDK::Crm::Objects::GenericObjectDeleteParams.dump_request(params) object_type = parsed.delete(:object_type) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :delete, path: ["crm/objects/2026-03/%1$s/%2$s", object_type, object_id_], model: NilClass, options: ) end |
#get(object_id_, object_type:, 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::GenericObjectGetParams for more details.
Read an Object identified by ‘objectId`. `objectId` 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.
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
# File 'lib/hubspot_sdk/resources/crm/objects/generic_objects.rb', line 176 def get(object_id_, params) parsed, = HubSpotSDK::Crm::Objects::GenericObjectGetParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) object_type = parsed.delete(:object_type) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: ["crm/objects/2026-03/%1$s/%2$s", object_type, object_id_], query: query.transform_keys( id_property: "idProperty", properties_with_history: "propertiesWithHistory" ), model: HubSpotSDK::Crm::SimplePublicObjectWithAssociations, options: ) end |
#list(object_type, 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::GenericObjectListParams for more details.
Read a page of objects. Control what is returned via the ‘properties` query param.
109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/hubspot_sdk/resources/crm/objects/generic_objects.rb', line 109 def list(object_type, params = {}) parsed, = HubSpotSDK::Crm::Objects::GenericObjectListParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["crm/objects/2026-03/%1$s", object_type], query: query.transform_keys(properties_with_history: "propertiesWithHistory"), page: HubSpotSDK::Internal::Page, model: HubSpotSDK::Crm::SimplePublicObjectWithAssociations, options: ) end |
#search(object_type, after:, filter_groups:, limit:, properties:, sorts:, query: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::CollectionResponseWithTotalSimplePublicObject
216 217 218 219 220 221 222 223 224 225 |
# File 'lib/hubspot_sdk/resources/crm/objects/generic_objects.rb', line 216 def search(object_type, params) parsed, = HubSpotSDK::Crm::Objects::GenericObjectSearchParams.dump_request(params) @client.request( method: :post, path: ["crm/objects/2026-03/%1$s/search", object_type], body: parsed, model: HubSpotSDK::Crm::CollectionResponseWithTotalSimplePublicObject, options: ) end |
#update(object_id_, object_type:, properties:, id_property: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject
Some parameter documentations has been truncated, see Models::Crm::Objects::GenericObjectUpdateParams for more details.
Perform a partial update of an Object identified by ‘objectId`or optionally a unique property value as specified by the `idProperty` query param. `objectId` 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.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
# File 'lib/hubspot_sdk/resources/crm/objects/generic_objects.rb', line 64 def update(object_id_, params) query_params = [:id_property] parsed, = HubSpotSDK::Crm::Objects::GenericObjectUpdateParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params)) object_type = parsed.delete(:object_type) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :patch, path: ["crm/objects/2026-03/%1$s/%2$s", object_type, object_id_], query: query.transform_keys(id_property: "idProperty"), body: parsed.except(*query_params), model: HubSpotSDK::Crm::SimplePublicObject, options: ) end |