Class: Schematic::Companies::Client
- Inherits:
-
Object
- Object
- Schematic::Companies::Client
- Defined in:
- lib/schematic/companies/client.rb
Instance Method Summary collapse
- #count_companies(request_options: {}, **params) ⇒ Schematic::Companies::Types::CountCompaniesResponse
- #count_entity_key_definitions(request_options: {}, **params) ⇒ Schematic::Companies::Types::CountEntityKeyDefinitionsResponse
- #count_entity_trait_definitions(request_options: {}, **params) ⇒ Schematic::Companies::Types::CountEntityTraitDefinitionsResponse
- #count_plan_traits(request_options: {}, **params) ⇒ Schematic::Companies::Types::CountPlanTraitsResponse
- #count_users(request_options: {}, **params) ⇒ Schematic::Companies::Types::CountUsersResponse
- #create_company(request_options: {}, **params) ⇒ Schematic::Companies::Types::CreateCompanyResponse
- #create_user(request_options: {}, **params) ⇒ Schematic::Companies::Types::CreateUserResponse
- #delete_company(request_options: {}, **params) ⇒ Schematic::Companies::Types::DeleteCompanyResponse
- #delete_company_by_keys(request_options: {}, **params) ⇒ Schematic::Companies::Types::DeleteCompanyByKeysResponse
- #delete_company_membership(request_options: {}, **params) ⇒ Schematic::Companies::Types::DeleteCompanyMembershipResponse
- #delete_user(request_options: {}, **params) ⇒ Schematic::Companies::Types::DeleteUserResponse
- #delete_user_by_keys(request_options: {}, **params) ⇒ Schematic::Companies::Types::DeleteUserByKeysResponse
- #get_active_company_subscription(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetActiveCompanySubscriptionResponse
- #get_company(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetCompanyResponse
- #get_entity_trait_definition(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetEntityTraitDefinitionResponse
- #get_entity_trait_values(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetEntityTraitValuesResponse
- #get_or_create_company_membership(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetOrCreateCompanyMembershipResponse
- #get_or_create_entity_trait_definition(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetOrCreateEntityTraitDefinitionResponse
- #get_plan_change(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetPlanChangeResponse
- #get_plan_trait(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetPlanTraitResponse
- #get_user(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetUserResponse
- #initialize(client:) ⇒ void constructor
- #list_companies(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListCompaniesResponse
- #list_company_memberships(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListCompanyMembershipsResponse
- #list_entity_key_definitions(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListEntityKeyDefinitionsResponse
- #list_entity_trait_definitions(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListEntityTraitDefinitionsResponse
- #list_plan_changes(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListPlanChangesResponse
- #list_plan_traits(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListPlanTraitsResponse
- #list_users(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListUsersResponse
-
#lookup_company(request_options: {}, **params) ⇒ Schematic::Companies::Types::LookupCompanyResponse
Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work.
- #lookup_user(request_options: {}, **params) ⇒ Schematic::Companies::Types::LookupUserResponse
- #update_entity_trait_definition(request_options: {}, **params) ⇒ Schematic::Companies::Types::UpdateEntityTraitDefinitionResponse
- #update_plan_traits_bulk(request_options: {}, **params) ⇒ Schematic::Companies::Types::UpdatePlanTraitsBulkResponse
- #upsert_company(request_options: {}, **params) ⇒ Schematic::Companies::Types::UpsertCompanyResponse
- #upsert_company_trait(request_options: {}, **params) ⇒ Schematic::Companies::Types::UpsertCompanyTraitResponse
- #upsert_user(request_options: {}, **params) ⇒ Schematic::Companies::Types::UpsertUserResponse
- #upsert_user_trait(request_options: {}, **params) ⇒ Schematic::Companies::Types::UpsertUserTraitResponse
Constructor Details
#initialize(client:) ⇒ void
9 10 11 |
# File 'lib/schematic/companies/client.rb', line 9 def initialize(client:) @client = client end |
Instance Method Details
#count_companies(request_options: {}, **params) ⇒ Schematic::Companies::Types::CountCompaniesResponse
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 253 254 255 256 257 258 259 260 261 262 263 264 |
# File 'lib/schematic/companies/client.rb', line 220 def count_companies(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[credit_type_ids has_scheduled_downgrade ids monetized_subscriptions plan_id plan_ids plan_version_id q sort_order_column sort_order_direction subscription_statuses subscription_types with_entitlement_for without_feature_override_for without_plan without_subscription with_subscription limit offset] query_params = {} query_params["credit_type_ids"] = params[:credit_type_ids] if params.key?(:credit_type_ids) query_params["has_scheduled_downgrade"] = params[:has_scheduled_downgrade] if params.key?(:has_scheduled_downgrade) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["monetized_subscriptions"] = params[:monetized_subscriptions] if params.key?(:monetized_subscriptions) 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["q"] = params[:q] if params.key?(:q) query_params["sort_order_column"] = params[:sort_order_column] if params.key?(:sort_order_column) query_params["sort_order_direction"] = params[:sort_order_direction] if params.key?(:sort_order_direction) query_params["subscription_statuses"] = params[:subscription_statuses] if params.key?(:subscription_statuses) query_params["subscription_types"] = params[:subscription_types] if params.key?(:subscription_types) query_params["with_entitlement_for"] = params[:with_entitlement_for] if params.key?(:with_entitlement_for) query_params["without_feature_override_for"] = params[:without_feature_override_for] if params.key?(:without_feature_override_for) query_params["without_plan"] = params[:without_plan] if params.key?(:without_plan) query_params["without_subscription"] = params[:without_subscription] if params.key?(:without_subscription) query_params["with_subscription"] = params[:with_subscription] if params.key?(:with_subscription) 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: [:base_url], method: "GET", path: "companies/count", query: query_params, 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::Companies::Types::CountCompaniesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_entity_key_definitions(request_options: {}, **params) ⇒ Schematic::Companies::Types::CountEntityKeyDefinitionsResponse
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 |
# File 'lib/schematic/companies/client.rb', line 618 def count_entity_key_definitions(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[entity_type ids q limit offset] query_params = {} query_params["entity_type"] = params[:entity_type] if params.key?(:entity_type) query_params["ids"] = params[:ids] if params.key?(:ids) 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: [:base_url], method: "GET", path: "entity-key-definitions/count", query: query_params, 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::Companies::Types::CountEntityKeyDefinitionsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_entity_trait_definitions(request_options: {}, **params) ⇒ Schematic::Companies::Types::CountEntityTraitDefinitionsResponse
817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 |
# File 'lib/schematic/companies/client.rb', line 817 def count_entity_trait_definitions(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[entity_type ids q trait_type trait_types limit offset] query_params = {} query_params["entity_type"] = params[:entity_type] if params.key?(:entity_type) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["q"] = params[:q] if params.key?(:q) query_params["trait_type"] = params[:trait_type] if params.key?(:trait_type) query_params["trait_types"] = params[:trait_types] if params.key?(:trait_types) 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: [:base_url], method: "GET", path: "entity-trait-definitions/count", query: query_params, 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::Companies::Types::CountEntityTraitDefinitionsResponse.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_traits(request_options: {}, **params) ⇒ Schematic::Companies::Types::CountPlanTraitsResponse
1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 |
# File 'lib/schematic/companies/client.rb', line 1104 def count_plan_traits(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[ids plan_id trait_id trait_ids limit offset] query_params = {} query_params["ids"] = params[:ids] if params.key?(:ids) query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id) query_params["trait_id"] = params[:trait_id] if params.key?(:trait_id) query_params["trait_ids"] = params[:trait_ids] if params.key?(:trait_ids) 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: [:base_url], method: "GET", path: "plan-traits/count", query: query_params, 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::Companies::Types::CountPlanTraitsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#count_users(request_options: {}, **params) ⇒ Schematic::Companies::Types::CountUsersResponse
1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 |
# File 'lib/schematic/companies/client.rb', line 1328 def count_users(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id ids plan_id q limit offset] query_params = {} query_params["company_id"] = params[:company_id] if params.key?(:company_id) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id) query_params["q"] = params[:q] if params.key?(:q) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "users/count", query: query_params, 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::Companies::Types::CountUsersResponse.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(request_options: {}, **params) ⇒ Schematic::Companies::Types::CreateCompanyResponse
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/companies/client.rb', line 275 def create_company(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "companies/create", body: Schematic::Types::UpsertCompanyRequestBody.new(params).to_h, 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::Companies::Types::CreateCompanyResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#create_user(request_options: {}, **params) ⇒ Schematic::Companies::Types::CreateUserResponse
1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 |
# File 'lib/schematic/companies/client.rb', line 1370 def create_user(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "users/create", body: Schematic::Types::UpsertUserRequestBody.new(params).to_h, 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::Companies::Types::CreateUserResponse.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(request_options: {}, **params) ⇒ Schematic::Companies::Types::DeleteCompanyResponse
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
# File 'lib/schematic/companies/client.rb', line 163 def delete_company(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[cancel_subscription prorate] query_params = {} query_params["cancel_subscription"] = params[:cancel_subscription] if params.key?(:cancel_subscription) query_params["prorate"] = params[:prorate] if params.key?(:prorate) params = params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}", query: query_params, 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::Companies::Types::DeleteCompanyResponse.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_by_keys(request_options: {}, **params) ⇒ Schematic::Companies::Types::DeleteCompanyByKeysResponse
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/schematic/companies/client.rb', line 307 def delete_company_by_keys(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "companies/delete", body: Schematic::Types::KeysRequestBody.new(params).to_h, 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::Companies::Types::DeleteCompanyByKeysResponse.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_membership(request_options: {}, **params) ⇒ Schematic::Companies::Types::DeleteCompanyMembershipResponse
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
# File 'lib/schematic/companies/client.rb', line 460 def delete_company_membership(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "company-memberships/#{URI.encode_uri_component(params[:company_membership_id].to_s)}", 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::Companies::Types::DeleteCompanyMembershipResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_user(request_options: {}, **params) ⇒ Schematic::Companies::Types::DeleteUserResponse
1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 |
# File 'lib/schematic/companies/client.rb', line 1291 def delete_user(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "DELETE", path: "users/#{URI.encode_uri_component(params[:user_id].to_s)}", 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::Companies::Types::DeleteUserResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#delete_user_by_keys(request_options: {}, **params) ⇒ Schematic::Companies::Types::DeleteUserByKeysResponse
1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 |
# File 'lib/schematic/companies/client.rb', line 1402 def delete_user_by_keys(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "users/delete", body: Schematic::Types::KeysRequestBody.new(params).to_h, 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::Companies::Types::DeleteUserByKeysResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_active_company_subscription(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetActiveCompanySubscriptionResponse
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 |
# File 'lib/schematic/companies/client.rb', line 495 def get_active_company_subscription(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id company_ids 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["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: [:base_url], method: "GET", path: "company-subscriptions", query: query_params, 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::Companies::Types::GetActiveCompanySubscriptionResponse.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(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetCompanyResponse
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
# File 'lib/schematic/companies/client.rb', line 129 def get_company(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "companies/#{URI.encode_uri_component(params[:company_id].to_s)}", 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::Companies::Types::GetCompanyResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_entity_trait_definition(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetEntityTraitDefinitionResponse
742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 |
# File 'lib/schematic/companies/client.rb', line 742 def get_entity_trait_definition(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "entity-trait-definitions/#{URI.encode_uri_component(params[:entity_trait_definition_id].to_s)}", 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::Companies::Types::GetEntityTraitDefinitionResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_entity_trait_values(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetEntityTraitValuesResponse
864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 |
# File 'lib/schematic/companies/client.rb', line 864 def get_entity_trait_values(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[definition_id q limit offset] query_params = {} query_params["definition_id"] = params[:definition_id] if params.key?(:definition_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: [:base_url], method: "GET", path: "entity-trait-values", query: query_params, 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::Companies::Types::GetEntityTraitValuesResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_or_create_company_membership(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetOrCreateCompanyMembershipResponse
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/schematic/companies/client.rb', line 427 def get_or_create_company_membership(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "company-memberships", body: Schematic::Companies::Types::GetOrCreateCompanyMembershipRequestBody.new(params).to_h, 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::Companies::Types::GetOrCreateCompanyMembershipResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#get_or_create_entity_trait_definition(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetOrCreateEntityTraitDefinitionResponse
709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 |
# File 'lib/schematic/companies/client.rb', line 709 def get_or_create_entity_trait_definition(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "entity-trait-definitions", body: Schematic::Companies::Types::CreateEntityTraitDefinitionRequestBody.new(params).to_h, 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::Companies::Types::GetOrCreateEntityTraitDefinitionResponse.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_change(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetPlanChangeResponse
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 |
# File 'lib/schematic/companies/client.rb', line 955 def get_plan_change(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "plan-changes/#{URI.encode_uri_component(params[:plan_change_id].to_s)}", 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::Companies::Types::GetPlanChangeResponse.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_trait(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetPlanTraitResponse
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 |
# File 'lib/schematic/companies/client.rb', line 1035 def get_plan_trait(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "plan-traits/#{URI.encode_uri_component(params[:plan_trait_id].to_s)}", 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::Companies::Types::GetPlanTraitResponse.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(request_options: {}, **params) ⇒ Schematic::Companies::Types::GetUserResponse
1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 |
# File 'lib/schematic/companies/client.rb', line 1259 def get_user(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "users/#{URI.encode_uri_component(params[:user_id].to_s)}", 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::Companies::Types::GetUserResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_companies(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListCompaniesResponse
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/schematic/companies/client.rb', line 41 def list_companies(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[credit_type_ids has_scheduled_downgrade ids monetized_subscriptions plan_id plan_ids plan_version_id q sort_order_column sort_order_direction subscription_statuses subscription_types with_entitlement_for without_feature_override_for without_plan without_subscription with_subscription limit offset] query_params = {} query_params["credit_type_ids"] = params[:credit_type_ids] if params.key?(:credit_type_ids) query_params["has_scheduled_downgrade"] = params[:has_scheduled_downgrade] if params.key?(:has_scheduled_downgrade) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["monetized_subscriptions"] = params[:monetized_subscriptions] if params.key?(:monetized_subscriptions) 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["q"] = params[:q] if params.key?(:q) query_params["sort_order_column"] = params[:sort_order_column] if params.key?(:sort_order_column) query_params["sort_order_direction"] = params[:sort_order_direction] if params.key?(:sort_order_direction) query_params["subscription_statuses"] = params[:subscription_statuses] if params.key?(:subscription_statuses) query_params["subscription_types"] = params[:subscription_types] if params.key?(:subscription_types) query_params["with_entitlement_for"] = params[:with_entitlement_for] if params.key?(:with_entitlement_for) query_params["without_feature_override_for"] = params[:without_feature_override_for] if params.key?(:without_feature_override_for) query_params["without_plan"] = params[:without_plan] if params.key?(:without_plan) query_params["without_subscription"] = params[:without_subscription] if params.key?(:without_subscription) query_params["with_subscription"] = params[:with_subscription] if params.key?(:with_subscription) 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: [:base_url], method: "GET", path: "companies", query: query_params, 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::Companies::Types::ListCompaniesResponse.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_memberships(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListCompanyMembershipsResponse
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'lib/schematic/companies/client.rb', line 387 def list_company_memberships(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id user_id limit offset] query_params = {} query_params["company_id"] = params[:company_id] if params.key?(:company_id) query_params["user_id"] = params[:user_id] if params.key?(:user_id) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "company-memberships", query: query_params, 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::Companies::Types::ListCompanyMembershipsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_entity_key_definitions(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListEntityKeyDefinitionsResponse
572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 |
# File 'lib/schematic/companies/client.rb', line 572 def list_entity_key_definitions(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[entity_type ids q limit offset] query_params = {} query_params["entity_type"] = params[:entity_type] if params.key?(:entity_type) query_params["ids"] = params[:ids] if params.key?(:ids) 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: [:base_url], method: "GET", path: "entity-key-definitions", query: query_params, 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::Companies::Types::ListEntityKeyDefinitionsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_entity_trait_definitions(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListEntityTraitDefinitionsResponse
666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 |
# File 'lib/schematic/companies/client.rb', line 666 def list_entity_trait_definitions(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[entity_type ids q trait_type trait_types limit offset] query_params = {} query_params["entity_type"] = params[:entity_type] if params.key?(:entity_type) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["q"] = params[:q] if params.key?(:q) query_params["trait_type"] = params[:trait_type] if params.key?(:trait_type) query_params["trait_types"] = params[:trait_types] if params.key?(:trait_types) 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: [:base_url], method: "GET", path: "entity-trait-definitions", query: query_params, 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::Companies::Types::ListEntityTraitDefinitionsResponse.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_changes(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListPlanChangesResponse
911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 |
# File 'lib/schematic/companies/client.rb', line 911 def list_plan_changes(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[action base_plan_action company_id company_ids plan_ids limit offset] query_params = {} query_params["action"] = params[:action] if params.key?(:action) query_params["base_plan_action"] = params[:base_plan_action] if params.key?(:base_plan_action) 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["plan_ids"] = params[:plan_ids] if params.key?(:plan_ids) 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: [:base_url], method: "GET", path: "plan-changes", query: query_params, 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::Companies::Types::ListPlanChangesResponse.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_traits(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListPlanTraitsResponse
992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 |
# File 'lib/schematic/companies/client.rb', line 992 def list_plan_traits(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[ids plan_id trait_id trait_ids limit offset] query_params = {} query_params["ids"] = params[:ids] if params.key?(:ids) query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id) query_params["trait_id"] = params[:trait_id] if params.key?(:trait_id) query_params["trait_ids"] = params[:trait_ids] if params.key?(:trait_ids) 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: [:base_url], method: "GET", path: "plan-traits", query: query_params, 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::Companies::Types::ListPlanTraitsResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#list_users(request_options: {}, **params) ⇒ Schematic::Companies::Types::ListUsersResponse
1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 |
# File 'lib/schematic/companies/client.rb', line 1184 def list_users(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) query_param_names = %i[company_id ids plan_id q limit offset] query_params = {} query_params["company_id"] = params[:company_id] if params.key?(:company_id) query_params["ids"] = params[:ids] if params.key?(:ids) query_params["plan_id"] = params[:plan_id] if params.key?(:plan_id) query_params["q"] = params[:q] if params.key?(:q) query_params["limit"] = params[:limit] if params.key?(:limit) query_params["offset"] = params[:offset] if params.key?(:offset) params.except(*query_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "GET", path: "users", query: query_params, 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::Companies::Types::ListUsersResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#lookup_company(request_options: {}, **params) ⇒ Schematic::Companies::Types::LookupCompanyResponse
Company lookup is determined to resolve a company from its keys, similar to how many of our other apis work. The following approaches will all work to resolve a company and any of them are appropriate:
-
‘/companies/lookup?keys=“bar”, “fizz”: “buzz”`
-
‘/companies/lookup?keys=bar&keys=buzz`
-
‘/companies/lookup?foo=bar&fizz=buzz`
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/schematic/companies/client.rb', line 346 def lookup_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: [:base_url], method: "GET", path: "companies/lookup", query: query_params, 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::Companies::Types::LookupCompanyResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#lookup_user(request_options: {}, **params) ⇒ Schematic::Companies::Types::LookupUserResponse
1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 |
# File 'lib/schematic/companies/client.rb', line 1435 def lookup_user(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: [:base_url], method: "GET", path: "users/lookup", query: query_params, 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::Companies::Types::LookupUserResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#update_entity_trait_definition(request_options: {}, **params) ⇒ Schematic::Companies::Types::UpdateEntityTraitDefinitionResponse
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 |
# File 'lib/schematic/companies/client.rb', line 774 def update_entity_trait_definition(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request_data = Schematic::Companies::Types::UpdateEntityTraitDefinitionRequestBody.new(params).to_h non_body_param_names = ["entity_trait_definition_id"] body = request_data.except(*non_body_param_names) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "PUT", path: "entity-trait-definitions/#{URI.encode_uri_component(params[:entity_trait_definition_id].to_s)}", body: body, 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::Companies::Types::UpdateEntityTraitDefinitionResponse.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_traits_bulk(request_options: {}, **params) ⇒ Schematic::Companies::Types::UpdatePlanTraitsBulkResponse
1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 |
# File 'lib/schematic/companies/client.rb', line 1066 def update_plan_traits_bulk(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "plan-traits/bulk", body: Schematic::Companies::Types::UpdatePlanTraitBulkRequestBody.new(params).to_h, 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::Companies::Types::UpdatePlanTraitsBulkResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#upsert_company(request_options: {}, **params) ⇒ Schematic::Companies::Types::UpsertCompanyResponse
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/schematic/companies/client.rb', line 96 def upsert_company(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "companies", body: Schematic::Types::UpsertCompanyRequestBody.new(params).to_h, 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::Companies::Types::UpsertCompanyResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#upsert_company_trait(request_options: {}, **params) ⇒ Schematic::Companies::Types::UpsertCompanyTraitResponse
535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 |
# File 'lib/schematic/companies/client.rb', line 535 def upsert_company_trait(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "company-traits", body: Schematic::Types::UpsertTraitRequestBody.new(params).to_h, 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::Companies::Types::UpsertCompanyTraitResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#upsert_user(request_options: {}, **params) ⇒ Schematic::Companies::Types::UpsertUserResponse
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/companies/client.rb', line 1226 def upsert_user(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "users", body: Schematic::Types::UpsertUserRequestBody.new(params).to_h, 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::Companies::Types::UpsertUserResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |
#upsert_user_trait(request_options: {}, **params) ⇒ Schematic::Companies::Types::UpsertUserTraitResponse
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 |
# File 'lib/schematic/companies/client.rb', line 1146 def upsert_user_trait(request_options: {}, **params) params = Schematic::Internal::Types::Utils.normalize_keys(params) request = Schematic::Internal::JSON::Request.new( base_url: [:base_url], method: "POST", path: "user-traits", body: Schematic::Types::UpsertTraitRequestBody.new(params).to_h, 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::Companies::Types::UpsertUserTraitResponse.load(response.body) else error_class = Schematic::Errors::ResponseError.subclass_for_code(code) raise error_class.new(response.body, code: code) end end |