Class: Schematic::Plans::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/schematic/plans/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ void



9
10
11
# File 'lib/schematic/plans/client.rb', line 9

def initialize(client:)
  @client = client
end

Instance Method Details

#count_billing_product_match_companies(request_options: {}, **params) ⇒ Schematic::Plans::Types::CountBillingProductMatchCompaniesResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :plan_id (String)
  • :q (String, nil)
  • :limit (Integer, nil)
  • :offset (Integer, nil)

Returns:



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
# File 'lib/schematic/plans/client.rb', line 491

def count_billing_product_match_companies(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[plan_id q limit offset]
  query_params = {}
  query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id)
  query_params["q"] = params[:q] if params.key?(:q)
  query_params["limit"] = params[:limit] if params.key?(:limit)
  query_params["offset"] = params[:offset] if params.key?(:offset)
  params.except(*query_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "plans/billing-product-match-companies/count",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::CountBillingProductMatchCompaniesResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#count_plans(request_options: {}, **params) ⇒ Schematic::Plans::Types::CountPlansResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :company_id (String, nil)
  • :exclude_company_scoped (Boolean, nil)
  • :for_fallback_plan (Boolean, nil)
  • :for_initial_plan (Boolean, nil)
  • :for_trial_expiry_plan (Boolean, nil)
  • :has_product_id (Boolean, nil)
  • :ids (String, nil)
  • :include_draft_versions (Boolean, nil)
  • :plan_type (Schematic::Types::PlanType, nil)
  • :q (String, nil)
  • :scoped_to_company_id (String, nil)
  • :without_entitlement_for (String, nil)
  • :without_paid_product_id (Boolean, nil)
  • :limit (Integer, nil)
  • :offset (Integer, nil)

Returns:



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
# File 'lib/schematic/plans/client.rb', line 546

def count_plans(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[company_id exclude_company_scoped for_fallback_plan for_initial_plan for_trial_expiry_plan has_product_id ids include_draft_versions plan_type q scoped_to_company_id without_entitlement_for without_paid_product_id limit offset]
  query_params = {}
  query_params["company_id"] = params[:company_id] if params.key?(:company_id)
  query_params["exclude_company_scoped"] = params[:exclude_company_scoped] if params.key?(:exclude_company_scoped)
  query_params["for_fallback_plan"] = params[:for_fallback_plan] if params.key?(:for_fallback_plan)
  query_params["for_initial_plan"] = params[:for_initial_plan] if params.key?(:for_initial_plan)
  query_params["for_trial_expiry_plan"] = params[:for_trial_expiry_plan] if params.key?(:for_trial_expiry_plan)
  query_params["has_product_id"] = params[:has_product_id] if params.key?(:has_product_id)
  query_params["ids"] = params[:ids] if params.key?(:ids)
  query_params["include_draft_versions"] = params[:include_draft_versions] if params.key?(:include_draft_versions)
  query_params["plan_type"] = params[:plan_type] if params.key?(:plan_type)
  query_params["q"] = params[:q] if params.key?(:q)
  query_params["scoped_to_company_id"] = params[:scoped_to_company_id] if params.key?(:scoped_to_company_id)
  query_params["without_entitlement_for"] = params[:without_entitlement_for] if params.key?(:without_entitlement_for)
  query_params["without_paid_product_id"] = params[:without_paid_product_id] if params.key?(:without_paid_product_id)
  query_params["limit"] = params[:limit] if params.key?(:limit)
  query_params["offset"] = params[:offset] if params.key?(:offset)
  params.except(*query_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "plans/count",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::CountPlansResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#create_custom_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::CreateCustomPlanResponse

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
# File 'lib/schematic/plans/client.rb', line 144

def create_custom_plan(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "custom-plans",
    body: Schematic::Plans::Types::CreateCustomPlanRequestBody.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::CreateCustomPlanResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#create_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::CreatePlanResponse

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
# File 'lib/schematic/plans/client.rb', line 242

def create_plan(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "plans",
    body: Schematic::Types::CreatePlanRequestBody.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::CreatePlanResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#delete_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::DeletePlanResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :plan_id (String)

Returns:



347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
# File 'lib/schematic/plans/client.rb', line 347

def delete_plan(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "DELETE",
    path: "plans/#{URI.encode_uri_component(params[:plan_id].to_s)}",
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::DeletePlanResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#delete_plan_version(request_options: {}, **params) ⇒ Schematic::Plans::Types::DeletePlanVersionResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :plan_id (String)
  • :promote_archived_version (Boolean, nil)

Returns:



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
665
# File 'lib/schematic/plans/client.rb', line 639

def delete_plan_version(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[promote_archived_version]
  query_params = {}
  query_params["promote_archived_version"] = params[:promote_archived_version] if params.key?(:promote_archived_version)
  params = params.except(*query_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "DELETE",
    path: "plans/version/#{URI.encode_uri_component(params[:plan_id].to_s)}",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::DeletePlanVersionResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::GetPlanResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :plan_id (String)
  • :plan_version_id (String, nil)

Returns:



276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
# File 'lib/schematic/plans/client.rb', line 276

def get_plan(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[plan_version_id]
  query_params = {}
  query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
  params = params.except(*query_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "plans/#{URI.encode_uri_component(params[:plan_id].to_s)}",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::GetPlanResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#list_billing_product_match_companies(request_options: {}, **params) ⇒ Schematic::Plans::Types::ListBillingProductMatchCompaniesResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :plan_id (String)
  • :q (String, nil)
  • :limit (Integer, nil)
  • :offset (Integer, nil)

Returns:



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
# File 'lib/schematic/plans/client.rb', line 447

def list_billing_product_match_companies(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[plan_id q limit offset]
  query_params = {}
  query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id)
  query_params["q"] = params[:q] if params.key?(:q)
  query_params["limit"] = params[:limit] if params.key?(:limit)
  query_params["offset"] = params[:offset] if params.key?(:offset)
  params.except(*query_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "plans/billing-product-match-companies",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::ListBillingProductMatchCompaniesResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#list_custom_plan_billings(request_options: {}, **params) ⇒ Schematic::Plans::Types::ListCustomPlanBillingsResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

Returns:



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/schematic/plans/client.rb', line 65

def list_custom_plan_billings(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[company_id plan_id status statuses limit offset]
  query_params = {}
  query_params["company_id"] = params[:company_id] if params.key?(:company_id)
  query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id)
  query_params["status"] = params[:status] if params.key?(:status)
  query_params["statuses"] = params[:statuses] if params.key?(:statuses)
  query_params["limit"] = params[:limit] if params.key?(:limit)
  query_params["offset"] = params[:offset] if params.key?(:offset)
  params.except(*query_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "custom-plan-billings",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::ListCustomPlanBillingsResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#list_plan_issues(request_options: {}, **params) ⇒ Schematic::Plans::Types::ListPlanIssuesResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :plan_id (String)
  • :plan_version_id (String, nil)

Returns:



599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
# File 'lib/schematic/plans/client.rb', line 599

def list_plan_issues(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[plan_id plan_version_id]
  query_params = {}
  query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id)
  query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
  params.except(*query_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "plans/issues",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::ListPlanIssuesResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#list_plans(request_options: {}, **params) ⇒ Schematic::Plans::Types::ListPlansResponse

Parameters:

  • request_options (Hash) (defaults to: {})
  • params (Hash)

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :company_id (String, nil)
  • :exclude_company_scoped (Boolean, nil)
  • :for_fallback_plan (Boolean, nil)
  • :for_initial_plan (Boolean, nil)
  • :for_trial_expiry_plan (Boolean, nil)
  • :has_product_id (Boolean, nil)
  • :ids (String, nil)
  • :include_draft_versions (Boolean, nil)
  • :plan_type (Schematic::Types::PlanType, nil)
  • :q (String, nil)
  • :scoped_to_company_id (String, nil)
  • :without_entitlement_for (String, nil)
  • :without_paid_product_id (Boolean, nil)
  • :limit (Integer, nil)
  • :offset (Integer, nil)

Returns:



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
229
230
231
# File 'lib/schematic/plans/client.rb', line 191

def list_plans(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[company_id exclude_company_scoped for_fallback_plan for_initial_plan for_trial_expiry_plan has_product_id ids include_draft_versions plan_type q scoped_to_company_id without_entitlement_for without_paid_product_id limit offset]
  query_params = {}
  query_params["company_id"] = params[:company_id] if params.key?(:company_id)
  query_params["exclude_company_scoped"] = params[:exclude_company_scoped] if params.key?(:exclude_company_scoped)
  query_params["for_fallback_plan"] = params[:for_fallback_plan] if params.key?(:for_fallback_plan)
  query_params["for_initial_plan"] = params[:for_initial_plan] if params.key?(:for_initial_plan)
  query_params["for_trial_expiry_plan"] = params[:for_trial_expiry_plan] if params.key?(:for_trial_expiry_plan)
  query_params["has_product_id"] = params[:has_product_id] if params.key?(:has_product_id)
  query_params["ids"] = params[:ids] if params.key?(:ids)
  query_params["include_draft_versions"] = params[:include_draft_versions] if params.key?(:include_draft_versions)
  query_params["plan_type"] = params[:plan_type] if params.key?(:plan_type)
  query_params["q"] = params[:q] if params.key?(:q)
  query_params["scoped_to_company_id"] = params[:scoped_to_company_id] if params.key?(:scoped_to_company_id)
  query_params["without_entitlement_for"] = params[:without_entitlement_for] if params.key?(:without_entitlement_for)
  query_params["without_paid_product_id"] = params[:without_paid_product_id] if params.key?(:without_paid_product_id)
  query_params["limit"] = params[:limit] if params.key?(:limit)
  query_params["offset"] = params[:offset] if params.key?(:offset)
  params.except(*query_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "plans",
    query: query_params,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::ListPlansResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#publish_plan_version(request_options: {}, **params) ⇒ Schematic::Plans::Types::PublishPlanVersionResponse

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :plan_id (String)

Returns:



677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
# File 'lib/schematic/plans/client.rb', line 677

def publish_plan_version(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request_data = Schematic::Plans::Types::PublishPlanVersionRequestBody.new(params).to_h
  non_body_param_names = ["plan_id"]
  body = request_data.except(*non_body_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "plans/version/#{URI.encode_uri_component(params[:plan_id].to_s)}/publish",
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::PublishPlanVersionResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#retry_custom_plan_billing(request_options: {}, **params) ⇒ Schematic::Plans::Types::RetryCustomPlanBillingResponse

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :custom_plan_billing_id (String)

Returns:



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
# File 'lib/schematic/plans/client.rb', line 108

def retry_custom_plan_billing(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request_data = Schematic::Plans::Types::RetryCustomPlanBillingRequestBody.new(params).to_h
  non_body_param_names = ["custom_plan_billing_id"]
  body = request_data.except(*non_body_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "custom-plan-billings/#{URI.encode_uri_component(params[:custom_plan_billing_id].to_s)}/retry",
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::RetryCustomPlanBillingResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#update_company_plans(request_options: {}, **params) ⇒ Schematic::Plans::Types::UpdateCompanyPlansResponse

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :company_plan_id (String)

Returns:



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
# File 'lib/schematic/plans/client.rb', line 23

def update_company_plans(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request_data = Schematic::Plans::Types::UpdateCompanyPlansRequestBody.new(params).to_h
  non_body_param_names = ["company_plan_id"]
  body = request_data.except(*non_body_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "company-plans/#{URI.encode_uri_component(params[:company_plan_id].to_s)}",
    body: body,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::UpdateCompanyPlansResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#update_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::UpdatePlanResponse

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :plan_id (String)

Returns:



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
# File 'lib/schematic/plans/client.rb', line 314

def update_plan(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "plans/#{URI.encode_uri_component(params[:plan_id].to_s)}",
    body: Schematic::Types::UpdatePlanRequestBody.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::UpdatePlanResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#upsert_billing_product_plan(request_options: {}, **params) ⇒ Schematic::Plans::Types::UpsertBillingProductPlanResponse

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Options Hash (**params):

  • :plan_id (String)

Returns:



379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
# File 'lib/schematic/plans/client.rb', line 379

def upsert_billing_product_plan(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "plans/#{URI.encode_uri_component(params[:plan_id].to_s)}/billing_products",
    body: Schematic::Types::UpsertBillingProductRequestBody.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::UpsertBillingProductPlanResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#upsert_plan_for_billing_product(request_options: {}, **params) ⇒ Schematic::Plans::Types::UpsertPlanForBillingProductResponse

Parameters:

Options Hash (request_options:):

  • :base_url (String)
  • :additional_headers (Hash{String => Object})
  • :additional_query_parameters (Hash{String => Object})
  • :additional_body_parameters (Hash{String => Object})
  • :timeout_in_seconds (Integer)

Returns:



411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/schematic/plans/client.rb', line 411

def upsert_plan_for_billing_product(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "POST",
    path: "plans/billing-linked",
    body: Schematic::Plans::Types::CreateBillingLinkedPlanRequestBody.new(params).to_h,
    request_options: request_options
  )
  begin
    response = @client.send(request)
  rescue Net::HTTPRequestTimeout
    raise Schematic::Errors::TimeoutError
  end
  code = response.code.to_i
  if code.between?(200, 299)
    Schematic::Plans::Types::UpsertPlanForBillingProductResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end