Class: HubSpotSDK::Resources::Crm::Objects::Carts
- Inherits:
-
Object
- Object
- HubSpotSDK::Resources::Crm::Objects::Carts
- Defined in:
- lib/hubspot_sdk/resources/crm/objects/carts.rb,
lib/hubspot_sdk/resources/crm/objects/carts/batch.rb
Defined Under Namespace
Classes: Batch
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(associations:, properties:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject
Create a cart with the given properties and return a copy of the object, including the ID.
-
#delete(cart_id, request_options: {}) ⇒ nil
Delete a cart by its ID, moving it to the recycling bin.
-
#get(cart_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::CartGetParams for more details.
-
#initialize(client:) ⇒ Carts
constructor
private
A new instance of Carts.
-
#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::CartListParams for more details.
-
#search(after:, filter_groups:, limit:, properties:, sorts:, query: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::CollectionResponseWithTotalSimplePublicObject
Search for carts based on the specified search criteria, such as filters and properties, and retrieve the matching results.
-
#update(cart_id, properties:, id_property: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject
Some parameter documentations has been truncated, see Models::Crm::Objects::CartUpdateParams for more details.
Constructor Details
#initialize(client:) ⇒ Carts
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 Carts.
206 207 208 209 |
# File 'lib/hubspot_sdk/resources/crm/objects/carts.rb', line 206 def initialize(client:) @client = client @batch = HubSpotSDK::Resources::Crm::Objects::Carts::Batch.new(client: client) end |
Instance Attribute Details
#batch ⇒ HubSpotSDK::Resources::Crm::Objects::Carts::Batch (readonly)
9 10 11 |
# File 'lib/hubspot_sdk/resources/crm/objects/carts.rb', line 9 def batch @batch end |
Instance Method Details
#create(associations:, properties:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject
Create a cart with the given properties and return a copy of the object, including the ID. Documentation and examples for creating standard carts is provided.
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/hubspot_sdk/resources/crm/objects/carts.rb', line 26 def create(params) parsed, = HubSpotSDK::Crm::Objects::CartCreateParams.dump_request(params) @client.request( method: :post, path: "crm/objects/2026-03/carts", body: parsed, model: HubSpotSDK::Crm::SimplePublicObject, options: ) end |
#delete(cart_id, request_options: {}) ⇒ nil
Delete a cart by its ID, moving it to the recycling bin.
121 122 123 124 125 126 127 128 |
# File 'lib/hubspot_sdk/resources/crm/objects/carts.rb', line 121 def delete(cart_id, params = {}) @client.request( method: :delete, path: ["crm/objects/2026-03/carts/%1$s", cart_id], model: NilClass, options: params[:request_options] ) end |
#get(cart_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::CartGetParams for more details.
Retrieve a cart by its ID. You can control what is returned via the ‘properties` query parameter.
155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
# File 'lib/hubspot_sdk/resources/crm/objects/carts.rb', line 155 def get(cart_id, params = {}) parsed, = HubSpotSDK::Crm::Objects::CartGetParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: ["crm/objects/2026-03/carts/%1$s", cart_id], query: query.transform_keys( id_property: "idProperty", properties_with_history: "propertiesWithHistory" ), model: HubSpotSDK::Crm::SimplePublicObjectWithAssociations, 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::CartListParams for more details.
Retrieve all carts. You can control what is returned via the ‘properties` query parameter.
98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'lib/hubspot_sdk/resources/crm/objects/carts.rb', line 98 def list(params = {}) parsed, = HubSpotSDK::Crm::Objects::CartListParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "crm/objects/2026-03/carts", query: query.transform_keys(properties_with_history: "propertiesWithHistory"), page: HubSpotSDK::Internal::Page, model: HubSpotSDK::Crm::SimplePublicObjectWithAssociations, options: ) end |
#search(after:, filter_groups:, limit:, properties:, sorts:, query: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::CollectionResponseWithTotalSimplePublicObject
Search for carts based on the specified search criteria, such as filters and properties, and retrieve the matching results.
192 193 194 195 196 197 198 199 200 201 |
# File 'lib/hubspot_sdk/resources/crm/objects/carts.rb', line 192 def search(params) parsed, = HubSpotSDK::Crm::Objects::CartSearchParams.dump_request(params) @client.request( method: :post, path: "crm/objects/2026-03/carts/search", body: parsed, model: HubSpotSDK::Crm::CollectionResponseWithTotalSimplePublicObject, options: ) end |
#update(cart_id, properties:, id_property: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::SimplePublicObject
Some parameter documentations has been truncated, see Models::Crm::Objects::CartUpdateParams for more details.
Perform a partial update of a cart, specified by its ID. Alternatively, you can specify a cart by a unique property value using the ‘idProperty` query parameter. 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.
59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/hubspot_sdk/resources/crm/objects/carts.rb', line 59 def update(cart_id, params) query_params = [:id_property] parsed, = HubSpotSDK::Crm::Objects::CartUpdateParams.dump_request(params) query = HubSpotSDK::Internal::Util.encode_query_params(parsed.slice(*query_params)) @client.request( method: :patch, path: ["crm/objects/2026-03/carts/%1$s", cart_id], query: query.transform_keys(id_property: "idProperty"), body: parsed.except(*query_params), model: HubSpotSDK::Crm::SimplePublicObject, options: ) end |