test-sdk-raza 1.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 +116 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/api_helper.rb +10 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/apis/base_api.rb +67 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/apis/m5_gbi_device_actions_api.rb +91 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/apis/oauth_authorization_api.rb +44 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/client.rb +80 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/configuration.rb +116 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/exceptions/api_exception.rb +21 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/exceptions/m5_gbi_rest_error_response_exception.rb +52 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/exceptions/oauth_provider_exception.rb +64 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/api_response.rb +19 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/auth/thingspace_oauth.rb +133 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/auth/vz_m2_m_session_token.rb +42 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/http_call_back.rb +10 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/http_method_enum.rb +10 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/http_request.rb +10 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/http_response.rb +10 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/proxy_settings.rb +13 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/logging/configuration/api_logging_configuration.rb +114 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/logging/sdk_logger.rb +17 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/base_model.rb +110 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/group_name.rb +85 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbi_address.rb +154 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbi_carrier_information.rb +86 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbi_customer_name.rb +125 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbi_request_response.rb +76 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiaccount_nameobject.rb +228 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiactivate_request.rb +146 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiaddress_andcustomerinfo.rb +87 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiaddress_andcustomerinfo2.rb +87 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiattribute1.rb +84 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiattribute2.rb +95 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbichange_request.rb +126 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbidevice_detailsresponse.rb +95 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbidevice_id.rb +76 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbidevice_id1.rb +95 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbidevice_idarray.rb +88 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbidevice_idarray2.rb +95 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbikey_value1.rb +95 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiprimary_placeofuse.rb +96 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/oauth_provider_error.rb +45 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/oauth_token.rb +96 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/utilities/date_time_helper.rb +11 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/utilities/file_wrapper.rb +28 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi/utilities/union_type_lookup.rb +85 -0
- data/lib/api_endpoints_for5_g_business_internet5_g_bi.rb +110 -0
- metadata +132 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
7
|
+
# OAuth 2 Authorization endpoint exception.
|
8
|
+
class OauthProviderException < APIException
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# Gets or sets error code.
|
13
|
+
# @return [OauthProviderError]
|
14
|
+
attr_accessor :error
|
15
|
+
|
16
|
+
# Gets or sets human-readable text providing additional information on
|
17
|
+
# error.
|
18
|
+
# Used to assist the client developer in understanding the error that
|
19
|
+
# occurred.
|
20
|
+
# @return [String]
|
21
|
+
attr_accessor :error_description
|
22
|
+
|
23
|
+
# Gets or sets a URI identifying a human-readable web page with information
|
24
|
+
# about the error, used to provide the client developer with additional
|
25
|
+
# information about the error.
|
26
|
+
# @return [String]
|
27
|
+
attr_accessor :error_uri
|
28
|
+
|
29
|
+
# The constructor.
|
30
|
+
# @param [String] reason The reason for raising an exception.
|
31
|
+
# @param [HttpResponse] response The HttpReponse of the API call.
|
32
|
+
def initialize(reason, response)
|
33
|
+
super(reason, response)
|
34
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
35
|
+
unbox(hash)
|
36
|
+
end
|
37
|
+
|
38
|
+
# Populates this object by extracting properties from a hash.
|
39
|
+
# @param [Hash] hash The deserialized response sent by the server in the
|
40
|
+
# response body.
|
41
|
+
def unbox(hash)
|
42
|
+
return nil unless hash
|
43
|
+
|
44
|
+
@error = hash.key?('error') ? hash['error'] : nil
|
45
|
+
@error_description =
|
46
|
+
hash.key?('error_description') ? hash['error_description'] : SKIP
|
47
|
+
@error_uri = hash.key?('error_uri') ? hash['error_uri'] : SKIP
|
48
|
+
end
|
49
|
+
|
50
|
+
# Provides a human-readable string representation of the object.
|
51
|
+
def to_s
|
52
|
+
class_name = self.class.name.split('::').last
|
53
|
+
"<#{class_name} error: #{@error}, error_description: #{@error_description}, error_uri:"\
|
54
|
+
" #{@error_uri}>"
|
55
|
+
end
|
56
|
+
|
57
|
+
# Provides a debugging-friendly string with detailed object information.
|
58
|
+
def inspect
|
59
|
+
class_name = self.class.name.split('::').last
|
60
|
+
"<#{class_name} error: #{@error.inspect}, error_description: #{@error_description.inspect},"\
|
61
|
+
" error_uri: #{@error_uri.inspect}>"
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
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,133 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
7
|
+
# Utility class for OAuth 2 authorization and token management.
|
8
|
+
class ThingspaceOauth < 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
|
+
'ThingspaceOauth: OAuthToken is undefined or expired.'
|
14
|
+
end
|
15
|
+
|
16
|
+
# Initialization constructor.
|
17
|
+
def initialize(thingspace_oauth_credentials, config)
|
18
|
+
@_oauth_client_id = thingspace_oauth_credentials.oauth_client_id unless
|
19
|
+
thingspace_oauth_credentials.nil? || thingspace_oauth_credentials.oauth_client_id.nil?
|
20
|
+
@_oauth_client_secret = thingspace_oauth_credentials.oauth_client_secret unless
|
21
|
+
thingspace_oauth_credentials.nil? || thingspace_oauth_credentials.oauth_client_secret.nil?
|
22
|
+
@_oauth_token = thingspace_oauth_credentials.oauth_token unless
|
23
|
+
thingspace_oauth_credentials.nil? || thingspace_oauth_credentials.oauth_token.nil?
|
24
|
+
@_oauth_clock_skew = thingspace_oauth_credentials.oauth_clock_skew unless
|
25
|
+
thingspace_oauth_credentials.nil? || thingspace_oauth_credentials.oauth_clock_skew.nil?
|
26
|
+
@_oauth_token_provider = thingspace_oauth_credentials.oauth_token_provider unless
|
27
|
+
thingspace_oauth_credentials.nil? || thingspace_oauth_credentials.oauth_token_provider.nil?
|
28
|
+
@_oauth_on_token_update = thingspace_oauth_credentials.oauth_on_token_update unless
|
29
|
+
thingspace_oauth_credentials.nil? || thingspace_oauth_credentials.oauth_on_token_update.nil?
|
30
|
+
@_o_auth_api = OauthAuthorizationApi.new(config)
|
31
|
+
super({})
|
32
|
+
end
|
33
|
+
|
34
|
+
# Validates the oAuth token.
|
35
|
+
# @return [Boolean] true if the token is present and not expired.
|
36
|
+
def valid
|
37
|
+
@_oauth_token = get_token_from_provider
|
38
|
+
@_oauth_token.is_a?(OAuthToken) && !token_expired?(@_oauth_token)
|
39
|
+
end
|
40
|
+
|
41
|
+
# Builds the basic auth header for endpoints in the OAuth Authorization Controller.
|
42
|
+
# @return [String] The value of the Authentication header.
|
43
|
+
def build_basic_auth_header
|
44
|
+
"Basic #{AuthHelper.get_base64_encoded_value(@_oauth_client_id, @_oauth_client_secret)}"
|
45
|
+
end
|
46
|
+
|
47
|
+
# Fetches the token.
|
48
|
+
# @param [Hash] additional_params Any additional form parameters.
|
49
|
+
# @return [OAuthToken] The oAuth token instance.
|
50
|
+
def fetch_token(additional_params: nil)
|
51
|
+
token = @_o_auth_api.request_token_thingspace_oauth(
|
52
|
+
build_basic_auth_header,
|
53
|
+
_field_parameters: additional_params
|
54
|
+
).data
|
55
|
+
if token.respond_to?('expires_in') && !token.expires_in.nil?
|
56
|
+
token.expiry = AuthHelper.get_token_expiry(token.expires_in, Time.now.utc.to_i)
|
57
|
+
end
|
58
|
+
token
|
59
|
+
end
|
60
|
+
|
61
|
+
# Checks if OAuth token has expired.
|
62
|
+
# @param [OAuthToken] token The oAuth token instance.
|
63
|
+
# @return [Boolean] true if the token's expiry exist and also the token is expired, false otherwise.
|
64
|
+
def token_expired?(token)
|
65
|
+
token.respond_to?('expiry') && AuthHelper.token_expired?(token.expiry, @_oauth_clock_skew)
|
66
|
+
end
|
67
|
+
|
68
|
+
def apply(http_request)
|
69
|
+
auth_params = { 'Authorization' => "Bearer #{@_oauth_token.access_token}" }
|
70
|
+
AuthHelper.apply(auth_params, http_request.method(:add_header))
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
# This provides the OAuth Token from either the user configured callbacks or from default provider.
|
76
|
+
# @return [OAuthToken] The fetched oauth token.
|
77
|
+
def get_token_from_provider
|
78
|
+
return @_oauth_token if @_oauth_token && !token_expired?(@_oauth_token)
|
79
|
+
|
80
|
+
if @_o_auth_token_provider
|
81
|
+
o_auth_token = @_o_auth_token_provider.call(@_oauth_token, self)
|
82
|
+
@_o_auth_on_token_update&.call(o_auth_token)
|
83
|
+
return o_auth_token
|
84
|
+
end
|
85
|
+
begin
|
86
|
+
o_auth_token = fetch_token
|
87
|
+
@_o_auth_on_token_update&.call(o_auth_token)
|
88
|
+
o_auth_token
|
89
|
+
rescue ApiException
|
90
|
+
@_o_auth_token
|
91
|
+
end
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
# Data class for ThingspaceOauthCredentials.
|
96
|
+
class ThingspaceOauthCredentials
|
97
|
+
attr_reader :oauth_client_id, :oauth_client_secret, :oauth_token,
|
98
|
+
:oauth_token_provider, :oauth_on_token_update, :oauth_clock_skew
|
99
|
+
|
100
|
+
def initialize(oauth_client_id:, oauth_client_secret:, oauth_token: nil,
|
101
|
+
oauth_token_provider: nil, oauth_on_token_update: nil,
|
102
|
+
oauth_clock_skew: 0)
|
103
|
+
raise ArgumentError, 'oauth_client_id cannot be nil' if oauth_client_id.nil?
|
104
|
+
raise ArgumentError, 'oauth_client_secret cannot be nil' if oauth_client_secret.nil?
|
105
|
+
|
106
|
+
@oauth_client_id = oauth_client_id
|
107
|
+
@oauth_client_secret = oauth_client_secret
|
108
|
+
@oauth_token = oauth_token
|
109
|
+
@oauth_token_provider = oauth_token_provider
|
110
|
+
@oauth_on_token_update = oauth_on_token_update
|
111
|
+
@oauth_clock_skew = oauth_clock_skew
|
112
|
+
end
|
113
|
+
|
114
|
+
def clone_with(oauth_client_id: nil, oauth_client_secret: nil,
|
115
|
+
oauth_token: nil, oauth_token_provider: nil,
|
116
|
+
oauth_on_token_update: nil, oauth_clock_skew: nil)
|
117
|
+
oauth_client_id ||= self.oauth_client_id
|
118
|
+
oauth_client_secret ||= self.oauth_client_secret
|
119
|
+
oauth_token ||= self.oauth_token
|
120
|
+
oauth_token_provider ||= self.oauth_token_provider
|
121
|
+
oauth_on_token_update ||= self.oauth_on_token_update
|
122
|
+
oauth_clock_skew ||= self.oauth_clock_skew
|
123
|
+
|
124
|
+
ThingspaceOauthCredentials.new(
|
125
|
+
oauth_client_id: oauth_client_id,
|
126
|
+
oauth_client_secret: oauth_client_secret, oauth_token: oauth_token,
|
127
|
+
oauth_token_provider: oauth_token_provider,
|
128
|
+
oauth_on_token_update: oauth_on_token_update,
|
129
|
+
oauth_clock_skew: oauth_clock_skew
|
130
|
+
)
|
131
|
+
end
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
7
|
+
# Utility class for custom header authorization.
|
8
|
+
class VzM2MSessionToken < CoreLibrary::HeaderAuth
|
9
|
+
# Display error message on occurrence of authentication failure.
|
10
|
+
# @returns [String] The oAuth error message.
|
11
|
+
def error_message
|
12
|
+
'VzM2MSessionToken: vz_m2_m_token is undefined.'
|
13
|
+
end
|
14
|
+
|
15
|
+
# Initialization constructor.
|
16
|
+
def initialize(vz_m2_m_session_token_credentials)
|
17
|
+
auth_params = {}
|
18
|
+
auth_params['VZ-M2M-Token'] = vz_m2_m_session_token_credentials.vz_m2_m_token unless
|
19
|
+
vz_m2_m_session_token_credentials.nil? || vz_m2_m_session_token_credentials.vz_m2_m_token.nil?
|
20
|
+
|
21
|
+
super auth_params
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# Data class for VzM2MSessionTokenCredentials.
|
26
|
+
# Data class for VzM2MSessionTokenCredentials.
|
27
|
+
class VzM2MSessionTokenCredentials
|
28
|
+
attr_reader :vz_m2_m_token
|
29
|
+
|
30
|
+
def initialize(vz_m2_m_token:)
|
31
|
+
raise ArgumentError, 'vz_m2_m_token cannot be nil' if vz_m2_m_token.nil?
|
32
|
+
|
33
|
+
@vz_m2_m_token = vz_m2_m_token
|
34
|
+
end
|
35
|
+
|
36
|
+
def clone_with(vz_m2_m_token: nil)
|
37
|
+
vz_m2_m_token ||= self.vz_m2_m_token
|
38
|
+
|
39
|
+
VzM2MSessionTokenCredentials.new(vz_m2_m_token: vz_m2_m_token)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
7
|
+
# HttpCallBack allows defining callables for pre and post API calls.
|
8
|
+
class HttpCallBack < CoreLibrary::HttpCallback
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
7
|
+
# HTTP Methods Enumeration.
|
8
|
+
class HttpMethodEnum < CoreLibrary::HttpMethod
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
7
|
+
# Represents a single Http Request.
|
8
|
+
class HttpRequest < CoreLibrary::HttpRequest
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
7
|
+
# Http response received.
|
8
|
+
class HttpResponse < CoreLibrary::HttpResponse
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
7
|
+
##
|
8
|
+
# ProxySettings encapsulates HTTP proxy configuration for Faraday,
|
9
|
+
# including optional basic authentication.
|
10
|
+
#
|
11
|
+
class ProxySettings < CoreLibrary::ProxySettings
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
7
|
+
# Initializes a new instance of RequestLoggingConfiguration.
|
8
|
+
class RequestLoggingConfiguration < CoreLibrary::ApiRequestLoggingConfiguration
|
9
|
+
# @param log_body [Boolean] Indicates whether the message body should be logged. Default is false.
|
10
|
+
# @param log_headers [Boolean] Indicates whether the message headers should be logged. Default is false.
|
11
|
+
# @param headers_to_exclude [Array<String>] Array of headers not displayed in logging. Default is an empty array.
|
12
|
+
# @param headers_to_include [Array<String>] Array of headers to be displayed in logging. Default is an empty array.
|
13
|
+
# @param headers_to_unmask [Array<String>] Array of headers which values are non-sensitive to display in logging.
|
14
|
+
# Default is an empty array.
|
15
|
+
def initialize(log_body: false, log_headers: false, headers_to_include: nil,
|
16
|
+
headers_to_exclude: nil, headers_to_unmask: nil,
|
17
|
+
include_query_in_path: false)
|
18
|
+
super(
|
19
|
+
log_body,
|
20
|
+
log_headers,
|
21
|
+
headers_to_exclude,
|
22
|
+
headers_to_include,
|
23
|
+
headers_to_unmask,
|
24
|
+
include_query_in_path
|
25
|
+
)
|
26
|
+
end
|
27
|
+
|
28
|
+
def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
|
29
|
+
headers_to_exclude: nil, headers_to_unmask: nil, include_query_in_path: nil)
|
30
|
+
log_body ||= self.log_body
|
31
|
+
log_headers ||= self.log_headers
|
32
|
+
headers_to_include ||= self.headers_to_include
|
33
|
+
headers_to_exclude ||= self.headers_to_exclude
|
34
|
+
headers_to_unmask ||= self.headers_to_unmask
|
35
|
+
include_query_in_path ||= self.include_query_in_path
|
36
|
+
|
37
|
+
RequestLoggingConfiguration.class.new(log_body: log_body, log_headers: log_headers,
|
38
|
+
headers_to_include: headers_to_include,
|
39
|
+
headers_to_exclude: headers_to_exclude,
|
40
|
+
headers_to_unmask: headers_to_unmask,
|
41
|
+
include_query_in_path: include_query_in_path)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
# Initializes a new instance of ResponseLoggingConfiguration.
|
46
|
+
class ResponseLoggingConfiguration < CoreLibrary::ApiResponseLoggingConfiguration
|
47
|
+
# @param log_body [Boolean] Indicates whether the message body should be logged. Default is false.
|
48
|
+
# @param log_headers [Boolean] Indicates whether the message headers should be logged. Default is false.
|
49
|
+
# @param headers_to_exclude [Array<String>] Array of headers not displayed in logging. Default is an empty array.
|
50
|
+
# @param headers_to_include [Array<String>] Array of headers to be displayed in logging. Default is an empty array.
|
51
|
+
# @param headers_to_unmask [Array<String>] Array of headers which values are non-sensitive to display in logging.
|
52
|
+
# Default is an empty array.
|
53
|
+
def initialize(log_body: false, log_headers: false, headers_to_include: nil,
|
54
|
+
headers_to_exclude: nil, headers_to_unmask: nil)
|
55
|
+
super(
|
56
|
+
log_body,
|
57
|
+
log_headers,
|
58
|
+
headers_to_exclude,
|
59
|
+
headers_to_include,
|
60
|
+
headers_to_unmask
|
61
|
+
)
|
62
|
+
end
|
63
|
+
|
64
|
+
def clone_with(log_body: nil, log_headers: nil, headers_to_include: nil,
|
65
|
+
headers_to_exclude: nil, headers_to_unmask: nil)
|
66
|
+
log_body ||= self.log_body
|
67
|
+
log_headers ||= self.log_headers
|
68
|
+
headers_to_include ||= self.headers_to_include
|
69
|
+
headers_to_exclude ||= self.headers_to_exclude
|
70
|
+
headers_to_unmask ||= self.headers_to_unmask
|
71
|
+
|
72
|
+
ResponseLoggingConfiguration.new(log_body: log_body, log_headers: log_headers,
|
73
|
+
headers_to_include: headers_to_include,
|
74
|
+
headers_to_exclude: headers_to_exclude,
|
75
|
+
headers_to_unmask: headers_to_unmask)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Initializes a new instance of LoggingConfiguration.
|
80
|
+
class LoggingConfiguration < CoreLibrary::ApiLoggingConfiguration
|
81
|
+
# @param logger [LoggerInterface] The logger to use for logging messages.
|
82
|
+
# @param log_level [LogLevel] The log level to determine which messages should be logged.
|
83
|
+
# @param request_logging_config [RequestLoggingConfiguration] Options for logging HTTP requests.
|
84
|
+
# @param response_logging_config [ResponseLoggingConfiguration] Options for logging HTTP responses.
|
85
|
+
# @param mask_sensitive_headers [Boolean] Indicates whether sensitive headers should be masked in logged messages.
|
86
|
+
def initialize(logger: nil, log_level: nil, mask_sensitive_headers: true,
|
87
|
+
request_logging_config: nil,
|
88
|
+
response_logging_config: nil)
|
89
|
+
request_logging_config ||= RequestLoggingConfiguration.new
|
90
|
+
response_logging_config ||= ResponseLoggingConfiguration.new
|
91
|
+
super(
|
92
|
+
logger,
|
93
|
+
log_level,
|
94
|
+
request_logging_config,
|
95
|
+
response_logging_config,
|
96
|
+
mask_sensitive_headers
|
97
|
+
)
|
98
|
+
end
|
99
|
+
|
100
|
+
def clone_with(logger: nil, log_level: nil, mask_sensitive_headers: nil,
|
101
|
+
request_logging_config: nil, response_logging_config: nil)
|
102
|
+
logger ||= self.logger
|
103
|
+
log_level ||= self.log_level
|
104
|
+
mask_sensitive_headers = self.mask_sensitive_headers ||= mask_sensitive_headers
|
105
|
+
request_logging_config ||= self.request_logging_config.clone
|
106
|
+
response_logging_config ||= self.response_logging_config.clone
|
107
|
+
|
108
|
+
LoggingConfiguration.new(logger: logger, log_level: log_level,
|
109
|
+
mask_sensitive_headers: mask_sensitive_headers,
|
110
|
+
request_logging_config: request_logging_config,
|
111
|
+
response_logging_config: response_logging_config)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
7
|
+
# Represents the generic logger facade
|
8
|
+
class AbstractLogger < Logger
|
9
|
+
# Logs a message with a specified log level and additional parameters.
|
10
|
+
# @param level [Symbol] The log level of the message.
|
11
|
+
# @param message [String] The message to log.
|
12
|
+
# @param params [Hash] Additional parameters to include in the log message.
|
13
|
+
def log(level, message, params)
|
14
|
+
raise NotImplementedError, 'This method needs to be implemented in a child class.'
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
7
|
+
# Base model.
|
8
|
+
# rubocop:disable all
|
9
|
+
class BaseModel < CoreLibrary::BaseModel
|
10
|
+
# Returns a Hash representation of the current object.
|
11
|
+
def to_hash
|
12
|
+
# validating the model being serialized
|
13
|
+
self.class.validate(self) if self.class.respond_to?(:validate)
|
14
|
+
|
15
|
+
hash = {}
|
16
|
+
instance_variables.each do |name|
|
17
|
+
value = instance_variable_get(name)
|
18
|
+
name = name[1..]
|
19
|
+
if name == 'additional_properties'
|
20
|
+
additional_properties = process_additional_properties(value, self.class.names)
|
21
|
+
hash.merge!(additional_properties)
|
22
|
+
else
|
23
|
+
key = self.class.names.key?(name) ? self.class.names[name] : name
|
24
|
+
optional_fields = self.class.optionals
|
25
|
+
nullable_fields = self.class.nullables
|
26
|
+
if value.nil?
|
27
|
+
next unless nullable_fields.include?(name)
|
28
|
+
|
29
|
+
if !optional_fields.include?(name) && !nullable_fields.include?(name)
|
30
|
+
raise ArgumentError,
|
31
|
+
"`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
hash[key] = nil
|
36
|
+
unless value.nil?
|
37
|
+
if respond_to?("to_custom_#{name}")
|
38
|
+
if (value.instance_of? Array) || (value.instance_of? Hash)
|
39
|
+
params = [hash, key]
|
40
|
+
hash[key] = send("to_custom_#{name}", *params)
|
41
|
+
else
|
42
|
+
hash[key] = send("to_custom_#{name}")
|
43
|
+
end
|
44
|
+
elsif respond_to?("to_union_type_#{name}")
|
45
|
+
hash[key] = send("to_union_type_#{name}")
|
46
|
+
elsif value.instance_of? Array
|
47
|
+
hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
48
|
+
elsif value.instance_of? Hash
|
49
|
+
hash[key] = {}
|
50
|
+
value.each do |k, v|
|
51
|
+
hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
|
52
|
+
end
|
53
|
+
else
|
54
|
+
hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
hash
|
60
|
+
end
|
61
|
+
|
62
|
+
# Processes additional properties, ensuring no conflicts with existing properties.
|
63
|
+
def process_additional_properties(additional_properties, existing_prop_names)
|
64
|
+
hash = {}
|
65
|
+
additional_properties.each do |name, value|
|
66
|
+
check_for_conflict(name, existing_prop_names)
|
67
|
+
|
68
|
+
hash[name] = if value.is_a?(Array)
|
69
|
+
process_array(value)
|
70
|
+
elsif value.is_a?(Hash)
|
71
|
+
process_hash(value)
|
72
|
+
else
|
73
|
+
process_basic_value(value)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
hash
|
77
|
+
end
|
78
|
+
|
79
|
+
# Checks if an additional property conflicts with a model's existing property.
|
80
|
+
def check_for_conflict(name, existing_prop_names)
|
81
|
+
return unless existing_prop_names.key?(name)
|
82
|
+
|
83
|
+
raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
|
84
|
+
end
|
85
|
+
|
86
|
+
# Processes an array of values, recursively calling `to_hash` on BaseModel objects.
|
87
|
+
def process_array(value)
|
88
|
+
value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
|
89
|
+
end
|
90
|
+
|
91
|
+
# Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
|
92
|
+
def process_hash(value)
|
93
|
+
value.transform_values do |v|
|
94
|
+
v.is_a?(BaseModel) ? v.to_hash : v
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
# Processes a basic value (non-array, non-hash).
|
99
|
+
def process_basic_value(value)
|
100
|
+
value.is_a?(BaseModel) ? value.to_hash : value
|
101
|
+
end
|
102
|
+
|
103
|
+
# Returns a JSON representation of the curent object.
|
104
|
+
def to_json(options = {})
|
105
|
+
hash = to_hash
|
106
|
+
hash.to_json(options)
|
107
|
+
end
|
108
|
+
end
|
109
|
+
# rubocop:enable all
|
110
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# api_endpoints_for5_g_business_internet5_g_bi
|
2
|
+
#
|
3
|
+
# This file was automatically
|
4
|
+
# generated by APIMATIC v3.0 ( https://www.apimatic.io ).
|
5
|
+
|
6
|
+
module ApiEndpointsFor5GBusinessInternet5GBi
|
7
|
+
# GroupName Model.
|
8
|
+
class GroupName < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
12
|
+
# TODO: Write general description for this method
|
13
|
+
# @return [String]
|
14
|
+
attr_accessor :default
|
15
|
+
|
16
|
+
# A mapping from model property names to API property names.
|
17
|
+
def self.names
|
18
|
+
@_hash = {} if @_hash.nil?
|
19
|
+
@_hash['default'] = 'Default'
|
20
|
+
@_hash
|
21
|
+
end
|
22
|
+
|
23
|
+
# An array for optional fields
|
24
|
+
def self.optionals
|
25
|
+
%w[
|
26
|
+
default
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
# An array for nullable fields
|
31
|
+
def self.nullables
|
32
|
+
[]
|
33
|
+
end
|
34
|
+
|
35
|
+
def initialize(default: SKIP, additional_properties: nil)
|
36
|
+
# Add additional model properties to the instance
|
37
|
+
additional_properties = {} if additional_properties.nil?
|
38
|
+
|
39
|
+
@default = default unless default == SKIP
|
40
|
+
@additional_properties = additional_properties
|
41
|
+
end
|
42
|
+
|
43
|
+
# Creates an instance of the object from a hash.
|
44
|
+
def self.from_hash(hash)
|
45
|
+
return nil unless hash
|
46
|
+
|
47
|
+
# Extract variables from the hash.
|
48
|
+
default = hash.key?('Default') ? hash['Default'] : SKIP
|
49
|
+
|
50
|
+
# Create a new hash for additional properties, removing known properties.
|
51
|
+
new_hash = hash.reject { |k, _| names.value?(k) }
|
52
|
+
|
53
|
+
additional_properties = APIHelper.get_additional_properties(
|
54
|
+
new_hash, proc { |value| value }
|
55
|
+
)
|
56
|
+
|
57
|
+
# Create object from extracted values.
|
58
|
+
GroupName.new(default: default,
|
59
|
+
additional_properties: additional_properties)
|
60
|
+
end
|
61
|
+
|
62
|
+
# Validates an instance of the object from a given value.
|
63
|
+
# @param [GroupName | Hash] The value against the validation is performed.
|
64
|
+
def self.validate(value)
|
65
|
+
return true if value.instance_of? self
|
66
|
+
|
67
|
+
return false unless value.instance_of? Hash
|
68
|
+
|
69
|
+
true
|
70
|
+
end
|
71
|
+
|
72
|
+
# Provides a human-readable string representation of the object.
|
73
|
+
def to_s
|
74
|
+
class_name = self.class.name.split('::').last
|
75
|
+
"<#{class_name} default: #{@default}, additional_properties: #{@additional_properties}>"
|
76
|
+
end
|
77
|
+
|
78
|
+
# Provides a debugging-friendly string with detailed object information.
|
79
|
+
def inspect
|
80
|
+
class_name = self.class.name.split('::').last
|
81
|
+
"<#{class_name} default: #{@default.inspect}, additional_properties:"\
|
82
|
+
" #{@additional_properties}>"
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|