Class: Schematic::Entitlements::Client

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

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ void



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

def initialize(client:)
  @client = client
end

Instance Method Details

#count_company_overrides(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::CountCompanyOverridesResponse

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)
  • :company_ids (String, nil)
  • :feature_id (String, nil)
  • :feature_ids (String, nil)
  • :ids (String, nil)
  • :without_expired (Boolean, nil)
  • :q (String, nil)
  • :limit (Integer, nil)
  • :offset (Integer, nil)

Returns:



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
# File 'lib/schematic/entitlements/client.rb', line 218

def count_company_overrides(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[company_id company_ids feature_id feature_ids ids without_expired q limit offset]
  query_params = {}
  query_params["company_id"] = params[:company_id] if params.key?(:company_id)
  query_params["company_ids"] = params[:company_ids] if params.key?(:company_ids)
  query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id)
  query_params["feature_ids"] = params[:feature_ids] if params.key?(:feature_ids)
  query_params["ids"] = params[:ids] if params.key?(:ids)
  query_params["without_expired"] = params[:without_expired] if params.key?(:without_expired)
  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: "company-overrides/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::Entitlements::Types::CountCompanyOverridesResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#count_feature_companies(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::CountFeatureCompaniesResponse

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):

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

Returns:



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

def count_feature_companies(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[feature_id q limit offset]
  query_params = {}
  query_params["feature_id"] = params[:feature_id] if params.key?(:feature_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: "feature-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::Entitlements::Types::CountFeatureCompaniesResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#count_feature_usage(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::CountFeatureUsageResponse

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)
  • :company_keys (Hash[String, String], nil)
  • :feature_ids (String, nil)
  • :include_usage_aggregation (Boolean, nil)
  • :managed_by (Schematic::Types::BillingProviderType, nil)
  • :q (String, nil)
  • :without_negative_entitlements (Boolean, nil)
  • :limit (Integer, nil)
  • :offset (Integer, nil)

Returns:



460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
# File 'lib/schematic/entitlements/client.rb', line 460

def count_feature_usage(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[company_id company_keys feature_ids include_usage_aggregation managed_by q without_negative_entitlements limit offset]
  query_params = {}
  query_params["company_id"] = params[:company_id] if params.key?(:company_id)
  query_params["company_keys"] = params[:company_keys] if params.key?(:company_keys)
  query_params["feature_ids"] = params[:feature_ids] if params.key?(:feature_ids)
  query_params["include_usage_aggregation"] = params[:include_usage_aggregation] if params.key?(:include_usage_aggregation)
  query_params["managed_by"] = params[:managed_by] if params.key?(:managed_by)
  query_params["q"] = params[:q] if params.key?(:q)
  query_params["without_negative_entitlements"] = params[:without_negative_entitlements] if params.key?(:without_negative_entitlements)
  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: "feature-usage/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::Entitlements::Types::CountFeatureUsageResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#count_feature_users(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::CountFeatureUsersResponse

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):

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

Returns:



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

def count_feature_users(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[feature_id q limit offset]
  query_params = {}
  query_params["feature_id"] = params[:feature_id] if params.key?(:feature_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: "feature-users/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::Entitlements::Types::CountFeatureUsersResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#count_plan_entitlements(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::CountPlanEntitlementsResponse

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):

  • :feature_id (String, nil)
  • :feature_ids (String, nil)
  • :ids (String, nil)
  • :plan_id (String, nil)
  • :plan_ids (String, nil)
  • :plan_version_id (String, nil)
  • :plan_version_ids (String, nil)
  • :q (String, nil)
  • :with_metered_products (Boolean, nil)
  • :limit (Integer, nil)
  • :offset (Integer, nil)

Returns:



827
828
829
830
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
# File 'lib/schematic/entitlements/client.rb', line 827

def count_plan_entitlements(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[feature_id feature_ids ids plan_id plan_ids plan_version_id plan_version_ids q with_metered_products limit offset]
  query_params = {}
  query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id)
  query_params["feature_ids"] = params[:feature_ids] if params.key?(:feature_ids)
  query_params["ids"] = params[:ids] if params.key?(:ids)
  query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id)
  query_params["plan_ids"] = params[:plan_ids] if params.key?(:plan_ids)
  query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
  query_params["plan_version_ids"] = params[:plan_version_ids] if params.key?(:plan_version_ids)
  query_params["q"] = params[:q] if params.key?(:q)
  query_params["with_metered_products"] = params[:with_metered_products] if params.key?(:with_metered_products)
  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: "plan-entitlements/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::Entitlements::Types::CountPlanEntitlementsResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#create_company_override(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::CreateCompanyOverrideResponse

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:



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/schematic/entitlements/client.rb', line 76

def create_company_override(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: "company-overrides",
    body: Schematic::Entitlements::Types::CreateCompanyOverrideRequestBody.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::Entitlements::Types::CreateCompanyOverrideResponse.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_entitlement(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::CreatePlanEntitlementResponse

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:



651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
# File 'lib/schematic/entitlements/client.rb', line 651

def create_plan_entitlement(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: "plan-entitlements",
    body: Schematic::Entitlements::Types::CreatePlanEntitlementRequestBody.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::Entitlements::Types::CreatePlanEntitlementResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#delete_company_override(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::DeleteCompanyOverrideResponse

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_override_id (String)

Returns:



178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/schematic/entitlements/client.rb', line 178

def delete_company_override(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: "company-overrides/#{URI.encode_uri_component(params[:company_override_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::Entitlements::Types::DeleteCompanyOverrideResponse.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_entitlement(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::DeletePlanEntitlementResponse

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_entitlement_id (String)

Returns:



753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
# File 'lib/schematic/entitlements/client.rb', line 753

def delete_plan_entitlement(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: "plan-entitlements/#{URI.encode_uri_component(params[:plan_entitlement_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::Entitlements::Types::DeletePlanEntitlementResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#duplicate_plan_entitlements(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::DuplicatePlanEntitlementsResponse

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:



874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
# File 'lib/schematic/entitlements/client.rb', line 874

def duplicate_plan_entitlements(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: "plan-entitlements/duplicate",
    body: Schematic::Entitlements::Types::DuplicatePlanEntitlementsRequestBody.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::Entitlements::Types::DuplicatePlanEntitlementsResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_company_override(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::GetCompanyOverrideResponse

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_override_id (String)

Returns:



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/schematic/entitlements/client.rb', line 109

def get_company_override(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "company-overrides/#{URI.encode_uri_component(params[:company_override_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::Entitlements::Types::GetCompanyOverrideResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_feature_usage_by_company(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::GetFeatureUsageByCompanyResponse

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):

  • :keys (Hash[String, String])

Returns:



907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
# File 'lib/schematic/entitlements/client.rb', line 907

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

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "usage-by-company",
    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::Entitlements::Types::GetFeatureUsageByCompanyResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#get_feature_usage_time_series(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::GetFeatureUsageTimeSeriesResponse

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:



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

def get_feature_usage_time_series(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[company_id end_time feature_id granularity start_time]
  query_params = {}
  query_params["company_id"] = params[:company_id] if params.key?(:company_id)
  query_params["end_time"] = params[:end_time] if params.key?(:end_time)
  query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id)
  query_params["granularity"] = params[:granularity] if params.key?(:granularity)
  query_params["start_time"] = params[:start_time] if params.key?(:start_time)
  params.except(*query_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "feature-usage-timeseries",
    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::Entitlements::Types::GetFeatureUsageTimeSeriesResponse.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_entitlement(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::GetPlanEntitlementResponse

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_entitlement_id (String)

Returns:



684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
# File 'lib/schematic/entitlements/client.rb', line 684

def get_plan_entitlement(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "plan-entitlements/#{URI.encode_uri_component(params[:plan_entitlement_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::Entitlements::Types::GetPlanEntitlementResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#list_company_overrides(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::ListCompanyOverridesResponse

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)
  • :company_ids (String, nil)
  • :feature_id (String, nil)
  • :feature_ids (String, nil)
  • :ids (String, nil)
  • :without_expired (Boolean, nil)
  • :q (String, nil)
  • :limit (Integer, nil)
  • :offset (Integer, nil)

Returns:



31
32
33
34
35
36
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
# File 'lib/schematic/entitlements/client.rb', line 31

def list_company_overrides(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[company_id company_ids feature_id feature_ids ids without_expired q limit offset]
  query_params = {}
  query_params["company_id"] = params[:company_id] if params.key?(:company_id)
  query_params["company_ids"] = params[:company_ids] if params.key?(:company_ids)
  query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id)
  query_params["feature_ids"] = params[:feature_ids] if params.key?(:feature_ids)
  query_params["ids"] = params[:ids] if params.key?(:ids)
  query_params["without_expired"] = params[:without_expired] if params.key?(:without_expired)
  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: "company-overrides",
    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::Entitlements::Types::ListCompanyOverridesResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#list_feature_companies(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::ListFeatureCompaniesResponse

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):

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

Returns:



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

def list_feature_companies(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[feature_id q limit offset]
  query_params = {}
  query_params["feature_id"] = params[:feature_id] if params.key?(:feature_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: "feature-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::Entitlements::Types::ListFeatureCompaniesResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#list_feature_usage(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::ListFeatureUsageResponse

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)
  • :company_keys (Hash[String, String], nil)
  • :feature_ids (String, nil)
  • :include_usage_aggregation (Boolean, nil)
  • :managed_by (Schematic::Types::BillingProviderType, nil)
  • :q (String, nil)
  • :without_negative_entitlements (Boolean, nil)
  • :limit (Integer, nil)
  • :offset (Integer, nil)

Returns:



360
361
362
363
364
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
# File 'lib/schematic/entitlements/client.rb', line 360

def list_feature_usage(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[company_id company_keys feature_ids include_usage_aggregation managed_by q without_negative_entitlements limit offset]
  query_params = {}
  query_params["company_id"] = params[:company_id] if params.key?(:company_id)
  query_params["company_keys"] = params[:company_keys] if params.key?(:company_keys)
  query_params["feature_ids"] = params[:feature_ids] if params.key?(:feature_ids)
  query_params["include_usage_aggregation"] = params[:include_usage_aggregation] if params.key?(:include_usage_aggregation)
  query_params["managed_by"] = params[:managed_by] if params.key?(:managed_by)
  query_params["q"] = params[:q] if params.key?(:q)
  query_params["without_negative_entitlements"] = params[:without_negative_entitlements] if params.key?(:without_negative_entitlements)
  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: "feature-usage",
    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::Entitlements::Types::ListFeatureUsageResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end

#list_feature_users(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::ListFeatureUsersResponse

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):

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

Returns:



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

def list_feature_users(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[feature_id q limit offset]
  query_params = {}
  query_params["feature_id"] = params[:feature_id] if params.key?(:feature_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: "feature-users",
    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::Entitlements::Types::ListFeatureUsersResponse.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_entitlements(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::ListPlanEntitlementsResponse

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):

  • :feature_id (String, nil)
  • :feature_ids (String, nil)
  • :ids (String, nil)
  • :plan_id (String, nil)
  • :plan_ids (String, nil)
  • :plan_version_id (String, nil)
  • :plan_version_ids (String, nil)
  • :q (String, nil)
  • :with_metered_products (Boolean, nil)
  • :limit (Integer, nil)
  • :offset (Integer, nil)

Returns:



604
605
606
607
608
609
610
611
612
613
614
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
# File 'lib/schematic/entitlements/client.rb', line 604

def list_plan_entitlements(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_param_names = %i[feature_id feature_ids ids plan_id plan_ids plan_version_id plan_version_ids q with_metered_products limit offset]
  query_params = {}
  query_params["feature_id"] = params[:feature_id] if params.key?(:feature_id)
  query_params["feature_ids"] = params[:feature_ids] if params.key?(:feature_ids)
  query_params["ids"] = params[:ids] if params.key?(:ids)
  query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id)
  query_params["plan_ids"] = params[:plan_ids] if params.key?(:plan_ids)
  query_params["plan_version_id"] = params[:plan_version_id] if params.key?(:plan_version_id)
  query_params["plan_version_ids"] = params[:plan_version_ids] if params.key?(:plan_version_ids)
  query_params["q"] = params[:q] if params.key?(:q)
  query_params["with_metered_products"] = params[:with_metered_products] if params.key?(:with_metered_products)
  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: "plan-entitlements",
    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::Entitlements::Types::ListPlanEntitlementsResponse.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_override(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::UpdateCompanyOverrideResponse

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_override_id (String)

Returns:



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

def update_company_override(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request_data = Schematic::Entitlements::Types::UpdateCompanyOverrideRequestBody.new(params).to_h
  non_body_param_names = ["company_override_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-overrides/#{URI.encode_uri_component(params[:company_override_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::Entitlements::Types::UpdateCompanyOverrideResponse.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_entitlement(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::UpdatePlanEntitlementResponse

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_entitlement_id (String)

Returns:



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
741
# File 'lib/schematic/entitlements/client.rb', line 716

def update_plan_entitlement(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  request_data = Schematic::Entitlements::Types::UpdatePlanEntitlementRequestBody.new(params).to_h
  non_body_param_names = ["plan_entitlement_id"]
  body = request_data.except(*non_body_param_names)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "PUT",
    path: "plan-entitlements/#{URI.encode_uri_component(params[:plan_entitlement_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::Entitlements::Types::UpdatePlanEntitlementResponse.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_entitlement_for_billing_product(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::UpsertPlanEntitlementForBillingProductResponse

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:



784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
# File 'lib/schematic/entitlements/client.rb', line 784

def upsert_plan_entitlement_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: "plan-entitlements/billing-linked",
    body: Schematic::Entitlements::Types::CreateBillingLinkedPlanEntitlementRequestBody.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::Entitlements::Types::UpsertPlanEntitlementForBillingProductResponse.load(response.body)
  else
    error_class = Schematic::Errors::ResponseError.subclass_for_code(code)
    raise error_class.new(response.body, code: code)
  end
end