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

Examples:

client.entitlements.count_company_overrides(
  company_id: "company_id",
  company_ids: ["company_ids"],
  feature_id: "feature_id",
  feature_ids: ["feature_ids"],
  ids: ["ids"],
  without_expired: true,
  q: "q",
  limit: 1000000,
  offset: 1000000
)

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:



261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
# File 'lib/schematic/entitlements/client.rb', line 261

def count_company_overrides(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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)

  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

Examples:

client.entitlements.count_feature_companies(
  feature_id: "feature_id",
  q: "q",
  limit: 1000000,
  offset: 1000000
)

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:



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

def count_feature_companies(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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)

  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

Examples:

client.entitlements.count_feature_usage(
  company_id: "company_id",
  feature_ids: ["feature_ids"],
  include_usage_aggregation: true,
  managed_by: "metronome",
  q: "q",
  without_negative_entitlements: true,
  limit: 1000000,
  offset: 1000000
)

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:



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
627
628
629
630
631
632
633
# File 'lib/schematic/entitlements/client.rb', line 601

def count_feature_usage(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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)

  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

Examples:

client.entitlements.count_feature_users(
  feature_id: "feature_id",
  q: "q",
  limit: 1000000,
  offset: 1000000
)

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:



706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
# File 'lib/schematic/entitlements/client.rb', line 706

def count_feature_users(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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)

  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

Examples:

client.entitlements.count_plan_entitlements(
  feature_id: "feature_id",
  feature_ids: ["feature_ids"],
  ids: ["ids"],
  plan_id: "plan_id",
  plan_ids: ["plan_ids"],
  plan_version_id: "plan_version_id",
  plan_version_ids: ["plan_version_ids"],
  q: "q",
  with_metered_products: true,
  limit: 1000000,
  offset: 1000000
)

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:



1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
# File 'lib/schematic/entitlements/client.rb', line 1034

def count_plan_entitlements(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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)

  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

Examples:

client.entitlements.create_company_override(
  company_id: "company_id",
  feature_id: "feature_id",
  value_type: "boolean"
)

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:



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/schematic/entitlements/client.rb', line 94

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

Examples:

client.entitlements.create_plan_entitlement(
  feature_id: "feature_id",
  plan_id: "plan_id",
  value_type: "boolean"
)

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:



822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
# File 'lib/schematic/entitlements/client.rb', line 822

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

Examples:

client.entitlements.delete_company_override(company_override_id: "company_override_id")

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:



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/schematic/entitlements/client.rb', line 208

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

Examples:

client.entitlements.delete_plan_entitlement(plan_entitlement_id: "plan_entitlement_id")

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:



936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
# File 'lib/schematic/entitlements/client.rb', line 936

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

Examples:

client.entitlements.duplicate_plan_entitlements(
  source_plan_id: "source_plan_id",
  target_plan_id: "target_plan_id"
)

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:



1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
# File 'lib/schematic/entitlements/client.rb', line 1085

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

Examples:

client.entitlements.get_company_override(company_override_id: "company_override_id")

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:



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/schematic/entitlements/client.rb', line 130

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

Examples:

client.entitlements.get_feature_usage_by_company(keys: {
  keys: "keys"
})

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:



1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
# File 'lib/schematic/entitlements/client.rb', line 1123

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

  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

Examples:

client.entitlements.get_feature_usage_time_series(
  company_id: "company_id",
  end_time: "2024-01-15T09:30:00Z",
  feature_id: "feature_id",
  granularity: "daily",
  start_time: "2024-01-15T09:30:00Z"
)

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:



541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/schematic/entitlements/client.rb', line 541

def get_feature_usage_time_series(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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)

  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

Examples:

client.entitlements.get_plan_entitlement(plan_entitlement_id: "plan_entitlement_id")

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:



858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
# File 'lib/schematic/entitlements/client.rb', line 858

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

#get_user_usage_by_company(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::GetUserUsageByCompanyResponse

Examples:

client.entitlements.get_user_usage_by_company(
  company_id: "company_id",
  end_time: "2024-01-15T09:30:00Z",
  feature_id: "feature_id",
  start_time: "2024-01-15T09:30:00Z"
)

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)
  • :end_time (String, nil)
  • :feature_id (String, nil)
  • :start_time (String, nil)

Returns:



1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
# File 'lib/schematic/entitlements/client.rb', line 1170

def get_user_usage_by_company(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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["start_time"] = params[:start_time] if params.key?(:start_time)

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

#get_user_usage_detail(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::GetUserUsageDetailResponse

Examples:

client.entitlements.get_user_usage_detail(
  company_id: "company_id",
  end_time: "2024-01-15T09:30:00Z",
  start_time: "2024-01-15T09:30:00Z",
  user_id: "user_id"
)

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)
  • :end_time (String, nil)
  • :start_time (String, nil)
  • :user_id (String)

