Class: CropwisePlatformSdk::ContractsApi

Inherits:
Object
  • Object
show all
Defined in:
lib/cropwise-platform-sdk/api/contracts_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ ContractsApi

Returns a new instance of ContractsApi.



19
20
21
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 19

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

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_workspace_contract_entity_workspace_id_contract_id(workspace_id, contract_id, opts = {}) ⇒ GetV2ContractsWorkspaceIdContractsContractId200Response

Delete contract entities Delete a Contract Entity

Parameters:

  • workspace_id (String)

    Numeric ID of the account

  • contract_id (String)

    Numeric ID of the contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :request_body (Array<String>)

Returns:



29
30
31
32
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 29

def delete_workspace_contract_entity_workspace_id_contract_id(workspace_id, contract_id, opts = {})
  data, _status_code, _headers = delete_workspace_contract_entity_workspace_id_contract_id_with_http_info(workspace_id, contract_id, opts)
  data
end

#delete_workspace_contract_entity_workspace_id_contract_id_with_http_info(workspace_id, contract_id, opts = {}) ⇒ Array<(GetV2ContractsWorkspaceIdContractsContractId200Response, Integer, Hash)>

Delete contract entities Delete a Contract Entity

Parameters:

  • workspace_id (String)

    Numeric ID of the account

  • contract_id (String)

    Numeric ID of the contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :request_body (Array<String>)

Returns:



41
42
43
44
45
46
47
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
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 41

