Class: Hubspot::Crm::Associations::V4::BasicApi

Inherits:
Object
  • Object
show all
Includes:
Helpers::GetAllHelper
Defined in:
lib/hubspot/codegen/crm/associations/v4/api/basic_api.rb

Constant Summary

Constants included from Helpers::GetAllHelper

Helpers::GetAllHelper::MAX_PAGE_SIZE

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helpers::GetAllHelper

#get_all

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ BasicApi

Returns a new instance of BasicApi.



24
25
26
# File 'lib/hubspot/codegen/crm/associations/v4/api/basic_api.rb', line 24

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



22
23
24
# File 'lib/hubspot/codegen/crm/associations/v4/api/basic_api.rb', line 22

def api_client
  @api_client
end

Instance Method Details

#archive(object_type, object_id, to_object_type, to_object_id, opts = {}) ⇒ nil

Delete deletes all associations between two records.

Parameters:

  • object_type (String)
  • object_id (String)
  • to_object_type (String)
  • to_object_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


35
36
37
38
# File 'lib/hubspot/codegen/crm/associations/v4/api/basic_api.rb', line 35

def archive(object_type, object_id, to_object_type, to_object_id, opts = {})
  archive_with_http_info(object_type, object_id, to_object_type, to_object_id, opts)
  nil
end

#archive_with_http_info(object_type, object_id, to_object_type, to_object_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete deletes all associations between two records.

Parameters:

  • object_type (String)
  • object_id (String)
  • to_object_type (String)
  • to_object_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(nil, Integer, Hash)>)

    nil, response status code and response headers



48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
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
99
100
101
102
103
104
105
106
# File 'lib/hubspot/codegen/crm/associations/v4/api/basic_api.rb', line 48

