Class: HubSpotSDK::Resources::Crm::Objects::Custom
- Inherits:
-
Object
- Object
- HubSpotSDK::Resources::Crm::Objects::Custom
- Defined in:
- lib/hubspot_sdk/resources/crm/objects/custom.rb,
lib/hubspot_sdk/resources/crm/objects/custom/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::CustomGetParams for more details.
-
#initialize(client:) ⇒ Custom
constructor
private
A new instance of Custom.
-
#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::CustomListParams for more details.
-
#merge(object_type, object_id_to_merge:, primary_object_id:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject
Merge two CRM objects of the same type by specifying one as the primary object and the other as the object to be merged into it.
- #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::CustomUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Custom
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 Custom.
257 258 259 260 |
# File 'lib/hubspot_sdk/resources/crm/objects/custom.rb', line 257 def initialize(client:) @client = client @batch = HubSpotSDK::Resources::Crm::Objects::Custom::Batch.new(client: client) end |
Instance Attribute Details
#batch ⇒ HubSpotSDK::Resources::Crm::Objects::Custom::Batch (readonly)
9 10 11 |
# File 'lib/hubspot_sdk/resources/crm/objects/custom.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/custom.rb', line 28 def create(object_type, params) parsed, = HubSpotSDK::Crm::Objects::CustomCreateParams.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/custom.rb', line 133 def delete(object_id_, params) parsed, = HubSpotSDK::Crm::Objects::CustomDeleteParams.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::CustomGetParams 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/custom.rb', line 176 def get(object_id_, params) parsed, = HubSpotSDK::Crm::Objects::CustomGetParams.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::CustomListParams 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/custom.rb', line 109 def list(object_type, params = {}) parsed, = HubSpotSDK::Crm::Objects::CustomListParams.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 |
#merge(object_type, object_id_to_merge:, primary_object_id:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject
Merge two CRM objects of the same type by specifying one as the primary object and the other as the object to be merged into it.
211 212 213 214 215 216 217 218 219 220 |
# File 'lib/hubspot_sdk/resources/crm/objects/custom.rb', line 211 def merge(object_type, params) parsed, = HubSpotSDK::Crm::Objects::CustomMergeParams.dump_request(params) @client.request( method: :post, path: ["crm/objects/2026-03/%1$s/merge", object_type], body: parsed, model: HubSpotSDK::Crm::SimplePublicObject, options: ) end |
#search(object_type, after:, filter_groups:, limit:, properties:, sorts:, query: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::CollectionResponseWithTotalSimplePublicObject
243 244 245 246 247 248 249 250 251 252 |
# File 'lib/hubspot_sdk/resources/crm/objects/custom.rb', line 243 def search(object_type, params) parsed, = HubSpotSDK::Crm::Objects::CustomSearchParams.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::CustomUpdateParams 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/custom.rb', line 64 def update(object_id_, params) query_params = [:id_property] parsed, = HubSpotSDK::Crm::Objects::CustomUpdateParams.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 |