Class: CropwisePlatformSdk::PlansApi

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ PlansApi

Returns a new instance of PlansApi.



19
20
21
# File 'lib/cropwise-platform-sdk/api/plans_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/plans_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#delete_plans_plan_id(plan_id, opts = {}) ⇒ DeletePlansPlanId200Response

Delete Plan Removes a single plan

Parameters:

  • plan_id (String)

    Numeric ID of the plan to remove

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

    the optional parameters

Returns:



27
28
29
30
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 27

def delete_plans_plan_id(plan_id, opts = {})
  data, _status_code, _headers = delete_plans_plan_id_with_http_info(plan_id, opts)
  data
end

#delete_plans_plan_id_with_http_info(plan_id, opts = {}) ⇒ Array<(DeletePlansPlanId200Response, Integer, Hash)>

Delete Plan Removes a single plan

Parameters:

  • plan_id (String)

    Numeric ID of the plan to remove

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

    the optional parameters

Returns:



37
38
39
40
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
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 37

def delete_plans_plan_id_with_http_info(plan_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlansApi.delete_plans_plan_id ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling PlansApi.delete_plans_plan_id"
  end
  # resource path
  local_var_path = '/v2/plans/{planId}'.sub('{' + 'planId' + '}', CGI.escape(plan_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] || 'DeletePlansPlanId200Response'

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

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

#get_apps_app_idplans(app_id, opts = {}) ⇒ PageablePlans

Get Plans By App Get all plans from a single app

Parameters:

  • app_id (String)

    Numeric ID of the app to get

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

    the optional parameters

Options Hash (opts):

  • :size (Integer)

    Number of plans to return

  • :last_key (String)

    Id of the last plan returned by the previous query

  • :name (String)

    Filter plans containing this name

Returns:



93
94
95
96
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 93

def get_apps_app_idplans(app_id, opts = {})
  data, _status_code, _headers = get_apps_app_idplans_with_http_info(app_id, opts)
  data
end

#get_apps_app_idplans_with_http_info(app_id, opts = {}) ⇒ Array<(PageablePlans, Integer, Hash)>

Get Plans By App Get all plans from a single app

Parameters:

  • app_id (String)

    Numeric ID of the app to get

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

    the optional parameters

Options Hash (opts):

  • :size (Integer)

    Number of plans to return

  • :last_key (String)

    Id of the last plan returned by the previous query

  • :name (String)

    Filter plans containing this name

Returns:

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

    PageablePlans data, response status code and response headers



106
107
108
109
110
111
112
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 106

def get_apps_app_idplans_with_http_info(app_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlansApi.get_apps_app_idplans ...'
  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 PlansApi.get_apps_app_idplans"
  end
  # resource path
  local_var_path = '/v2/apps/{appId}/plans'.sub('{' + 'appId' + '}', CGI.escape(app_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[:'name'] = opts[:'name'] if !opts[:'name'].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] || 'PageablePlans'

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

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

#get_campaigns_from_plan(plan_id, opts = {}) ⇒ PageableCampaigns

Get Campaigns of plans Get all campaigns from a plan

Parameters:

  • plan_id (String)

    Numeric ID of the plan to get

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

    the optional parameters

Returns:



162
163
164
165
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 162

def get_campaigns_from_plan(plan_id, opts = {})
  data, _status_code, _headers = get_campaigns_from_plan_with_http_info(plan_id, opts)
  data
end

#get_campaigns_from_plan_with_http_info(plan_id, opts = {}) ⇒ Array<(PageableCampaigns, Integer, Hash)>

Get Campaigns of plans Get all campaigns from a plan

Parameters:

  • plan_id (String)

    Numeric ID of the plan to get

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

    the optional parameters

Returns:

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

    PageableCampaigns data, response status code and response headers



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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 172

def get_campaigns_from_plan_with_http_info(plan_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlansApi.get_campaigns_from_plan ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling PlansApi.get_campaigns_from_plan"
  end
  # resource path
  local_var_path = '/v2/plans/{planId}/campaigns'.sub('{' + 'planId' + '}', CGI.escape(plan_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] || 'PageableCampaigns'

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

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

#get_plans(opts = {}) ⇒ PageablePlans

Get All Plans Get all plans

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :size (Integer)

    Number of plans to return

  • :last_key (String)

    Id of the last plan returned by the previous query

  • :name (String)

    Filter plans containing this name

Returns:



227
228
229
230
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 227

def get_plans(opts = {})
  data, _status_code, _headers = get_plans_with_http_info(opts)
  data
end

#get_plans_plan_id(plan_id, opts = {}) ⇒ Plan

Get Plan by Id Get a single plan

Parameters:

  • plan_id (String)

    Numeric ID of the plan to get

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

    the optional parameters

Options Hash (opts):

  • :include_deleted (Boolean)

    Boolean to flag the inclusion of deleted plans

Returns:



292
293
294
295
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 292

def get_plans_plan_id(plan_id, opts = {})
  data, _status_code, _headers = get_plans_plan_id_with_http_info(plan_id, opts)
  data
end

#get_plans_plan_id_with_http_info(plan_id, opts = {}) ⇒ Array<(Plan, Integer, Hash)>

Get Plan by Id Get a single plan

Parameters:

  • plan_id (String)

    Numeric ID of the plan to get

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

    the optional parameters

Options Hash (opts):

  • :include_deleted (Boolean)

    Boolean to flag the inclusion of deleted plans

Returns:

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

    Plan data, response status code and response headers



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

def get_plans_plan_id_with_http_info(plan_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlansApi.get_plans_plan_id ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling PlansApi.get_plans_plan_id"
  end
  # resource path
  local_var_path = '/v2/plans/{planId}'.sub('{' + 'planId' + '}', CGI.escape(plan_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'include_deleted'] = opts[:'include_deleted'] if !opts[:'include_deleted'].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] || 'Plan'

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

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

#get_plans_with_http_info(opts = {}) ⇒ Array<(PageablePlans, Integer, Hash)>

Get All Plans Get all plans

Parameters:

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

    the optional parameters

Options Hash (opts):

  • :size (Integer)

    Number of plans to return

  • :last_key (String)

    Id of the last plan returned by the previous query

  • :name (String)

    Filter plans containing this name

Returns:

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

    PageablePlans data, response status code and response headers



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
280
281
282
283
284
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 239

def get_plans_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlansApi.get_plans ...'
  end
  # resource path
  local_var_path = '/v2/plans'

  # 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[:'name'] = opts[:'name'] if !opts[:'name'].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] || 'PageablePlans'

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

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

#get_v2_plans_plan_id_accounts(plan_id, opts = {}) ⇒ Array<String>

Get Accounts of Plan

Parameters:

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

    the optional parameters

Returns:

  • (Array<String>)


356
357
358
359
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 356

def get_v2_plans_plan_id_accounts(plan_id, opts = {})
  data, _status_code, _headers = get_v2_plans_plan_id_accounts_with_http_info(plan_id, opts)
  data
end

#get_v2_plans_plan_id_accounts_with_http_info(plan_id, opts = {}) ⇒ Array<(Array<String>, Integer, Hash)>

Get Accounts of Plan

Parameters:

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

    the optional parameters

Returns:

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

    Array<String> data, response status code and response headers



365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 365

def get_v2_plans_plan_id_accounts_with_http_info(plan_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlansApi.get_v2_plans_plan_id_accounts ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling PlansApi.get_v2_plans_plan_id_accounts"
  end
  # resource path
  local_var_path = '/v2/plans/{planId}/accounts'.sub('{' + 'planId' + '}', CGI.escape(plan_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<String>'

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

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

#get_v2_plans_plan_id_contracts(plan_id, opts = {}) ⇒ PageableContracts

Get Contracts By Plan Get all contracts from a plan

Parameters:

  • plan_id (String)
  • 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

Returns:



420
421
422
423
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 420

def get_v2_plans_plan_id_contracts(plan_id, opts = {})
  data, _status_code, _headers = get_v2_plans_plan_id_contracts_with_http_info(plan_id, opts)
  data
end

#get_v2_plans_plan_id_contracts_with_http_info(plan_id, opts = {}) ⇒ Array<(PageableContracts, Integer, Hash)>

Get Contracts By Plan Get all contracts from a plan

Parameters:

  • plan_id (String)
  • 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

Returns:

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

    PageableContracts data, response status code and response headers



432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 432

def get_v2_plans_plan_id_contracts_with_http_info(plan_id, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlansApi.get_v2_plans_plan_id_contracts ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling PlansApi.get_v2_plans_plan_id_contracts"
  end
  # resource path
  local_var_path = '/v2/plans/{planId}/contracts'.sub('{' + 'planId' + '}', CGI.escape(plan_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?

  # 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 => :"PlansApi.get_v2_plans_plan_id_contracts",
    :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: PlansApi#get_v2_plans_plan_id_contracts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#post_plans(plan, opts = {}) ⇒ Plan

Create a new Plan Creates a new plan

Parameters:

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

    the optional parameters

Returns:



487
488
489
490
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 487

def post_plans(plan, opts = {})
  data, _status_code, _headers = post_plans_with_http_info(plan, opts)
  data
end

#post_plans_with_http_info(plan, opts = {}) ⇒ Array<(Plan, Integer, Hash)>

Create a new Plan Creates a new plan

Parameters:

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

    the optional parameters

Returns:

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

    Plan data, response status code and response headers



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
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 497

def post_plans_with_http_info(plan, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlansApi.post_plans ...'
  end
  # verify the required parameter 'plan' is set
  if @api_client.config.client_side_validation && plan.nil?
    fail ArgumentError, "Missing the required parameter 'plan' when calling PlansApi.post_plans"
  end
  # resource path
  local_var_path = '/v2/plans'

  # 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(plan)

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

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

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

#put_plans_plan_id(plan_id, plan, opts = {}) ⇒ Plan

Edit Plan Updates a single plan

Parameters:

  • plan_id (String)

    Numeric ID of the plan to update

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

    the optional parameters

Returns:



556
557
558
559
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 556

def put_plans_plan_id(plan_id, plan, opts = {})
  data, _status_code, _headers = put_plans_plan_id_with_http_info(plan_id, plan, opts)
  data
end

#put_plans_plan_id_with_http_info(plan_id, plan, opts = {}) ⇒ Array<(Plan, Integer, Hash)>

Edit Plan Updates a single plan

Parameters:

  • plan_id (String)

    Numeric ID of the plan to update

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

    the optional parameters

Returns:

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

    Plan data, response status code and response headers



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
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
# File 'lib/cropwise-platform-sdk/api/plans_api.rb', line 567

def put_plans_plan_id_with_http_info(plan_id, plan, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: PlansApi.put_plans_plan_id ...'
  end
  # verify the required parameter 'plan_id' is set
  if @api_client.config.client_side_validation && plan_id.nil?
    fail ArgumentError, "Missing the required parameter 'plan_id' when calling PlansApi.put_plans_plan_id"
  end
  # verify the required parameter 'plan' is set
  if @api_client.config.client_side_validation && plan.nil?
    fail ArgumentError, "Missing the required parameter 'plan' when calling PlansApi.put_plans_plan_id"
  end
  # resource path
  local_var_path = '/v2/plans/{planId}'.sub('{' + 'planId' + '}', CGI.escape(plan_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(plan)

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

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

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