Returns:



1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
# File 'lib/schematic/entitlements/client.rb', line 1220

def get_user_usage_detail(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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["start_time"] = params[:start_time] if params.key?(:start_time)
  query_params["user_id"] = params[:user_id] if params.key?(:user_id)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "user-usage-detail",
    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::GetUserUsageDetailResponse.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

Examples:

client.entitlements.list_company_overrides(
  company_id: "company_id",
  company_ids: ["company_ids"],
  feature_id: "feature_id",
  feature_ids: ["feature_ids"],
  ids: ["ids"],
  without_expired: true,
  q: "q",
  limit: 1000000,
  offset: 1000000
)

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:



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

def list_company_overrides(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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)

  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

Examples:

client.entitlements.list_feature_companies(
  feature_id: "feature_id",
  q: "q",
  limit: 1000000,
  offset: 1000000
)

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:



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

def list_feature_companies(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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)

  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

Examples:

client.entitlements.list_feature_usage(
  company_id: "company_id",
  feature_ids: ["feature_ids"],
  include_usage_aggregation: true,
  managed_by: "metronome",
  q: "q",
  without_negative_entitlements: true,
  limit: 1000000,
  offset: 1000000
)

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:



425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
# File 'lib/schematic/entitlements/client.rb', line 425

def list_feature_usage(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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)

  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_usage_history(request_options: {}, **params) ⇒ Schematic::Entitlements::Types::ListFeatureUsageHistoryResponse

Examples:

client.entitlements.list_feature_usage_history(
  company_ids: ["company_ids"],
  end_time: "2024-01-15T09:30:00Z",
  feature_ids: ["feature_ids"],
  granularity: "daily",
  start_time: "2024-01-15T09:30:00Z",
  limit: 1000000,
  offset: 1000000
)

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_ids (String, nil)
  • :end_time (String)
  • :feature_ids (String, nil)
  • :granularity (Schematic::Types::TimeSeriesGranularity, nil)
  • :start_time (String)
  • :limit (Integer, nil)
  • :offset (Integer, nil)

Returns:



486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
# File 'lib/schematic/entitlements/client.rb', line 486

def list_feature_usage_history(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  query_params = {}
  query_params["company_ids"] = params[:company_ids] if params.key?(:company_ids)
  query_params["end_time"] = params[:end_time] if params.key?(:end_time)
  query_params["feature_ids"] = params[:feature_ids] if params.key?(:feature_ids)
  query_params["granularity"] = params[:granularity] if params.key?(:granularity)
  query_params["start_time"] = params[:start_time] if params.key?(:start_time)
  query_params["limit"] = params[:limit] if params.key?(:limit)
  query_params["offset"] = params[:offset] if params.key?(:offset)

  request = Schematic::Internal::JSON::Request.new(
    base_url: request_options[:base_url],
    method: "GET",
    path: "feature-usage-history",
    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::ListFeatureUsageHistoryResponse.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

Examples:

client.entitlements.list_feature_users(
  feature_id: "feature_id",
  q: "q",
  limit: 1000000,
  offset: 1000000
)

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:



656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
# File 'lib/schematic/entitlements/client.rb', line 656

def list_feature_users(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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)

  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

Examples:

client.entitlements.list_plan_entitlements(
  feature_id: "feature_id",
  feature_ids: ["feature_ids"],
  ids: ["ids"],
  plan_id: "plan_id",
  plan_ids: ["plan_ids"],
  plan_version_id: "plan_version_id",
  plan_version_ids: ["plan_version_ids"],
  q: "q",
  with_metered_products: true,
  limit: 1000000,
  offset: 1000000
)

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:



770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
# File 'lib/schematic/entitlements/client.rb', line 770

def list_plan_entitlements(request_options: {}, **params)
  params = Schematic::Internal::Types::Utils.normalize_keys(params)
  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)

  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

Examples:

client.entitlements.update_company_override(
  company_override_id: "company_override_id",
  value_type: "boolean"
)

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:



168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/schematic/entitlements/client.rb', line 168

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 = %w[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

Examples:

client.entitlements.update_plan_entitlement(
  plan_entitlement_id: "plan_entitlement_id",
  value_type: "boolean"
)

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:



896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
# File 'lib/schematic/entitlements/client.rb', line 896

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 = %w[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

Examples:

client.entitlements.upsert_plan_entitlement_for_billing_product(
  billing_provider: "metronome",
  external_resource_id: "external_resource_id",
  feature_id: "feature_id",
  plan_id: "plan_id",
  value_type: "boolean"
)

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:



976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
# File 'lib/schematic/entitlements/client.rb', line 976

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