def delete_workspace_contract_entity_workspace_id_contract_id_with_http_info(workspace_id, contract_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContractsApi.delete_workspace_contract_entity_workspace_id_contract_id ...'
  end
  # verify the required parameter 'workspace_id' is set
  if @api_client.config.client_side_validation && workspace_id.nil?
    fail ArgumentError, "Missing the required parameter 'workspace_id' when calling ContractsApi.delete_workspace_contract_entity_workspace_id_contract_id"
  end
  # verify the required parameter 'contract_id' is set
  if @api_client.config.client_side_validation && contract_id.nil?
    fail ArgumentError, "Missing the required parameter 'contract_id' when calling ContractsApi.delete_workspace_contract_entity_workspace_id_contract_id"
  end
  # resource path
  local_var_path = '/v2/workspaces/{workspaceId}/contracts/{contractId}/entities'.sub('{' + 'workspaceId' + '}', CGI.escape(workspace_id.to_s)).sub('{' + 'contractId' + '}', CGI.escape(contract_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(opts[:'request_body'])

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

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

  new_options = opts.merge(
    :operation => :"ContractsApi.delete_workspace_contract_entity_workspace_id_contract_id",
    :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: ContractsApi#delete_workspace_contract_entity_workspace_id_contract_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#delete_workspace_contract_workspace_id_contract_id(workspace_id, contract_id, opts = {}) ⇒ nil

Delete Contract Delete a Contract

Parameters:

  • workspace_id (String)

    Numeric ID of the account

  • contract_id (String)

    Numeric ID of the contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (nil)


104
105
106
107
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 104

def delete_workspace_contract_workspace_id_contract_id(workspace_id, contract_id, opts = {})
  delete_workspace_contract_workspace_id_contract_id_with_http_info(workspace_id, contract_id, opts)
  nil
end

#delete_workspace_contract_workspace_id_contract_id_with_http_info(workspace_id, contract_id, opts = {}) ⇒ Array<(nil, Integer, Hash)>

Delete Contract Delete a Contract

Parameters:

  • workspace_id (String)

    Numeric ID of the account

  • contract_id (String)

    Numeric ID of the contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    nil, response status code and response headers



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
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
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 115

def delete_workspace_contract_workspace_id_contract_id_with_http_info(workspace_id, contract_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContractsApi.delete_workspace_contract_workspace_id_contract_id ...'
  end
  # verify the required parameter 'workspace_id' is set
  if @api_client.config.client_side_validation && workspace_id.nil?
    fail ArgumentError, "Missing the required parameter 'workspace_id' when calling ContractsApi.delete_workspace_contract_workspace_id_contract_id"
  end
  # verify the required parameter 'contract_id' is set
  if @api_client.config.client_side_validation && contract_id.nil?
    fail ArgumentError, "Missing the required parameter 'contract_id' when calling ContractsApi.delete_workspace_contract_workspace_id_contract_id"
  end
  # resource path
  local_var_path = '/v2/workspaces/{workspaceId}/contracts/{contractId}'.sub('{' + 'workspaceId' + '}', CGI.escape(workspace_id.to_s)).sub('{' + 'contractId' + '}', CGI.escape(contract_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]

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

  new_options = opts.merge(
    :operation => :"ContractsApi.delete_workspace_contract_workspace_id_contract_id",
    :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: ContractsApi#delete_workspace_contract_workspace_id_contract_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contracts_by_appid(app_id, opts = {}) ⇒ PageableContracts

Get all contracts for an app Get all contracts for an app

Parameters:

  • app_id (String)

    Numeric ID of the App

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



172
173
174
175
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 172

def get_contracts_by_appid(app_id, opts = {})
  data, _status_code, _headers = get_contracts_by_appid_with_http_info(app_id, opts)
  data
end

#get_contracts_by_appid_with_http_info(app_id, opts = {}) ⇒ Array<(PageableContracts, Integer, Hash)>

Get all contracts for an app Get all contracts for an app

Parameters:

  • app_id (String)

    Numeric ID of the App

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

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

    PageableContracts data, response status code and response headers



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 182

def get_contracts_by_appid_with_http_info(app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContractsApi.get_contracts_by_appid ...'
  end
  # verify the required parameter 'app_id' is set
  if @api_client.config.client_side_validation && app_id.nil?
    fail ArgumentError, "Missing the required parameter 'app_id' when calling ContractsApi.get_contracts_by_appid"
  end
  # resource path
  local_var_path = '/v2/apps/{appId}/contracts'.sub('{' + 'appId' + '}', CGI.escape(app_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] || 'PageableContracts'

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

  new_options = opts.merge(
    :operation => :"ContractsApi.get_contracts_by_appid",
    :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: ContractsApi#get_contracts_by_appid\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contracts_by_entitlement(opts = {}) ⇒ ContractsByEntitlements

Get contracts by entitlements

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :entitlements (Array<String>)
  • :should_contract_have_all_entitlements (Boolean)
  • :should_consider_deleted_contracts (Boolean)
  • :last_key (String)
  • :last_key_complement (Integer)

Returns:



238
239
240
241
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 238

def get_contracts_by_entitlement(opts = {})
  data, _status_code, _headers = get_contracts_by_entitlement_with_http_info(opts)
  data
end

#get_contracts_by_entitlement_ids(opts = {}) ⇒ PageableContractsEntitlementAsId

Get contracts by entitlements ids

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :contains (Array<String>)

    If a contract must have all entitlement&#39;s keys or just some of them. Default is SOME_ENTITLEMENTS

  • :include_deleted (Boolean)

    If deleted contracts will be retrieved as well. Default is FALSE

  • :last_key (String)
  • :size (Integer)
  • :uuid_list_model (UUIDListModel)

Returns:



308
309
310
311
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 308

def get_contracts_by_entitlement_ids(opts = {})
  data, _status_code, _headers = get_contracts_by_entitlement_ids_with_http_info(opts)
  data
end

#get_contracts_by_entitlement_ids_with_http_info(opts = {}) ⇒ Array<(PageableContractsEntitlementAsId, Integer, Hash)>

Get contracts by entitlements ids

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :contains (Array<String>)

    If a contract must have all entitlement&#39;s keys or just some of them. Default is SOME_ENTITLEMENTS

  • :include_deleted (Boolean)

    If deleted contracts will be retrieved as well. Default is FALSE

  • :last_key (String)
  • :size (Integer)
  • :uuid_list_model (UUIDListModel)

Returns:



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
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 321

def get_contracts_by_entitlement_ids_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContractsApi.get_contracts_by_entitlement_ids ...'
  end
  allowable_values = []
  if @api_client.config.client_side_validation && opts[:'contains'] && !opts[:'contains'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"contains\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v2/entitlements/ids/contracts'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'contains'] = @api_client.build_collection_param(opts[:'contains'], :multi) if !opts[:'contains'].nil?
  query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil?
  query_params[:'last_key'] = opts[:'last_key'] if !opts[:'last_key'].nil?
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?

  # 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(opts[:'uuid_list_model'])

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

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

  new_options = opts.merge(
    :operation => :"ContractsApi.get_contracts_by_entitlement_ids",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContractsApi#get_contracts_by_entitlement_ids\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contracts_by_entitlement_keys(opts = {}) ⇒ PageableContractsEntitlementAsId

Get contracts by entitlements keys

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :contains (Array<String>)

    If a contract must have all entitlement&#39;s keys or just some of them. Default is SOME_ENTITLEMENTS

  • :include_deleted (Boolean)

    If deleted contracts will be retrieved as well. Default is FALSE

  • :last_key (String)
  • :size (Integer)
  • :keys_list_model (KeysListModel)

Returns:



386
387
388
389
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 386

def get_contracts_by_entitlement_keys(opts = {})
  data, _status_code, _headers = get_contracts_by_entitlement_keys_with_http_info(opts)
  data
end

#get_contracts_by_entitlement_keys_with_http_info(opts = {}) ⇒ Array<(PageableContractsEntitlementAsId, Integer, Hash)>

Get contracts by entitlements keys

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :contains (Array<String>)

    If a contract must have all entitlement&#39;s keys or just some of them. Default is SOME_ENTITLEMENTS

  • :include_deleted (Boolean)

    If deleted contracts will be retrieved as well. Default is FALSE

  • :last_key (String)
  • :size (Integer)
  • :keys_list_model (KeysListModel)

Returns:



399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 399

def get_contracts_by_entitlement_keys_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContractsApi.get_contracts_by_entitlement_keys ...'
  end
  allowable_values = []
  if @api_client.config.client_side_validation && opts[:'contains'] && !opts[:'contains'].all? { |item| allowable_values.include?(item) }
    fail ArgumentError, "invalid value for \"contains\", must include one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/v2/entitlements/keys/contracts'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'contains'] = @api_client.build_collection_param(opts[:'contains'], :multi) if !opts[:'contains'].nil?
  query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].nil?
  query_params[:'last_key'] = opts[:'last_key'] if !opts[:'last_key'].nil?
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?

  # 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(opts[:'keys_list_model'])

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

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

  new_options = opts.merge(
    :operation => :"ContractsApi.get_contracts_by_entitlement_keys",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContractsApi#get_contracts_by_entitlement_keys\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contracts_by_entitlement_with_http_info(opts = {}) ⇒ Array<(ContractsByEntitlements, Integer, Hash)>

Get contracts by entitlements

Parameters:

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :entitlements (Array<String>)
  • :should_contract_have_all_entitlements (Boolean)
  • :should_consider_deleted_contracts (Boolean)
  • :last_key (String)
  • :last_key_complement (Integer)

Returns:

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

    ContractsByEntitlements data, response status code and response headers



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
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 251

def get_contracts_by_entitlement_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContractsApi.get_contracts_by_entitlement ...'
  end
  # resource path
  local_var_path = '/v2/workspaces/contracts/by-entitlements'

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'entitlements'] = @api_client.build_collection_param(opts[:'entitlements'], :multi) if !opts[:'entitlements'].nil?
  query_params[:'shouldContractHaveAllEntitlements'] = opts[:'should_contract_have_all_entitlements'] if !opts[:'should_contract_have_all_entitlements'].nil?
  query_params[:'shouldConsiderDeletedContracts'] = opts[:'should_consider_deleted_contracts'] if !opts[:'should_consider_deleted_contracts'].nil?
  query_params[:'lastKey'] = opts[:'last_key'] if !opts[:'last_key'].nil?
  query_params[:'lastKeyComplement'] = opts[:'last_key_complement'] if !opts[:'last_key_complement'].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] || 'ContractsByEntitlements'

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

  new_options = opts.merge(
    :operation => :"ContractsApi.get_contracts_by_entitlement",
    :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: ContractsApi#get_contracts_by_entitlement\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_contracts_per_entity_workspace_id_entity_id(workspace_id, entity_id, opts = {}) ⇒ Array<GetV2ContractsWorkspaceIdContractsContractId200Response>

Get contracts by entity Get contracts related to an entity

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

  • entity_id (String)

    ID of the entity

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



462
463
464
465
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 462

def get_contracts_per_entity_workspace_id_entity_id(workspace_id, entity_id, opts = {})
  data, _status_code, _headers = get_contracts_per_entity_workspace_id_entity_id_with_http_info(workspace_id, entity_id, opts)
  data
end

#get_contracts_per_entity_workspace_id_entity_id_with_http_info(workspace_id, entity_id, opts = {}) ⇒ Array<(Array<GetV2ContractsWorkspaceIdContractsContractId200Response>, Integer, Hash)>

Get contracts by entity Get contracts related to an entity

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

  • entity_id (String)

    ID of the entity

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 473

def get_contracts_per_entity_workspace_id_entity_id_with_http_info(workspace_id, entity_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContractsApi.get_contracts_per_entity_workspace_id_entity_id ...'
  end
  # verify the required parameter 'workspace_id' is set
  if @api_client.config.client_side_validation && workspace_id.nil?
    fail ArgumentError, "Missing the required parameter 'workspace_id' when calling ContractsApi.get_contracts_per_entity_workspace_id_entity_id"
  end
  # verify the required parameter 'entity_id' is set
  if @api_client.config.client_side_validation && entity_id.nil?
    fail ArgumentError, "Missing the required parameter 'entity_id' when calling ContractsApi.get_contracts_per_entity_workspace_id_entity_id"
  end
  # resource path
  local_var_path = '/v2/workspaces/{workspaceId}/entities/{entityId}'.sub('{' + 'workspaceId' + '}', CGI.escape(workspace_id.to_s)).sub('{' + 'entityId' + '}', CGI.escape(entity_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] || 'Array<GetV2ContractsWorkspaceIdContractsContractId200Response>'

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

  new_options = opts.merge(
    :operation => :"ContractsApi.get_contracts_per_entity_workspace_id_entity_id",
    :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: ContractsApi#get_contracts_per_entity_workspace_id_entity_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_v2_contracts_workspace_id_contracts_contract_id(workspace_id, contract_id, opts = {}) ⇒ GetV2ContractsWorkspaceIdContractsContractId200Response

Get a Contract Get a Contract

Parameters:

  • workspace_id (String)

    Numeric ID of the account

  • contract_id (String)

    Numeric ID of the contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



531
532
533
534
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 531

def get_v2_contracts_workspace_id_contracts_contract_id(workspace_id, contract_id, opts = {})
  data, _status_code, _headers = get_v2_contracts_workspace_id_contracts_contract_id_with_http_info(workspace_id, contract_id, opts)
  data
end

#get_v2_contracts_workspace_id_contracts_contract_id_with_http_info(workspace_id, contract_id, opts = {}) ⇒ Array<(GetV2ContractsWorkspaceIdContractsContractId200Response, Integer, Hash)>

Get a Contract Get a Contract

Parameters:

  • workspace_id (String)

    Numeric ID of the account

  • contract_id (String)

    Numeric ID of the contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 542

def get_v2_contracts_workspace_id_contracts_contract_id_with_http_info(workspace_id, contract_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContractsApi.get_v2_contracts_workspace_id_contracts_contract_id ...'
  end
  # verify the required parameter 'workspace_id' is set
  if @api_client.config.client_side_validation && workspace_id.nil?
    fail ArgumentError, "Missing the required parameter 'workspace_id' when calling ContractsApi.get_v2_contracts_workspace_id_contracts_contract_id"
  end
  # verify the required parameter 'contract_id' is set
  if @api_client.config.client_side_validation && contract_id.nil?
    fail ArgumentError, "Missing the required parameter 'contract_id' when calling ContractsApi.get_v2_contracts_workspace_id_contracts_contract_id"
  end
  # resource path
  local_var_path = '/v2/workspaces/{workspaceId}/contracts/{contractId}'.sub('{' + 'workspaceId' + '}', CGI.escape(workspace_id.to_s)).sub('{' + 'contractId' + '}', CGI.escape(contract_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', 'application/xml'])

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

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

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

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

  new_options = opts.merge(
    :operation => :"ContractsApi.get_v2_contracts_workspace_id_contracts_contract_id",
    :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: ContractsApi#get_v2_contracts_workspace_id_contracts_contract_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_workspace_contracts_workspace_id(workspace_id, opts = {}) ⇒ PageableContracts

Get Contracts By Account Get all contracts from a workspace

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :size (Integer)

    Number of contracts to return

  • :last_key (String)

    Id of the last contract returned by the previous query

  • :include_waiting_for_payment (Boolean)

    Allow that contracts that are waiting for payment are also displayed

Returns:



602
603
604
605
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 602

def get_workspace_contracts_workspace_id(workspace_id, opts = {})
  data, _status_code, _headers = get_workspace_contracts_workspace_id_with_http_info(workspace_id, opts)
  data
end

#get_workspace_contracts_workspace_id_with_http_info(workspace_id, opts = {}) ⇒ Array<(PageableContracts, Integer, Hash)>

Get Contracts By Account Get all contracts from a workspace

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :size (Integer)

    Number of contracts to return

  • :last_key (String)

    Id of the last contract returned by the previous query

  • :include_waiting_for_payment (Boolean)

    Allow that contracts that are waiting for payment are also displayed

Returns:

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

    PageableContracts data, response status code and response headers



615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 615

def get_workspace_contracts_workspace_id_with_http_info(workspace_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContractsApi.get_workspace_contracts_workspace_id ...'
  end
  # verify the required parameter 'workspace_id' is set
  if @api_client.config.client_side_validation && workspace_id.nil?
    fail ArgumentError, "Missing the required parameter 'workspace_id' when calling ContractsApi.get_workspace_contracts_workspace_id"
  end
  # resource path
  local_var_path = '/v2/workspaces/{workspaceId}/contracts'.sub('{' + 'workspaceId' + '}', CGI.escape(workspace_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?
  query_params[:'last_key'] = opts[:'last_key'] if !opts[:'last_key'].nil?
  query_params[:'include_waiting_for_payment'] = opts[:'include_waiting_for_payment'] if !opts[:'include_waiting_for_payment'].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] || 'PageableContracts'

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

  new_options = opts.merge(
    :operation => :"ContractsApi.get_workspace_contracts_workspace_id",
    :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: ContractsApi#get_workspace_contracts_workspace_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_v2_contracts_workspace_id_contracts_contract_id_entities(workspace_id, contract_id, opts = {}) ⇒ GetV2ContractsWorkspaceIdContractsContractId200Response

Update a Contract Entity Update a Contract Entity

Parameters:

  • workspace_id (String)

    Numeric ID of the account

  • contract_id (String)

    Numeric ID of the contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



673
674
675
676
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 673

def post_v2_contracts_workspace_id_contracts_contract_id_entities(workspace_id, contract_id, opts = {})
  data, _status_code, _headers = post_v2_contracts_workspace_id_contracts_contract_id_entities_with_http_info(workspace_id, contract_id, opts)
  data
end

#post_v2_contracts_workspace_id_contracts_contract_id_entities_with_http_info(workspace_id, contract_id, opts = {}) ⇒ Array<(GetV2ContractsWorkspaceIdContractsContractId200Response, Integer, Hash)>

Update a Contract Entity Update a Contract Entity

Parameters:

  • workspace_id (String)

    Numeric ID of the account

  • contract_id (String)

    Numeric ID of the contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 685

def post_v2_contracts_workspace_id_contracts_contract_id_entities_with_http_info(workspace_id, contract_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContractsApi.post_v2_contracts_workspace_id_contracts_contract_id_entities ...'
  end
  # verify the required parameter 'workspace_id' is set
  if @api_client.config.client_side_validation && workspace_id.nil?
    fail ArgumentError, "Missing the required parameter 'workspace_id' when calling ContractsApi.post_v2_contracts_workspace_id_contracts_contract_id_entities"
  end
  # verify the required parameter 'contract_id' is set
  if @api_client.config.client_side_validation && contract_id.nil?
    fail ArgumentError, "Missing the required parameter 'contract_id' when calling ContractsApi.post_v2_contracts_workspace_id_contracts_contract_id_entities"
  end
  # resource path
  local_var_path = '/v2/workspaces/{workspaceId}/contracts/{contractId}/entities'.sub('{' + 'workspaceId' + '}', CGI.escape(workspace_id.to_s)).sub('{' + 'contractId' + '}', CGI.escape(contract_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(opts[:'post_v2_contracts_workspace_id_contracts_contract_id_entities_request'])

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

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

  new_options = opts.merge(
    :operation => :"ContractsApi.post_v2_contracts_workspace_id_contracts_contract_id_entities",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContractsApi#post_v2_contracts_workspace_id_contracts_contract_id_entities\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_workspace_contracts_workspace_id(workspace_id, opts = {}) ⇒ GetV2ContractsWorkspaceIdContractsContractId200Response

Add Contract to Account Add a contract to a workspace

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



748
749
750
751
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 748

def post_workspace_contracts_workspace_id(workspace_id, opts = {})
  data, _status_code, _headers = post_workspace_contracts_workspace_id_with_http_info(workspace_id, opts)
  data
end

#post_workspace_contracts_workspace_id_with_http_info(workspace_id, opts = {}) ⇒ Array<(GetV2ContractsWorkspaceIdContractsContractId200Response, Integer, Hash)>

Add Contract to Account Add a contract to a workspace

Parameters:

  • workspace_id (String)

    Numeric ID of the account to get

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 759

def post_workspace_contracts_workspace_id_with_http_info(workspace_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContractsApi.post_workspace_contracts_workspace_id ...'
  end
  # verify the required parameter 'workspace_id' is set
  if @api_client.config.client_side_validation && workspace_id.nil?
    fail ArgumentError, "Missing the required parameter 'workspace_id' when calling ContractsApi.post_workspace_contracts_workspace_id"
  end
  # resource path
  local_var_path = '/v2/workspaces/{workspaceId}/contracts'.sub('{' + 'workspaceId' + '}', CGI.escape(workspace_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(opts[:'contract'])

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

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

  new_options = opts.merge(
    :operation => :"ContractsApi.post_workspace_contracts_workspace_id",
    :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(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: ContractsApi#post_workspace_contracts_workspace_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#put_v2_contracts_workspace_id_contracts_contract_id(workspace_id, contract_id, opts = {}) ⇒ GetV2ContractsWorkspaceIdContractsContractId200Response

Update a Contract Update a Contract

Parameters:

  • workspace_id (String)

    Numeric ID of the account

  • contract_id (String)

    Numeric ID of the contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



819
820
821
822
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 819

def put_v2_contracts_workspace_id_contracts_contract_id(workspace_id, contract_id, opts = {})
  data, _status_code, _headers = put_v2_contracts_workspace_id_contracts_contract_id_with_http_info(workspace_id, contract_id, opts)
  data
end

#put_v2_contracts_workspace_id_contracts_contract_id_with_http_info(workspace_id, contract_id, opts = {}) ⇒ Array<(GetV2ContractsWorkspaceIdContractsContractId200Response, Integer, Hash)>

Update a Contract Update a Contract

Parameters:

  • workspace_id (String)

    Numeric ID of the account

  • contract_id (String)

    Numeric ID of the contract

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

Returns:



831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
# File 'lib/cropwise-platform-sdk/api/contracts_api.rb', line 831

def put_v2_contracts_workspace_id_contracts_contract_id_with_http_info(workspace_id, contract_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: ContractsApi.put_v2_contracts_workspace_id_contracts_contract_id ...'
  end
  # verify the required parameter 'workspace_id' is set
  if @api_client.config.client_side_validation && workspace_id.nil?
    fail ArgumentError, "Missing the required parameter 'workspace_id' when calling ContractsApi.put_v2_contracts_workspace_id_contracts_contract_id"
  end
  # verify the required parameter 'contract_id' is set
  if @api_client.config.client_side_validation && contract_id.nil?
    fail ArgumentError, "Missing the required parameter 'contract_id' when calling ContractsApi.put_v2_contracts_workspace_id_contracts_contract_id"
  end
  # resource path
  local_var_path = '/v2/workspaces/{workspaceId}/contracts/{contractId}'.sub('{' + 'workspaceId' + '}', CGI.escape(workspace_id.to_s)).sub('{' + 'contractId' + '}', CGI.escape(contract_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(opts[:'contract_data'])

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

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

  new_options = opts.merge(
    :operation => :"ContractsApi.put_v2_contracts_workspace_id_contracts_contract_id",
    :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: ContractsApi#put_v2_contracts_workspace_id_contracts_contract_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end