Class: HubSpotSDK::Resources::Crm::Associations
- Inherits:
-
Object
- Object
- HubSpotSDK::Resources::Crm::Associations
- Defined in:
- lib/hubspot_sdk/resources/crm/associations.rb,
lib/hubspot_sdk/resources/crm/associations/batch.rb
Defined Under Namespace
Classes: Batch
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(to_object_id, from_object_type:, from_object_id:, to_object_type:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::BatchResponsePublicDefaultAssociation
Create the default (most generic) association type between two object types.
-
#delete(to_object_id, object_type:, object_id_:, to_object_type:, request_options: {}) ⇒ nil
deletes all associations between two records.
-
#initialize(client:) ⇒ Associations
constructor
private
A new instance of Associations.
-
#list(to_object_type, object_type:, object_id_:, after: nil, limit: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Crm::MultiAssociatedObjectWithLabel>
Some parameter documentations has been truncated, see Models::Crm::AssociationListParams for more details.
-
#request_high_usage_report(user_id, request_options: {}) ⇒ HubSpotSDK::Models::Crm::ReportCreationResponse
Requests a report of all objects in the portal which have a high usage of associations.
- #search(object_type, after:, filter_groups:, limit:, properties:, sorts:, query: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::CollectionResponseWithTotalSimplePublicObject
-
#update_labels(to_object_id, object_type:, object_id_:, to_object_type:, body:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::LabelsBetweenObjectPair
Set association labels between two records.
Constructor Details
#initialize(client:) ⇒ Associations
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 Associations.
244 245 246 247 |
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 244 def initialize(client:) @client = client @batch = HubSpotSDK::Resources::Crm::Associations::Batch.new(client: client) end |
Instance Attribute Details
#batch ⇒ HubSpotSDK::Resources::Crm::Associations::Batch (readonly)
8 9 10 |
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 8 def batch @batch end |
Instance Method Details
#create(to_object_id, from_object_type:, from_object_id:, to_object_type:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::BatchResponsePublicDefaultAssociation
Create the default (most generic) association type between two object types
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 23 def create(to_object_id, params) parsed, = HubSpotSDK::Crm::AssociationCreateParams.dump_request(params) from_object_type = parsed.delete(:from_object_type) do raise ArgumentError.new("missing required path argument #{_1}") end from_object_id = parsed.delete(:from_object_id) do raise ArgumentError.new("missing required path argument #{_1}") end to_object_type = parsed.delete(:to_object_type) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :put, path: [ "crm/objects/2026-03/%1$s/%2$s/associations/default/%3$s/%4$s", from_object_type, from_object_id, to_object_type, to_object_id ], model: HubSpotSDK::Crm::BatchResponsePublicDefaultAssociation, options: ) end |
#delete(to_object_id, object_type:, object_id_:, to_object_type:, request_options: {}) ⇒ nil
deletes all associations between two records.
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 113 def delete(to_object_id, params) parsed, = HubSpotSDK::Crm::AssociationDeleteParams.dump_request(params) object_type = parsed.delete(:object_type) do raise ArgumentError.new("missing required path argument #{_1}") end object_id_ = parsed.delete(:object_id_) do raise ArgumentError.new("missing required path argument #{_1}") end to_object_type = parsed.delete(:to_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/associations/%3$s/%4$s", object_type, object_id_, to_object_type, to_object_id ], model: NilClass, options: ) end |
#list(to_object_type, object_type:, object_id_:, after: nil, limit: nil, request_options: {}) ⇒ HubSpotSDK::Internal::Page<HubSpotSDK::Models::Crm::MultiAssociatedObjectWithLabel>
Some parameter documentations has been truncated, see Models::Crm::AssociationListParams for more details.
Retrieve all associations between a specific record and an object type. Limit 500 per call.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 74 def list(to_object_type, params) parsed, = HubSpotSDK::Crm::AssociationListParams.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 object_id_ = parsed.delete(:object_id_) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :get, path: [ "crm/objects/2026-03/%1$s/%2$s/associations/%3$s", object_type, object_id_, to_object_type ], query: query, page: HubSpotSDK::Internal::Page, model: HubSpotSDK::Crm::MultiAssociatedObjectWithLabel, options: ) end |
#request_high_usage_report(user_id, request_options: {}) ⇒ HubSpotSDK::Models::Crm::ReportCreationResponse
Requests a report of all objects in the portal which have a high usage of associations
152 153 154 155 156 157 158 159 |
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 152 def request_high_usage_report(user_id, params = {}) @client.request( method: :post, path: ["crm/associations/2026-03/usage/high-usage-report/%1$s", user_id], model: HubSpotSDK::Crm::ReportCreationResponse, options: params[:request_options] ) end |
#search(object_type, after:, filter_groups:, limit:, properties:, sorts:, query: nil, request_options: {}) ⇒ HubSpotSDK::Models::Crm::CollectionResponseWithTotalSimplePublicObject
182 183 184 185 186 187 188 189 190 191 |
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 182 def search(object_type, params) parsed, = HubSpotSDK::Crm::AssociationSearchParams.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_labels(to_object_id, object_type:, object_id_:, to_object_type:, body:, request_options: {}) ⇒ HubSpotSDK::Models::Crm::LabelsBetweenObjectPair
Set association labels between two records.
212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/hubspot_sdk/resources/crm/associations.rb', line 212 def update_labels(to_object_id, params) parsed, = HubSpotSDK::Crm::AssociationUpdateLabelsParams.dump_request(params) object_type = parsed.delete(:object_type) do raise ArgumentError.new("missing required path argument #{_1}") end object_id_ = parsed.delete(:object_id_) do raise ArgumentError.new("missing required path argument #{_1}") end to_object_type = parsed.delete(:to_object_type) do raise ArgumentError.new("missing required path argument #{_1}") end @client.request( method: :put, path: [ "crm/objects/2026-03/%1$s/%2$s/associations/%3$s/%4$s", object_type, object_id_, to_object_type, to_object_id ], body: parsed[:body], model: HubSpotSDK::Crm::LabelsBetweenObjectPair, options: ) end |