sc-apimatic-sdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +28 -0
- data/README.md +166 -0
- data/bin/console +15 -0
- data/lib/socure_risk_os_api/api_helper.rb +10 -0
- data/lib/socure_risk_os_api/apis/base_api.rb +67 -0
- data/lib/socure_risk_os_api/apis/evaluation_api.rb +318 -0
- data/lib/socure_risk_os_api/apis/feedback_api.rb +102 -0
- data/lib/socure_risk_os_api/apis/reason_codes_api.rb +61 -0
- data/lib/socure_risk_os_api/client.rb +85 -0
- data/lib/socure_risk_os_api/configuration.rb +179 -0
- data/lib/socure_risk_os_api/exceptions/api_exception.rb +21 -0
- data/lib/socure_risk_os_api/exceptions/error_exception.rb +80 -0
- data/lib/socure_risk_os_api/http/api_response.rb +19 -0
- data/lib/socure_risk_os_api/http/auth/oauth_2.rb +53 -0
- data/lib/socure_risk_os_api/http/http_call_back.rb +10 -0
- data/lib/socure_risk_os_api/http/http_method_enum.rb +10 -0
- data/lib/socure_risk_os_api/http/http_request.rb +10 -0
- data/lib/socure_risk_os_api/http/http_response.rb +10 -0
- data/lib/socure_risk_os_api/http/proxy_settings.rb +22 -0
- data/lib/socure_risk_os_api/logging/configuration/api_logging_configuration.rb +186 -0
- data/lib/socure_risk_os_api/logging/sdk_logger.rb +17 -0
- data/lib/socure_risk_os_api/models/account.rb +206 -0
- data/lib/socure_risk_os_api/models/account1.rb +203 -0
- data/lib/socure_risk_os_api/models/account_inquiry.rb +36 -0
- data/lib/socure_risk_os_api/models/account_snapshot.rb +106 -0
- data/lib/socure_risk_os_api/models/account_view.rb +116 -0
- data/lib/socure_risk_os_api/models/actions.rb +88 -0
- data/lib/socure_risk_os_api/models/additional_context.rb +235 -0
- data/lib/socure_risk_os_api/models/additional_individual.rb +270 -0
- data/lib/socure_risk_os_api/models/address.rb +159 -0
- data/lib/socure_risk_os_api/models/address1.rb +144 -0
- data/lib/socure_risk_os_api/models/advanced_prefill.rb +168 -0
- data/lib/socure_risk_os_api/models/age_assurance.rb +163 -0
- data/lib/socure_risk_os_api/models/amount.rb +95 -0
- data/lib/socure_risk_os_api/models/api_evaluation_monitoring_request.rb +96 -0
- data/lib/socure_risk_os_api/models/api_evaluation_monitoring_response.rb +84 -0
- data/lib/socure_risk_os_api/models/api_feedback_request.rb +153 -0
- data/lib/socure_risk_os_api/models/api_reason_codes_response.rb +85 -0
- data/lib/socure_risk_os_api/models/attachment.rb +95 -0
- data/lib/socure_risk_os_api/models/bank_account_verification.rb +167 -0
- data/lib/socure_risk_os_api/models/base_model.rb +110 -0
- data/lib/socure_risk_os_api/models/business.rb +224 -0
- data/lib/socure_risk_os_api/models/business_onboarding.rb +167 -0
- data/lib/socure_risk_os_api/models/channel.rb +45 -0
- data/lib/socure_risk_os_api/models/channel1.rb +44 -0
- data/lib/socure_risk_os_api/models/code.rb +68 -0
- data/lib/socure_risk_os_api/models/consumer_onboarding.rb +167 -0
- data/lib/socure_risk_os_api/models/consumer_onboarding_patch.rb +178 -0
- data/lib/socure_risk_os_api/models/crypto_address.rb +105 -0
- data/lib/socure_risk_os_api/models/data.rb +106 -0
- data/lib/socure_risk_os_api/models/data1.rb +166 -0
- data/lib/socure_risk_os_api/models/data10.rb +166 -0
- data/lib/socure_risk_os_api/models/data2.rb +145 -0
- data/lib/socure_risk_os_api/models/data3.rb +160 -0
- data/lib/socure_risk_os_api/models/data4.rb +157 -0
- data/lib/socure_risk_os_api/models/data5.rb +154 -0
- data/lib/socure_risk_os_api/models/data6.rb +174 -0
- data/lib/socure_risk_os_api/models/data7.rb +205 -0
- data/lib/socure_risk_os_api/models/data8.rb +115 -0
- data/lib/socure_risk_os_api/models/data9.rb +130 -0
- data/lib/socure_risk_os_api/models/data_enrichment.rb +182 -0
- data/lib/socure_risk_os_api/models/decision.rb +47 -0
- data/lib/socure_risk_os_api/models/decision1.rb +48 -0
- data/lib/socure_risk_os_api/models/destination.rb +136 -0
- data/lib/socure_risk_os_api/models/device.rb +339 -0
- data/lib/socure_risk_os_api/models/disclosure_purpose.rb +29 -0
- data/lib/socure_risk_os_api/models/document_verification_config.rb +195 -0
- data/lib/socure_risk_os_api/models/docv.rb +98 -0
- data/lib/socure_risk_os_api/models/environment_name.rb +37 -0
- data/lib/socure_risk_os_api/models/eval_response_with_out_socure_data.rb +413 -0
- data/lib/socure_risk_os_api/models/eval_source.rb +38 -0
- data/lib/socure_risk_os_api/models/event_category.rb +45 -0
- data/lib/socure_risk_os_api/models/event_category1.rb +45 -0
- data/lib/socure_risk_os_api/models/event_category2.rb +57 -0
- data/lib/socure_risk_os_api/models/event_details.rb +96 -0
- data/lib/socure_risk_os_api/models/formation.rb +138 -0
- data/lib/socure_risk_os_api/models/fraud_feedback_import_response.rb +73 -0
- data/lib/socure_risk_os_api/models/fraud_feedback_response.rb +73 -0
- data/lib/socure_risk_os_api/models/fraud_label.rb +37 -0
- data/lib/socure_risk_os_api/models/gender.rb +40 -0
- data/lib/socure_risk_os_api/models/generic_passthrough.rb +169 -0
- data/lib/socure_risk_os_api/models/individual.rb +281 -0
- data/lib/socure_risk_os_api/models/individual1.rb +292 -0
- data/lib/socure_risk_os_api/models/individual3.rb +206 -0
- data/lib/socure_risk_os_api/models/individual4.rb +182 -0
- data/lib/socure_risk_os_api/models/individual5.rb +297 -0
- data/lib/socure_risk_os_api/models/individual6.rb +148 -0
- data/lib/socure_risk_os_api/models/input.rb +86 -0
- data/lib/socure_risk_os_api/models/inquiry.rb +36 -0
- data/lib/socure_risk_os_api/models/invalid_arg.rb +85 -0
- data/lib/socure_risk_os_api/models/language.rb +247 -0
- data/lib/socure_risk_os_api/models/login_and_authentication.rb +167 -0
- data/lib/socure_risk_os_api/models/method.rb +37 -0
- data/lib/socure_risk_os_api/models/monitoring_status.rb +37 -0
- data/lib/socure_risk_os_api/models/operation.rb +38 -0
- data/lib/socure_risk_os_api/models/otp.rb +95 -0
- data/lib/socure_risk_os_api/models/otp1.rb +98 -0
- data/lib/socure_risk_os_api/models/payment_screening.rb +167 -0
- data/lib/socure_risk_os_api/models/payment_screening_business.rb +155 -0
- data/lib/socure_risk_os_api/models/payment_screening_individual.rb +254 -0
- data/lib/socure_risk_os_api/models/payment_screening_instrument.rb +105 -0
- data/lib/socure_risk_os_api/models/product.rb +76 -0
- data/lib/socure_risk_os_api/models/reason_code.rb +149 -0
- data/lib/socure_risk_os_api/models/redirect.rb +118 -0
- data/lib/socure_risk_os_api/models/response.rb +77 -0
- data/lib/socure_risk_os_api/models/source.rb +146 -0
- data/lib/socure_risk_os_api/models/status.rb +40 -0
- data/lib/socure_risk_os_api/models/status1.rb +40 -0
- data/lib/socure_risk_os_api/models/transaction_details.rb +97 -0
- data/lib/socure_risk_os_api/models/trust_and_safety.rb +167 -0
- data/lib/socure_risk_os_api/models/type.rb +36 -0
- data/lib/socure_risk_os_api/models/type1.rb +36 -0
- data/lib/socure_risk_os_api/models/type2.rb +36 -0
- data/lib/socure_risk_os_api/models/update_decision.rb +156 -0
- data/lib/socure_risk_os_api/models/update_status.rb +169 -0
- data/lib/socure_risk_os_api/models/workforce_verification.rb +167 -0
- data/lib/socure_risk_os_api/utilities/date_time_helper.rb +11 -0
- data/lib/socure_risk_os_api/utilities/file_wrapper.rb +28 -0
- data/lib/socure_risk_os_api/utilities/union_type_lookup.rb +69 -0
- data/lib/socure_risk_os_api.rb +143 -0
- metadata +205 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
# socure_risk_os_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SocureRiskOsApi
|
|
7
|
+
# FeedbackApi
|
|
8
|
+
class FeedbackApi < BaseApi
|
|
9
|
+
# Allows you to programmatically provide feedback to an existing evaluation
|
|
10
|
+
# in RiskOS™.
|
|
11
|
+
# @param [ApiFeedbackRequest] body Required parameter: TODO: type
|
|
12
|
+
# description here
|
|
13
|
+
# @param [String] x_api_version Optional parameter: This header is optional.
|
|
14
|
+
# If omitted, requests use the current default version, `2025-01-01.orion`.
|
|
15
|
+
# Set this header to pin your integration to a specific API version.
|
|
16
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
17
|
+
def feedback_api(body,
|
|
18
|
+
x_api_version: nil)
|
|
19
|
+
@api_call
|
|
20
|
+
.request(new_request_builder(HttpMethodEnum::PUT,
|
|
21
|
+
'/api/feedback',
|
|
22
|
+
Server::DEFAULT)
|
|
23
|
+
.header_param(new_parameter('application/json', key: 'Content-Type'))
|
|
24
|
+
.body_param(new_parameter(body)
|
|
25
|
+
.is_required(true))
|
|
26
|
+
.header_param(new_parameter(x_api_version, key: 'X-API-Version'))
|
|
27
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
28
|
+
.body_serializer(proc do |param| param.to_json unless param.nil? end)
|
|
29
|
+
.auth(Single.new('BearerAuth')))
|
|
30
|
+
.response(new_response_handler
|
|
31
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
32
|
+
.deserialize_into(FraudFeedbackResponse.method(:from_hash))
|
|
33
|
+
.is_api_response(true)
|
|
34
|
+
.local_error('400',
|
|
35
|
+
'Bad Request - The request was unacceptable.',
|
|
36
|
+
APIException)
|
|
37
|
+
.local_error('401',
|
|
38
|
+
'Unauthorized - An invalid API key was provided.',
|
|
39
|
+
APIException)
|
|
40
|
+
.local_error('404',
|
|
41
|
+
'Not Found - The requested resource does not exist.',
|
|
42
|
+
APIException)
|
|
43
|
+
.local_error('429',
|
|
44
|
+
'Too Many Requests - The rate limit for this API has been'\
|
|
45
|
+
' exceeded. '\
|
|
46
|
+
' ',
|
|
47
|
+
APIException)
|
|
48
|
+
.local_error('500',
|
|
49
|
+
'Internal Server Error – An unexpected condition occurred on'\
|
|
50
|
+
' the server.',
|
|
51
|
+
APIException))
|
|
52
|
+
.execute
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
# Allows you to upload a CSV file to provide programmatic feedback to
|
|
56
|
+
# RiskOS™.
|
|
57
|
+
# @param [File | UploadIO] file Required parameter: CSV file containing
|
|
58
|
+
# feedback records. The file must contain **8 columns in the required
|
|
59
|
+
# order**. A header row is required, but header names are ignored. See the
|
|
60
|
+
# endpoint description for the full CSV format specification.
|
|
61
|
+
# @param [String] x_api_version Optional parameter: This header is optional.
|
|
62
|
+
# If omitted, requests use the current default version, `2025-01-01.orion`.
|
|
63
|
+
# Set this header to pin your integration to a specific API version.
|
|
64
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
65
|
+
def feedback_update_csv(file,
|
|
66
|
+
x_api_version: nil)
|
|
67
|
+
@api_call
|
|
68
|
+
.request(new_request_builder(HttpMethodEnum::POST,
|
|
69
|
+
'/api/feedback/import',
|
|
70
|
+
Server::DEFAULT)
|
|
71
|
+
.multipart_param(new_parameter(file, key: 'file')
|
|
72
|
+
.is_required(true)
|
|
73
|
+
.default_content_type('application/octet-stream'))
|
|
74
|
+
.header_param(new_parameter(x_api_version, key: 'X-API-Version'))
|
|
75
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
76
|
+
.auth(Single.new('BearerAuth')))
|
|
77
|
+
.response(new_response_handler
|
|
78
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
79
|
+
.deserialize_into(FraudFeedbackImportResponse.method(:from_hash))
|
|
80
|
+
.is_api_response(true)
|
|
81
|
+
.local_error('400',
|
|
82
|
+
'Bad Request - The request was unacceptable.',
|
|
83
|
+
APIException)
|
|
84
|
+
.local_error('401',
|
|
85
|
+
'Unauthorized - An invalid API key was provided.',
|
|
86
|
+
APIException)
|
|
87
|
+
.local_error('404',
|
|
88
|
+
'Not Found - The requested resource does not exist. The client'\
|
|
89
|
+
' should not repeat this request without modification.',
|
|
90
|
+
APIException)
|
|
91
|
+
.local_error('429',
|
|
92
|
+
'Too Many Requests - The rate limit for this API has been'\
|
|
93
|
+
' exceeded.',
|
|
94
|
+
APIException)
|
|
95
|
+
.local_error('500',
|
|
96
|
+
'Internal Server Error – An unexpected condition occurred on'\
|
|
97
|
+
' the server.',
|
|
98
|
+
APIException))
|
|
99
|
+
.execute
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
end
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# socure_risk_os_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SocureRiskOsApi
|
|
7
|
+
# ReasonCodesApi
|
|
8
|
+
class ReasonCodesApi < BaseApi
|
|
9
|
+
# Returns the catalog of reason codes available to your account, including
|
|
10
|
+
# each code's name, provider, description, and product. Use this endpoint to
|
|
11
|
+
# cache reason code descriptions in your own systems or to keep an internal
|
|
12
|
+
# mapping in sync, rather than reading the **Reason Codes** page in the
|
|
13
|
+
# RiskOS™ Dashboard manually.
|
|
14
|
+
# By default, the response includes every active reason code and excludes
|
|
15
|
+
# deprecated codes. Use the query parameters to filter the catalog. You can
|
|
16
|
+
# combine parameters, and you can repeat `product` and `name` to match
|
|
17
|
+
# several values.
|
|
18
|
+
# The catalog changes infrequently. Cache the response and refresh it
|
|
19
|
+
# periodically rather than calling the endpoint on every transaction.
|
|
20
|
+
# @param [Array[Product]] product Optional parameter: Returns only codes for
|
|
21
|
+
# the named product. Repeat the parameter to match several products.
|
|
22
|
+
# @param [Array[String]] name Optional parameter: Returns only the codes
|
|
23
|
+
# whose name exactly matches the value. Repeat the parameter to request
|
|
24
|
+
# several codes.
|
|
25
|
+
# @param [String] text Optional parameter: Returns codes whose name or
|
|
26
|
+
# description contains the substring, case-insensitive. Useful for keyword
|
|
27
|
+
# search.
|
|
28
|
+
# @param [TrueClass | FalseClass] is_active Optional parameter: Set to
|
|
29
|
+
# `true` to return only active codes, or `false` to include deprecated
|
|
30
|
+
# codes. When omitted, only active codes are returned.
|
|
31
|
+
# @return [ApiResponse] Complete http response with raw body and status code.
|
|
32
|
+
def get_reason_codes(product: nil,
|
|
33
|
+
name: nil,
|
|
34
|
+
text: nil,
|
|
35
|
+
is_active: nil)
|
|
36
|
+
@api_call
|
|
37
|
+
.request(new_request_builder(HttpMethodEnum::GET,
|
|
38
|
+
'/api/reason-codes',
|
|
39
|
+
Server::DEFAULT)
|
|
40
|
+
.query_param(new_parameter(product, key: 'product'))
|
|
41
|
+
.query_param(new_parameter(name, key: 'name'))
|
|
42
|
+
.query_param(new_parameter(text, key: 'text'))
|
|
43
|
+
.query_param(new_parameter(is_active, key: 'isActive'))
|
|
44
|
+
.header_param(new_parameter('application/json', key: 'accept'))
|
|
45
|
+
.auth(Single.new('BearerAuth')))
|
|
46
|
+
.response(new_response_handler
|
|
47
|
+
.deserializer(APIHelper.method(:custom_type_deserializer))
|
|
48
|
+
.deserialize_into(ApiReasonCodesResponse.method(:from_hash))
|
|
49
|
+
.is_api_response(true)
|
|
50
|
+
.local_error('401',
|
|
51
|
+
'Unauthorized - The API key is missing or invalid.',
|
|
52
|
+
APIException)
|
|
53
|
+
.local_error('500',
|
|
54
|
+
"Internal Server Error - RiskOS™ could not retrieve the catalog'\
|
|
55
|
+
'. Retry, then contact Socure support if the problem persists.'\
|
|
56
|
+
'\n",
|
|
57
|
+
APIException))
|
|
58
|
+
.execute
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
end
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# socure_risk_os_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SocureRiskOsApi
|
|
7
|
+
# socure_risk_os_api client class.
|
|
8
|
+
class Client
|
|
9
|
+
include CoreLibrary
|
|
10
|
+
attr_reader :config, :auth_managers
|
|
11
|
+
|
|
12
|
+
def user_agent_detail
|
|
13
|
+
config.user_agent_detail
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Access to evaluation controller.
|
|
17
|
+
# @return [EvaluationApi] Returns the controller instance.
|
|
18
|
+
def evaluation
|
|
19
|
+
@evaluation ||= EvaluationApi.new @global_configuration
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
# Access to feedback controller.
|
|
23
|
+
# @return [FeedbackApi] Returns the controller instance.
|
|
24
|
+
def feedback
|
|
25
|
+
@feedback ||= FeedbackApi.new @global_configuration
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Access to reason_codes controller.
|
|
29
|
+
# @return [ReasonCodesApi] Returns the controller instance.
|
|
30
|
+
def reason_codes
|
|
31
|
+
@reason_codes ||= ReasonCodesApi.new @global_configuration
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def initialize(
|
|
35
|
+
connection: nil, adapter: :net_http_persistent, timeout: 30,
|
|
36
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
37
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
38
|
+
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
39
|
+
logging_configuration: nil, environment: Environment::PRODUCTION,
|
|
40
|
+
bearer_auth_credentials: nil, config: nil
|
|
41
|
+
)
|
|
42
|
+
@config = if config.nil?
|
|
43
|
+
Configuration.new(
|
|
44
|
+
connection: connection, adapter: adapter, timeout: timeout,
|
|
45
|
+
max_retries: max_retries, retry_interval: retry_interval,
|
|
46
|
+
backoff_factor: backoff_factor,
|
|
47
|
+
retry_statuses: retry_statuses,
|
|
48
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
|
49
|
+
proxy_settings: proxy_settings,
|
|
50
|
+
logging_configuration: logging_configuration,
|
|
51
|
+
environment: environment,
|
|
52
|
+
bearer_auth_credentials: bearer_auth_credentials
|
|
53
|
+
)
|
|
54
|
+
else
|
|
55
|
+
config
|
|
56
|
+
end
|
|
57
|
+
user_agent_params = BaseApi.user_agent_parameters
|
|
58
|
+
|
|
59
|
+
@global_configuration = GlobalConfiguration.new(client_configuration: @config)
|
|
60
|
+
.base_uri_executor(@config.method(:get_base_uri))
|
|
61
|
+
.global_errors(BaseApi::GLOBAL_ERRORS)
|
|
62
|
+
.user_agent(BaseApi.user_agent,
|
|
63
|
+
agent_parameters: user_agent_params)
|
|
64
|
+
|
|
65
|
+
initialize_auth_managers(@global_configuration)
|
|
66
|
+
@global_configuration = @global_configuration.auth_managers(@auth_managers)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Initializes the auth managers hash used for authenticating API calls.
|
|
70
|
+
# @param [GlobalConfiguration] global_config The global configuration of the SDK)
|
|
71
|
+
def initialize_auth_managers(global_config)
|
|
72
|
+
@auth_managers = {}
|
|
73
|
+
http_client_config = global_config.client_configuration
|
|
74
|
+
%w[BearerAuth].each { |auth| @auth_managers[auth] = nil }
|
|
75
|
+
@auth_managers['BearerAuth'] = Oauth2.new(http_client_config.bearer_auth_credentials)
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Creates a client directly from environment variables.
|
|
79
|
+
def self.from_env(**overrides)
|
|
80
|
+
default_config = Configuration.build_default_config_from_env
|
|
81
|
+
new_config = default_config.clone_with(**overrides)
|
|
82
|
+
new(config: new_config)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
end
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# socure_risk_os_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SocureRiskOsApi
|
|
7
|
+
# An enum for SDK environments.
|
|
8
|
+
class Environment
|
|
9
|
+
# PRODUCTION: Production server (versioned)
|
|
10
|
+
# ENVIRONMENT2: Sandbox server (for testing and development, versioned)
|
|
11
|
+
ENVIRONMENT = [
|
|
12
|
+
PRODUCTION = 'production'.freeze,
|
|
13
|
+
ENVIRONMENT2 = 'environment2'.freeze
|
|
14
|
+
].freeze
|
|
15
|
+
|
|
16
|
+
# Converts a string or symbol into a valid Environment constant.
|
|
17
|
+
def self.from_value(value, default_value = PRODUCTION)
|
|
18
|
+
return default_value if value.nil?
|
|
19
|
+
|
|
20
|
+
str = value.to_s.strip.downcase
|
|
21
|
+
case str
|
|
22
|
+
when 'production' then PRODUCTION
|
|
23
|
+
when 'environment2' then ENVIRONMENT2
|
|
24
|
+
|
|
25
|
+
else
|
|
26
|
+
warn "[Environment] Unknown environment '#{value}', falling back to #{default_value} "
|
|
27
|
+
default_value
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
# An enum for API servers.
|
|
33
|
+
class Server
|
|
34
|
+
SERVER = [
|
|
35
|
+
DEFAULT = 'default'.freeze
|
|
36
|
+
].freeze
|
|
37
|
+
|
|
38
|
+
# Converts a string or symbol into a valid Server constant.
|
|
39
|
+
def self.from_value(value, default_value = DEFAULT)
|
|
40
|
+
return default_value if value.nil?
|
|
41
|
+
|
|
42
|
+
default_value
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# All configuration including auth info and base URI for the API access
|
|
47
|
+
# are configured in this class.
|
|
48
|
+
class Configuration < CoreLibrary::HttpClientConfiguration
|
|
49
|
+
# The attribute readers for properties.
|
|
50
|
+
attr_reader :environment, :bearer_auth_credentials
|
|
51
|
+
|
|
52
|
+
class << self
|
|
53
|
+
attr_reader :environments
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def initialize(
|
|
57
|
+
connection: nil, adapter: :net_http_persistent, timeout: 30,
|
|
58
|
+
max_retries: 0, retry_interval: 1, backoff_factor: 2,
|
|
59
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
|
60
|
+
retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
|
|
61
|
+
logging_configuration: nil, environment: Environment::PRODUCTION,
|
|
62
|
+
bearer_auth_credentials: nil
|
|
63
|
+
)
|
|
64
|
+
super connection: connection, adapter: adapter, timeout: timeout,
|
|
65
|
+
max_retries: max_retries, retry_interval: retry_interval,
|
|
66
|
+
backoff_factor: backoff_factor, retry_statuses: retry_statuses,
|
|
67
|
+
retry_methods: retry_methods, http_callback: http_callback,
|
|
68
|
+
proxy_settings: proxy_settings,
|
|
69
|
+
logging_configuration: logging_configuration
|
|
70
|
+
|
|
71
|
+
# Current API environment
|
|
72
|
+
@environment = String(environment)
|
|
73
|
+
|
|
74
|
+
# The object holding OAuth 2 Bearer token credentials
|
|
75
|
+
@bearer_auth_credentials = bearer_auth_credentials
|
|
76
|
+
|
|
77
|
+
# Initializing OAuth 2 Bearer token credentials with the provided auth parameters
|
|
78
|
+
@bearer_auth_credentials = bearer_auth_credentials
|
|
79
|
+
|
|
80
|
+
# The Http Client to use for making requests.
|
|
81
|
+
set_http_client CoreLibrary::FaradayClient.new(self)
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def clone_with(connection: nil, adapter: nil, timeout: nil,
|
|
85
|
+
max_retries: nil, retry_interval: nil, backoff_factor: nil,
|
|
86
|
+
retry_statuses: nil, retry_methods: nil, http_callback: nil,
|
|
87
|
+
proxy_settings: nil, logging_configuration: nil,
|
|
88
|
+
environment: nil, bearer_auth_credentials: nil)
|
|
89
|
+
connection ||= self.connection
|
|
90
|
+
adapter ||= self.adapter
|
|
91
|
+
timeout ||= self.timeout
|
|
92
|
+
max_retries ||= self.max_retries
|
|
93
|
+
retry_interval ||= self.retry_interval
|
|
94
|
+
backoff_factor ||= self.backoff_factor
|
|
95
|
+
retry_statuses ||= self.retry_statuses
|
|
96
|
+
retry_methods ||= self.retry_methods
|
|
97
|
+
http_callback ||= self.http_callback
|
|
98
|
+
proxy_settings ||= self.proxy_settings
|
|
99
|
+
logging_configuration ||= self.logging_configuration
|
|
100
|
+
environment ||= self.environment
|
|
101
|
+
bearer_auth_credentials ||= self.bearer_auth_credentials
|
|
102
|
+
|
|
103
|
+
Configuration.new(connection: connection, adapter: adapter,
|
|
104
|
+
timeout: timeout, max_retries: max_retries,
|
|
105
|
+
retry_interval: retry_interval,
|
|
106
|
+
backoff_factor: backoff_factor,
|
|
107
|
+
retry_statuses: retry_statuses,
|
|
108
|
+
retry_methods: retry_methods,
|
|
109
|
+
http_callback: http_callback,
|
|
110
|
+
proxy_settings: proxy_settings,
|
|
111
|
+
logging_configuration: logging_configuration,
|
|
112
|
+
environment: environment,
|
|
113
|
+
bearer_auth_credentials: bearer_auth_credentials)
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
# All the environments the SDK can run in.
|
|
118
|
+
ENVIRONMENTS = {
|
|
119
|
+
Environment::PRODUCTION => {
|
|
120
|
+
Server::DEFAULT => 'https://riskos.socure.com'
|
|
121
|
+
},
|
|
122
|
+
Environment::ENVIRONMENT2 => {
|
|
123
|
+
Server::DEFAULT => 'https://riskos.sandbox.socure.com'
|
|
124
|
+
}
|
|
125
|
+
}.freeze
|
|
126
|
+
|
|
127
|
+
# Generates the appropriate base URI for the environment and the server.
|
|
128
|
+
# @param [Configuration::Server] server The server enum for which the base URI is
|
|
129
|
+
# required.
|
|
130
|
+
# @return [String] The base URI.
|
|
131
|
+
def get_base_uri(server = Server::DEFAULT)
|
|
132
|
+
ENVIRONMENTS[environment][server].clone
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# Builds a Configuration instance using environment variables.
|
|
136
|
+
def self.build_default_config_from_env
|
|
137
|
+
# === Core environment ===
|
|
138
|
+
environment = Environment.from_value(ENV.fetch('ENVIRONMENT', 'production'))
|
|
139
|
+
timeout = (ENV['TIMEOUT'] || 30).to_f
|
|
140
|
+
max_retries = (ENV['MAX_RETRIES'] || 0).to_i
|
|
141
|
+
retry_interval = (ENV['RETRY_INTERVAL'] || 1).to_f
|
|
142
|
+
backoff_factor = (ENV['BACKOFF_FACTOR'] || 2).to_f
|
|
143
|
+
retry_statuses = ENV.fetch('RETRY_STATUSES',
|
|
144
|
+
'[408, 413, 429, 500, 502, 503, 504, 521, 522, 524]').gsub(/[\[\]]/, '')
|
|
145
|
+
.split(',')
|
|
146
|
+
.map(&:strip)
|
|
147
|
+
.map do |item|
|
|
148
|
+
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
149
|
+
end
|
|
150
|
+
retry_methods = ENV.fetch('RETRY_METHODS', '%i[get put]').gsub(/[\[\]]/, '')
|
|
151
|
+
.split(',')
|
|
152
|
+
.map(&:strip)
|
|
153
|
+
.map do |item|
|
|
154
|
+
item.match?(/\A\d+\z/) ? item.to_i : item.downcase
|
|
155
|
+
end
|
|
156
|
+
|
|
157
|
+
# === Authentication credentials ===
|
|
158
|
+
bearer_auth_credentials = BearerAuthCredentials.from_env
|
|
159
|
+
|
|
160
|
+
# === Proxy settings ===
|
|
161
|
+
proxy_settings = ProxySettings.from_env
|
|
162
|
+
# === Logging Configuration ===
|
|
163
|
+
logging_configuration = LoggingConfiguration.from_env if LoggingConfiguration.any_logging_configured?
|
|
164
|
+
|
|
165
|
+
Configuration.new(
|
|
166
|
+
environment: environment,
|
|
167
|
+
timeout: timeout,
|
|
168
|
+
max_retries: max_retries,
|
|
169
|
+
retry_interval: retry_interval,
|
|
170
|
+
backoff_factor: backoff_factor,
|
|
171
|
+
retry_statuses: retry_statuses,
|
|
172
|
+
retry_methods: retry_methods,
|
|
173
|
+
bearer_auth_credentials: bearer_auth_credentials,
|
|
174
|
+
proxy_settings: proxy_settings,
|
|
175
|
+
logging_configuration: logging_configuration
|
|
176
|
+
)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# socure_risk_os_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SocureRiskOsApi
|
|
7
|
+
# Class for exceptions when there is a network error, status code error, etc.
|
|
8
|
+
class APIException < CoreLibrary::ApiException
|
|
9
|
+
# Provides a human-readable string representation of the object.
|
|
10
|
+
def to_s
|
|
11
|
+
class_name = self.class.name.split('::').last
|
|
12
|
+
"<#{class_name} status_code: #{@response_code}, reason: #{@reason}>"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
16
|
+
def inspect
|
|
17
|
+
class_name = self.class.name.split('::').last
|
|
18
|
+
"<#{class_name} status_code: #{@response_code.inspect}, reason: #{@reason.inspect}>"
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# socure_risk_os_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SocureRiskOsApi
|
|
7
|
+
# Structured error response returned for all non-2xx status codes.
|
|
8
|
+
class ErrorException < APIException
|
|
9
|
+
SKIP = Object.new
|
|
10
|
+
private_constant :SKIP
|
|
11
|
+
|
|
12
|
+
# A human-readable error message describing what went wrong.
|
|
13
|
+
# @return [String]
|
|
14
|
+
attr_accessor :error
|
|
15
|
+
|
|
16
|
+
# A machine-readable error code for programmatic handling.
|
|
17
|
+
# @return [Code]
|
|
18
|
+
attr_accessor :code
|
|
19
|
+
|
|
20
|
+
# Additional details or context about the error.
|
|
21
|
+
# @return [String]
|
|
22
|
+
attr_accessor :message
|
|
23
|
+
|
|
24
|
+
# Additional context about the error, such as size limits or constraint
|
|
25
|
+
# details. Present only when extra context is available.
|
|
26
|
+
# @return [Object]
|
|
27
|
+
attr_accessor :details
|
|
28
|
+
|
|
29
|
+
# Validation errors for specific request fields. Present only for request
|
|
30
|
+
# validation failures.
|
|
31
|
+
# @return [Array[InvalidArg]]
|
|
32
|
+
attr_accessor :invalid_args
|
|
33
|
+
|
|
34
|
+
# The constructor.
|
|
35
|
+
# @param [String] reason The reason for raising an exception.
|
|
36
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
|
37
|
+
def initialize(reason, response)
|
|
38
|
+
super(reason, response)
|
|
39
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
|
40
|
+
unbox(hash)
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
# Populates this object by extracting properties from a hash.
|
|
44
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
|
45
|
+
# response body.
|
|
46
|
+
def unbox(hash)
|
|
47
|
+
return nil unless hash
|
|
48
|
+
|
|
49
|
+
@error = hash.key?('error') ? hash['error'] : nil
|
|
50
|
+
@code = hash.key?('code') ? hash['code'] : SKIP
|
|
51
|
+
@message = hash.key?('message') ? hash['message'] : SKIP
|
|
52
|
+
@details = hash.key?('details') ? hash['details'] : SKIP
|
|
53
|
+
# Parameter is an array, so we need to iterate through it
|
|
54
|
+
@invalid_args = nil
|
|
55
|
+
unless hash['invalid_args'].nil?
|
|
56
|
+
@invalid_args = []
|
|
57
|
+
hash['invalid_args'].each do |structure|
|
|
58
|
+
@invalid_args << (InvalidArg.from_hash(structure) if structure)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
@invalid_args = SKIP unless hash.key?('invalid_args')
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
# Provides a human-readable string representation of the object.
|
|
66
|
+
def to_s
|
|
67
|
+
class_name = self.class.name.split('::').last
|
|
68
|
+
"<#{class_name} error: #{@error}, code: #{@code}, message: #{@message}, details:"\
|
|
69
|
+
" #{@details}, invalid_args: #{@invalid_args}>"
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
# Provides a debugging-friendly string with detailed object information.
|
|
73
|
+
def inspect
|
|
74
|
+
class_name = self.class.name.split('::').last
|
|
75
|
+
"<#{class_name} error: #{@error.inspect}, code: #{@code.inspect}, message:"\
|
|
76
|
+
" #{@message.inspect}, details: #{@details.inspect}, invalid_args:"\
|
|
77
|
+
" #{@invalid_args.inspect}>"
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# socure_risk_os_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SocureRiskOsApi
|
|
7
|
+
# Http response received.
|
|
8
|
+
class ApiResponse < CoreLibrary::ApiResponse
|
|
9
|
+
# The constructor
|
|
10
|
+
# @param [HttpResponse] http_response The original, raw response from the api.
|
|
11
|
+
# @param [Object] data The data field specified for the response.
|
|
12
|
+
# @param [Array<String>] errors Any errors returned by the server.
|
|
13
|
+
def initialize(http_response,
|
|
14
|
+
data: nil,
|
|
15
|
+
errors: nil)
|
|
16
|
+
super
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# socure_risk_os_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SocureRiskOsApi
|
|
7
|
+
# Utility class for OAuth 2 authorization and token management.
|
|
8
|
+
class Oauth2 < CoreLibrary::HeaderAuth
|
|
9
|
+
include CoreLibrary
|
|
10
|
+
# Display error message on occurrence of authentication failure.
|
|
11
|
+
# @returns [String] The oAuth error message.
|
|
12
|
+
def error_message
|
|
13
|
+
'BearerAuth: access_token is undefined.'
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
# Initialization constructor.
|
|
17
|
+
def initialize(bearer_auth_credentials)
|
|
18
|
+
auth_params = {}
|
|
19
|
+
@_access_token = bearer_auth_credentials.access_token unless
|
|
20
|
+
bearer_auth_credentials.nil? || bearer_auth_credentials.access_token.nil?
|
|
21
|
+
auth_params[:Authorization] = "Bearer #{@_access_token}" unless @_access_token.nil?
|
|
22
|
+
|
|
23
|
+
super auth_params
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Data class for BearerAuthCredentials.
|
|
28
|
+
class BearerAuthCredentials
|
|
29
|
+
attr_reader :access_token
|
|
30
|
+
|
|
31
|
+
def initialize(access_token:)
|
|
32
|
+
raise ArgumentError, 'access_token cannot be nil' if access_token.nil?
|
|
33
|
+
|
|
34
|
+
@access_token = access_token
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def self.from_env
|
|
38
|
+
access_token = ENV['ACCESS_TOKEN']
|
|
39
|
+
all_nil = [
|
|
40
|
+
access_token
|
|
41
|
+
].all?(&:nil?)
|
|
42
|
+
return nil if all_nil
|
|
43
|
+
|
|
44
|
+
new(access_token: access_token)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def clone_with(access_token: nil)
|
|
48
|
+
access_token ||= self.access_token
|
|
49
|
+
|
|
50
|
+
BearerAuthCredentials.new(access_token: access_token)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# socure_risk_os_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SocureRiskOsApi
|
|
7
|
+
# HttpCallBack allows defining callables for pre and post API calls.
|
|
8
|
+
class HttpCallBack < CoreLibrary::HttpCallback
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# socure_risk_os_api
|
|
2
|
+
#
|
|
3
|
+
# This file was automatically generated by APIMATIC
|
|
4
|
+
# v3.0 ( https://www.apimatic.io ).
|
|
5
|
+
|
|
6
|
+
module SocureRiskOsApi
|
|
7
|
+
##
|
|
8
|
+
# ProxySettings encapsulates HTTP proxy configuration for Faraday,
|
|
9
|
+
# including optional basic authentication.
|
|
10
|
+
#
|
|
11
|
+
class ProxySettings < CoreLibrary::ProxySettings
|
|
12
|
+
def self.from_env
|
|
13
|
+
address = ENV['PROXY_ADDRESS']
|
|
14
|
+
port = ENV['PROXY_PORT']
|
|
15
|
+
username = ENV['PROXY_USERNAME']
|
|
16
|
+
password = ENV['PROXY_PASSWORD']
|
|
17
|
+
return nil if address.nil? || address.strip.empty?
|
|
18
|
+
|
|
19
|
+
new(address: address, port: port, username: username, password: password)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|