def archive_with_http_info(object_type, object_id, to_object_type, to_object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.archive ...'
  end
  # verify the required parameter 'object_type' is set
  if @api_client.config.client_side_validation && object_type.nil?
    fail ArgumentError, "Missing the required parameter 'object_type' when calling BasicApi.archive"
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.archive"
  end
  # verify the required parameter 'to_object_type' is set
  if @api_client.config.client_side_validation && to_object_type.nil?
    fail ArgumentError, "Missing the required parameter 'to_object_type' when calling BasicApi.archive"
  end
  # verify the required parameter 'to_object_id' is set
  if @api_client.config.client_side_validation && to_object_id.nil?
    fail ArgumentError, "Missing the required parameter 'to_object_id' when calling BasicApi.archive"
  end
  # resource path
  local_var_path = '/crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}/{toObjectId}'.sub('{' + 'objectType' + '}', CGI.escape(object_type.to_s)).sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)).sub('{' + 'toObjectType' + '}', CGI.escape(to_object_type.to_s)).sub('{' + 'toObjectId' + '}', CGI.escape(to_object_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.archive",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BasicApi#archive\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create(object_type, object_id, to_object_type, to_object_id, association_spec, opts = {}) ⇒ LabelsBetweenObjectPair

Create Set association labels between two records.

Parameters:

  • object_type (String)
  • object_id (String)
  • to_object_type (String)
  • to_object_id (String)
  • association_spec (Array<AssociationSpec>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



117
118
119
120
# File 'lib/hubspot/codegen/crm/associations/v4/api/basic_api.rb', line 117

def create(object_type, object_id, to_object_type, to_object_id, association_spec, opts = {})
  data, _status_code, _headers = create_with_http_info(object_type, object_id, to_object_type, to_object_id, association_spec, opts)
  data
end

#create_default(from_object_type, from_object_id, to_object_type, to_object_id, opts = {}) ⇒ BatchResponsePublicDefaultAssociation

Create Default Create the default (most generic) association type between two object types

Parameters:

  • from_object_type (String)
  • from_object_id (String)
  • to_object_type (String)
  • to_object_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



208
209
210
211
# File 'lib/hubspot/codegen/crm/associations/v4/api/basic_api.rb', line 208

def create_default(from_object_type, from_object_id, to_object_type, to_object_id, opts = {})
  data, _status_code, _headers = create_default_with_http_info(from_object_type, from_object_id, to_object_type, to_object_id, opts)
  data
end

#create_default_with_http_info(from_object_type, from_object_id, to_object_type, to_object_id, opts = {}) ⇒ Array<(BatchResponsePublicDefaultAssociation, Integer, Hash)>

Create Default Create the default (most generic) association type between two object types

Parameters:

  • from_object_type (String)
  • from_object_id (String)
  • to_object_type (String)
  • to_object_id (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
# File 'lib/hubspot/codegen/crm/associations/v4/api/basic_api.rb', line 221

def create_default_with_http_info(from_object_type, from_object_id, to_object_type, to_object_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.create_default ...'
  end
  # verify the required parameter 'from_object_type' is set
  if @api_client.config.client_side_validation && from_object_type.nil?
    fail ArgumentError, "Missing the required parameter 'from_object_type' when calling BasicApi.create_default"
  end
  # verify the required parameter 'from_object_id' is set
  if @api_client.config.client_side_validation && from_object_id.nil?
    fail ArgumentError, "Missing the required parameter 'from_object_id' when calling BasicApi.create_default"
  end
  # verify the required parameter 'to_object_type' is set
  if @api_client.config.client_side_validation && to_object_type.nil?
    fail ArgumentError, "Missing the required parameter 'to_object_type' when calling BasicApi.create_default"
  end
  # verify the required parameter 'to_object_id' is set
  if @api_client.config.client_side_validation && to_object_id.nil?
    fail ArgumentError, "Missing the required parameter 'to_object_id' when calling BasicApi.create_default"
  end
  # resource path
  local_var_path = '/crm/v4/objects/{fromObjectType}/{fromObjectId}/associations/default/{toObjectType}/{toObjectId}'.sub('{' + 'fromObjectType' + '}', CGI.escape(from_object_type.to_s)).sub('{' + 'fromObjectId' + '}', CGI.escape(from_object_id.to_s)).sub('{' + 'toObjectType' + '}', CGI.escape(to_object_type.to_s)).sub('{' + 'toObjectId' + '}', CGI.escape(to_object_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'BatchResponsePublicDefaultAssociation'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.create_default",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BasicApi#create_default\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#create_with_http_info(object_type, object_id, to_object_type, to_object_id, association_spec, opts = {}) ⇒ Array<(LabelsBetweenObjectPair, Integer, Hash)>

Create Set association labels between two records.

Parameters:

  • object_type (String)
  • object_id (String)
  • to_object_type (String)
  • to_object_id (String)
  • association_spec (Array<AssociationSpec>)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(LabelsBetweenObjectPair, Integer, Hash)>)

    LabelsBetweenObjectPair data, response status code and response headers



131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/hubspot/codegen/crm/associations/v4/api/basic_api.rb', line 131

def create_with_http_info(object_type, object_id, to_object_type, to_object_id, association_spec, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.create ...'
  end
  # verify the required parameter 'object_type' is set
  if @api_client.config.client_side_validation && object_type.nil?
    fail ArgumentError, "Missing the required parameter 'object_type' when calling BasicApi.create"
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.create"
  end
  # verify the required parameter 'to_object_type' is set
  if @api_client.config.client_side_validation && to_object_type.nil?
    fail ArgumentError, "Missing the required parameter 'to_object_type' when calling BasicApi.create"
  end
  # verify the required parameter 'to_object_id' is set
  if @api_client.config.client_side_validation && to_object_id.nil?
    fail ArgumentError, "Missing the required parameter 'to_object_id' when calling BasicApi.create"
  end
  # verify the required parameter 'association_spec' is set
  if @api_client.config.client_side_validation && association_spec.nil?
    fail ArgumentError, "Missing the required parameter 'association_spec' when calling BasicApi.create"
  end
  # resource path
  local_var_path = '/crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}/{toObjectId}'.sub('{' + 'objectType' + '}', CGI.escape(object_type.to_s)).sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)).sub('{' + 'toObjectType' + '}', CGI.escape(to_object_type.to_s)).sub('{' + 'toObjectId' + '}', CGI.escape(to_object_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(association_spec)

  # return_type
  return_type = opts[:debug_return_type] || 'LabelsBetweenObjectPair'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.create",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BasicApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_page(object_type, object_id, to_object_type, opts = {}) ⇒ CollectionResponseMultiAssociatedObjectWithLabelForwardPaging

List List all associations of an object by object type. Limit 500 per call.

Parameters:

  • object_type (String)
  • object_id (String)
  • to_object_type (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :after (String)

    The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.

  • :limit (Integer)

    The maximum number of results to display per page. (default to 500)

Returns:



290
291
292
293
# File 'lib/hubspot/codegen/crm/associations/v4/api/basic_api.rb', line 290

def get_page(object_type, object_id, to_object_type, opts = {})
  data, _status_code, _headers = get_page_with_http_info(object_type, object_id, to_object_type, opts)
  data
end

#get_page_with_http_info(object_type, object_id, to_object_type, opts = {}) ⇒ Array<(CollectionResponseMultiAssociatedObjectWithLabelForwardPaging, Integer, Hash)>

List List all associations of an object by object type. Limit 500 per call.

Parameters:

  • object_type (String)
  • object_id (String)
  • to_object_type (String)
  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :after (String)

    The paging cursor token of the last successfully read resource will be returned as the &#x60;paging.next.after&#x60; JSON property of a paged response containing more results.

  • :limit (Integer)

    The maximum number of results to display per page. (default to 500)

Returns:



304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/hubspot/codegen/crm/associations/v4/api/basic_api.rb', line 304

def get_page_with_http_info(object_type, object_id, to_object_type, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: BasicApi.get_page ...'
  end
  # verify the required parameter 'object_type' is set
  if @api_client.config.client_side_validation && object_type.nil?
    fail ArgumentError, "Missing the required parameter 'object_type' when calling BasicApi.get_page"
  end
  # verify the required parameter 'object_id' is set
  if @api_client.config.client_side_validation && object_id.nil?
    fail ArgumentError, "Missing the required parameter 'object_id' when calling BasicApi.get_page"
  end
  # verify the required parameter 'to_object_type' is set
  if @api_client.config.client_side_validation && to_object_type.nil?
    fail ArgumentError, "Missing the required parameter 'to_object_type' when calling BasicApi.get_page"
  end
  # resource path
  local_var_path = '/crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}'.sub('{' + 'objectType' + '}', CGI.escape(object_type.to_s)).sub('{' + 'objectId' + '}', CGI.escape(object_id.to_s)).sub('{' + 'toObjectType' + '}', CGI.escape(to_object_type.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'after'] = opts[:'after'] if !opts[:'after'].nil?
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json', '*/*'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'CollectionResponseMultiAssociatedObjectWithLabelForwardPaging'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['oauth2']

  new_options = opts.merge(
    :operation => :"BasicApi.get_page",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: BasicApi#get_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end