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.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +116 -0
  4. data/lib/api_endpoints_for5_g_business_internet5_g_bi/api_helper.rb +10 -0
  5. data/lib/api_endpoints_for5_g_business_internet5_g_bi/apis/base_api.rb +67 -0
  6. data/lib/api_endpoints_for5_g_business_internet5_g_bi/apis/m5_gbi_device_actions_api.rb +91 -0
  7. data/lib/api_endpoints_for5_g_business_internet5_g_bi/apis/oauth_authorization_api.rb +44 -0
  8. data/lib/api_endpoints_for5_g_business_internet5_g_bi/client.rb +80 -0
  9. data/lib/api_endpoints_for5_g_business_internet5_g_bi/configuration.rb +116 -0
  10. data/lib/api_endpoints_for5_g_business_internet5_g_bi/exceptions/api_exception.rb +21 -0
  11. data/lib/api_endpoints_for5_g_business_internet5_g_bi/exceptions/m5_gbi_rest_error_response_exception.rb +52 -0
  12. data/lib/api_endpoints_for5_g_business_internet5_g_bi/exceptions/oauth_provider_exception.rb +64 -0
  13. data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/api_response.rb +19 -0
  14. data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/auth/thingspace_oauth.rb +133 -0
  15. data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/auth/vz_m2_m_session_token.rb +42 -0
  16. data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/http_call_back.rb +10 -0
  17. data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/http_method_enum.rb +10 -0
  18. data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/http_request.rb +10 -0
  19. data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/http_response.rb +10 -0
  20. data/lib/api_endpoints_for5_g_business_internet5_g_bi/http/proxy_settings.rb +13 -0
  21. data/lib/api_endpoints_for5_g_business_internet5_g_bi/logging/configuration/api_logging_configuration.rb +114 -0
  22. data/lib/api_endpoints_for5_g_business_internet5_g_bi/logging/sdk_logger.rb +17 -0
  23. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/base_model.rb +110 -0
  24. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/group_name.rb +85 -0
  25. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbi_address.rb +154 -0
  26. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbi_carrier_information.rb +86 -0
  27. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbi_customer_name.rb +125 -0
  28. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbi_request_response.rb +76 -0
  29. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiaccount_nameobject.rb +228 -0
  30. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiactivate_request.rb +146 -0
  31. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiaddress_andcustomerinfo.rb +87 -0
  32. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiaddress_andcustomerinfo2.rb +87 -0
  33. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiattribute1.rb +84 -0
  34. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiattribute2.rb +95 -0
  35. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbichange_request.rb +126 -0
  36. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbidevice_detailsresponse.rb +95 -0
  37. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbidevice_id.rb +76 -0
  38. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbidevice_id1.rb +95 -0
  39. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbidevice_idarray.rb +88 -0
  40. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbidevice_idarray2.rb +95 -0
  41. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbikey_value1.rb +95 -0
  42. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/m5_gbiprimary_placeofuse.rb +96 -0
  43. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/oauth_provider_error.rb +45 -0
  44. data/lib/api_endpoints_for5_g_business_internet5_g_bi/models/oauth_token.rb +96 -0
  45. data/lib/api_endpoints_for5_g_business_internet5_g_bi/utilities/date_time_helper.rb +11 -0
  46. data/lib/api_endpoints_for5_g_business_internet5_g_bi/utilities/file_wrapper.rb +28 -0
  47. data/lib/api_endpoints_for5_g_business_internet5_g_bi/utilities/union_type_lookup.rb +85 -0
  48. data/lib/api_endpoints_for5_g_business_internet5_g_bi.rb +110 -0
  49. metadata +132 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 190fa10ad768635eb99c4d5b8679b48146535f67d2cf7d8698ea20cd50855e47
4
+ data.tar.gz: cd0c82e80b820d1333981a5a1aff22611284e1f58361c81159809cb184a385e3
5
+ SHA512:
6
+ metadata.gz: e339087d7f39257cf957994b78e7c2b14b0ed9fd0facfae291954ea0fcf08809cb396c5177a8302117f76ad306f57944e7709bb9f12370ce2c584d8adef66a6b
7
+ data.tar.gz: c1cc5f416074b57cbf390e72931fad89eef2b39c86aef1b9083a42a2d525ef5399938accda45c007f9dcdf992d7b3b45ab30b1d60815f83f7b6462c0e0f1a519
data/LICENSE ADDED
@@ -0,0 +1,28 @@
1
+ License:
2
+ ========
3
+ The MIT License (MIT)
4
+ http://opensource.org/licenses/MIT
5
+
6
+ Copyright (c) 2014 - 2025 APIMATIC Limited
7
+
8
+ Permission is hereby granted, free of charge, to any person obtaining a copy
9
+ of this software and associated documentation files (the "Software"), to deal
10
+ in the Software without restriction, including without limitation the rights
11
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12
+ copies of the Software, and to permit persons to whom the Software is
13
+ furnished to do so, subject to the following conditions:
14
+
15
+ The above copyright notice and this permission notice shall be included in
16
+ all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24
+ THE SOFTWARE.
25
+
26
+ Trade Mark:
27
+ ==========
28
+ APIMATIC is a trade mark for APIMATIC Limited
data/README.md ADDED
@@ -0,0 +1,116 @@
1
+
2
+ # Getting Started with API Endpoints for 5G Business Internet (5G BI)
3
+
4
+ ## Introduction
5
+
6
+ These API endpoints are for Verizon 5G Business Internet.
7
+
8
+ ## Install the Package
9
+
10
+ Install the gem from the command line:
11
+
12
+ ```bash
13
+ gem install test-sdk-raza -v 1.0.1
14
+ ```
15
+
16
+ Or add the gem to your Gemfile and run `bundle`:
17
+
18
+ ```ruby
19
+ gem 'test-sdk-raza', '1.0.1'
20
+ ```
21
+
22
+ For additional gem details, see the [RubyGems page for the test-sdk-raza gem](https://rubygems.org/gems/test-sdk-raza/versions/1.0.1).
23
+
24
+ ## Initialize the API Client
25
+
26
+ **_Note:_** Documentation for the client can be found [here.](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/client.md)
27
+
28
+ The following parameters are configurable for the API Client:
29
+
30
+ | Parameter | Type | Description |
31
+ | --- | --- | --- |
32
+ | environment | `Environment` | The API environment. <br> **Default: `Environment.PRODUCTION`** |
33
+ | connection | `Faraday::Connection` | The Faraday connection object passed by the SDK user for making requests |
34
+ | adapter | `Faraday::Adapter` | The Faraday adapter object passed by the SDK user for performing http requests |
35
+ | timeout | `Float` | The value to use for connection timeout. <br> **Default: 30** |
36
+ | max_retries | `Integer` | The number of times to retry an endpoint call if it fails. <br> **Default: 0** |
37
+ | retry_interval | `Float` | Pause in seconds between retries. <br> **Default: 1** |
38
+ | backoff_factor | `Float` | The amount to multiply each successive retry's interval amount by in order to provide backoff. <br> **Default: 2** |
39
+ | retry_statuses | `Array` | A list of HTTP statuses to retry. <br> **Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]** |
40
+ | retry_methods | `Array` | A list of HTTP methods to retry. <br> **Default: %i[get put]** |
41
+ | http_callback | `HttpCallBack` | The Http CallBack allows defining callables for pre and post API calls. |
42
+ | proxy_settings | [`ProxySettings`](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/proxy-settings.md) | Optional proxy configuration to route HTTP requests through a proxy server. |
43
+ | logging_configuration | [`LoggingConfiguration`](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/logging-configuration.md) | The SDK logging configuration for API calls |
44
+ | thingspace_oauth_credentials | [`ThingspaceOauthCredentials`](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/auth/oauth-2-client-credentials-grant.md) | The credential object for OAuth 2 Client Credentials Grant |
45
+ | vz_m_2_m_session_token_credentials | [`VzM2MSessionTokenCredentials`](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/auth/custom-header-signature.md) | The credential object for Custom Header Signature |
46
+
47
+ The API client can be initialized as follows:
48
+
49
+ ```ruby
50
+ require 'api_endpoints_for5_g_business_internet5_g_bi'
51
+ include ApiEndpointsFor5GBusinessInternet5GBi
52
+
53
+ client = Client.new(
54
+ thingspace_oauth_credentials: ThingspaceOauthCredentials.new(
55
+ oauth_client_id: 'OAuthClientId',
56
+ oauth_client_secret: 'OAuthClientSecret'
57
+ ),
58
+ vz_m2_m_session_token_credentials: VzM2MSessionTokenCredentials.new(
59
+ vz_m2_m_token: 'VZ-M2M-Token'
60
+ ),
61
+ environment: Environment::PRODUCTION,
62
+ logging_configuration: LoggingConfiguration.new(
63
+ log_level: Logger::INFO,
64
+ request_logging_config: RequestLoggingConfiguration.new(
65
+ log_body: true
66
+ ),
67
+ response_logging_config: ResponseLoggingConfiguration.new(
68
+ log_headers: true
69
+ )
70
+ )
71
+ )
72
+ ```
73
+
74
+ ## Environments
75
+
76
+ The SDK can be configured to use a different environment for making API calls. Available environments are:
77
+
78
+ ### Fields
79
+
80
+ | Name | Description |
81
+ | --- | --- |
82
+ | Production | **Default** |
83
+ | Staging | - |
84
+
85
+ ## Authorization
86
+
87
+ This API uses the following authentication schemes.
88
+
89
+ * [`thingspace_oauth (OAuth 2 Client Credentials Grant)`](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/auth/oauth-2-client-credentials-grant.md)
90
+ * [`vz-m2m-session_token (Custom Header Signature)`](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/auth/custom-header-signature.md)
91
+
92
+ ## List of APIs
93
+
94
+ * [5 GBI Device Actions](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/controllers/5-gbi-device-actions.md)
95
+
96
+ ## SDK Infrastructure
97
+
98
+ ### Configuration
99
+
100
+ * [ProxySettings](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/proxy-settings.md)
101
+ * [AbstractLogger](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/abstract-logger.md)
102
+ * [LoggingConfiguration](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/logging-configuration.md)
103
+ * [RequestLoggingConfiguration](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/request-logging-configuration.md)
104
+ * [ResponseLoggingConfiguration](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/response-logging-configuration.md)
105
+
106
+ ### HTTP
107
+
108
+ * [HttpResponse](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/http-response.md)
109
+ * [HttpRequest](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/http-request.md)
110
+
111
+ ### Utilities
112
+
113
+ * [ApiResponse](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/api-response.md)
114
+ * [ApiHelper](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/api-helper.md)
115
+ * [DateTimeHelper](https://www.github.com/razazarif/test-ruby-sdk/tree/1.0.1/doc/date-time-helper.md)
116
+
@@ -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
+ # API utility class
8
+ class APIHelper < CoreLibrary::ApiHelper
9
+ end
10
+ end
@@ -0,0 +1,67 @@
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
+ # BaseApi.
8
+ class BaseApi
9
+ include CoreLibrary
10
+ attr_accessor :config, :http_call_back
11
+
12
+ def self.user_agent
13
+ 'Ruby-SDK/1.0.1 [OS: {os-info}, Engine: {engine}/{engine-version}]'
14
+ end
15
+
16
+ def self.user_agent_parameters
17
+ {
18
+ '{engine}' => { 'value' => RUBY_ENGINE, 'encode' => false },
19
+ '{engine-version}' => { 'value' => RUBY_ENGINE_VERSION, 'encode' => false },
20
+ '{os-info}' => { 'value' => RUBY_PLATFORM, 'encode' => false }
21
+ }
22
+ end
23
+
24
+ GLOBAL_ERRORS = {
25
+ 'default' => ErrorCase.new
26
+ .error_message('HTTP response not OK.')
27
+ .exception_type(APIException)
28
+ }.freeze
29
+
30
+ # Initialization constructor.
31
+ # @param [GlobalConfiguration] global_configuration The instance of GlobalConfiguration.
32
+ def initialize(global_configuration)
33
+ @global_configuration = global_configuration
34
+ @config = @global_configuration.client_configuration
35
+ @http_call_back = @config.http_callback
36
+ @api_call = ApiCall.new(@global_configuration)
37
+ end
38
+
39
+ # Creates a new instance of the request builder.
40
+ # @param [String] http_method The HTTP method to use in the request.
41
+ # @param [String] path The endpoint path to use in the request.
42
+ # @param [String] server The server to extract the base uri for the request.
43
+ # @return [RequestBuilder] The instance of RequestBuilder.
44
+ def new_request_builder(http_method, path, server)
45
+ RequestBuilder.new
46
+ .http_method(http_method)
47
+ .path(path)
48
+ .server(server)
49
+ end
50
+
51
+ # Creates a new instance of the response handler.
52
+ # @return [ResponseHandler] The instance of ResponseHandler.
53
+ def new_response_handler
54
+ ResponseHandler.new
55
+ end
56
+
57
+ # Creates a new instance of the parameter.
58
+ # @param [String|optional] key The key of the parameter.
59
+ # @param [Object] value The value of the parameter.
60
+ # @return [Parameter] The instance of Parameter.
61
+ def new_parameter(value, key: nil)
62
+ Parameter.new
63
+ .key(key)
64
+ .value(value)
65
+ end
66
+ end
67
+ end
@@ -0,0 +1,91 @@
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
+ # M5GbiDeviceActionsApi
8
+ class M5GbiDeviceActionsApi < BaseApi
9
+ # Uses the decive's Integrated Circuit Card Identification Number (ICCID) to
10
+ # retrive and display the device's properties.
11
+ # @param [M5GbideviceId] body Required parameter: Device Profile Query
12
+ # @return [ApiResponse] Complete http response with raw body and status code.
13
+ def business_internetlist_device_information(body)
14
+ @api_call
15
+ .request(new_request_builder(HttpMethodEnum::POST,
16
+ '/actions/list',
17
+ Server::THINGSPACE)
18
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
19
+ .body_param(new_parameter(body)
20
+ .is_required(true))
21
+ .header_param(new_parameter('application/json', key: 'accept'))
22
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
23
+ .auth(Or.new('thingspace_oauth', 'vz-m2m-session_token')))
24
+ .response(new_response_handler
25
+ .deserializer(APIHelper.method(:custom_type_deserializer))
26
+ .deserialize_into(M5GbideviceDetailsresponse.method(:from_hash))
27
+ .is_api_response(true)
28
+ .local_error('default',
29
+ 'Error response',
30
+ M5GbiRestErrorResponseException))
31
+ .execute
32
+ end
33
+
34
+ # Uses the device's ICCID and IMEI to activate service.
35
+ # @param [M5GbiactivateRequest] body Required parameter: Activate 5G BI
36
+ # service. Defining <code>publicIpRestriction</code> as "Unrestricted" or
37
+ # "Restricted" is required for activating as Public Static. Leave
38
+ # <code>publicIpRestriction</code> undefined to activate as Public Dynamic.
39
+ # Removing <code>publicIpRestriction</code> from the request will activate
40
+ # as Mobile Private Network (MPN).
41
+ # @return [ApiResponse] Complete http response with raw body and status code.
42
+ def business_internetactivate_using_post(body)
43
+ @api_call
44
+ .request(new_request_builder(HttpMethodEnum::POST,
45
+ '/actions/activate',
46
+ Server::THINGSPACE)
47
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
48
+ .body_param(new_parameter(body)
49
+ .is_required(true))
50
+ .header_param(new_parameter('application/json', key: 'accept'))
51
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
52
+ .auth(Or.new('thingspace_oauth', 'vz-m2m-session_token')))
53
+ .response(new_response_handler
54
+ .deserializer(APIHelper.method(:custom_type_deserializer))
55
+ .deserialize_into(M5GbiRequestResponse.method(:from_hash))
56
+ .is_api_response(true)
57
+ .local_error('default',
58
+ 'Error response',
59
+ M5GbiRestErrorResponseException))
60
+ .execute
61
+ end
62
+
63
+ # Change a device's service plan to use 5G BI.
64
+ # @param [M5GbichangeRequest] body Required parameter: This endpoint is for
65
+ # use when changing a device's service plan to a 5G BI service plan. The
66
+ # service plan can change for an active device up to four times per month
67
+ # but will require address validation for each change. The service plan
68
+ # cannot be changed for a device while its service is suspended.
69
+ # @return [ApiResponse] Complete http response with raw body and status code.
70
+ def business_internet_serviceplanchange(body)
71
+ @api_call
72
+ .request(new_request_builder(HttpMethodEnum::PUT,
73
+ '/actions/plan',
74
+ Server::THINGSPACE)
75
+ .header_param(new_parameter('application/json', key: 'Content-Type'))
76
+ .body_param(new_parameter(body)
77
+ .is_required(true))
78
+ .header_param(new_parameter('application/json', key: 'accept'))
79
+ .body_serializer(proc do |param| param.to_json unless param.nil? end)
80
+ .auth(Or.new('thingspace_oauth', 'vz-m2m-session_token')))
81
+ .response(new_response_handler
82
+ .deserializer(APIHelper.method(:custom_type_deserializer))
83
+ .deserialize_into(M5GbiRequestResponse.method(:from_hash))
84
+ .is_api_response(true)
85
+ .local_error('default',
86
+ 'Error response',
87
+ M5GbiRestErrorResponseException))
88
+ .execute
89
+ end
90
+ end
91
+ end
@@ -0,0 +1,44 @@
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
+ # OauthAuthorizationApi
8
+ class OauthAuthorizationApi < BaseApi
9
+ # Create a new OAuth 2 token.
10
+ # @param [String] authorization Required parameter: Authorization header in
11
+ # Basic auth format
12
+ # @param [String] scope Optional parameter: Requested scopes as a
13
+ # space-delimited list.
14
+ # @param [Hash] _field_parameters Additional optional form parameters are
15
+ # supported by this endpoint.
16
+ # @return [ApiResponse] Complete http response with raw body and status code.
17
+ def request_token_thingspace_oauth(authorization,
18
+ scope: nil,
19
+ _field_parameters: nil)
20
+ @api_call
21
+ .request(new_request_builder(HttpMethodEnum::POST,
22
+ '/oauth2/token',
23
+ Server::OAUTH_SERVER)
24
+ .form_param(new_parameter('client_credentials', key: 'grant_type'))
25
+ .header_param(new_parameter(authorization, key: 'Authorization')
26
+ .is_required(true))
27
+ .form_param(new_parameter(scope, key: 'scope'))
28
+ .header_param(new_parameter('application/x-www-form-urlencoded', key: 'content-type'))
29
+ .header_param(new_parameter('application/json', key: 'accept'))
30
+ .additional_form_params(_field_parameters))
31
+ .response(new_response_handler
32
+ .deserializer(APIHelper.method(:custom_type_deserializer))
33
+ .deserialize_into(OauthToken.method(:from_hash))
34
+ .is_api_response(true)
35
+ .local_error('400',
36
+ 'OAuth 2 provider returned an error.',
37
+ OauthProviderException)
38
+ .local_error('401',
39
+ 'OAuth 2 provider says client authentication failed.',
40
+ OauthProviderException))
41
+ .execute
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,80 @@
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
+ # api_endpoints_for5_g_business_internet5_g_bi client class.
8
+ class Client
9
+ include CoreLibrary
10
+ attr_reader :config, :auth_managers
11
+
12
+ # Returns the configured authentication thingspace_oauth instance.
13
+ def thingspace_oauth
14
+ @auth_managers['thingspace_oauth']
15
+ end
16
+
17
+ # Access to m5_gbi_device_actions controller.
18
+ # @return [M5GbiDeviceActionsApi] Returns the controller instance.
19
+ def m5_gbi_device_actions
20
+ @m5_gbi_device_actions ||= M5GbiDeviceActionsApi.new @global_configuration
21
+ end
22
+
23
+ # Access to oauth_authorization controller.
24
+ # @return [OauthAuthorizationApi] Returns the controller instance.
25
+ def oauth_authorization
26
+ @oauth_authorization ||= OauthAuthorizationApi.new @global_configuration
27
+ end
28
+
29
+ def initialize(
30
+ connection: nil, adapter: :net_http_persistent, timeout: 30,
31
+ max_retries: 0, retry_interval: 1, backoff_factor: 2,
32
+ retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
33
+ retry_methods: %i[get put], http_callback: nil, proxy_settings: nil,
34
+ logging_configuration: nil, environment: Environment::PRODUCTION,
35
+ thingspace_oauth_credentials: nil, vz_m2_m_session_token_credentials: nil,
36
+ config: nil
37
+ )
38
+ @config = if config.nil?
39
+ Configuration.new(
40
+ connection: connection, adapter: adapter, timeout: timeout,
41
+ max_retries: max_retries, retry_interval: retry_interval,
42
+ backoff_factor: backoff_factor,
43
+ retry_statuses: retry_statuses,
44
+ retry_methods: retry_methods, http_callback: http_callback,
45
+ proxy_settings: proxy_settings,
46
+ logging_configuration: logging_configuration,
47
+ environment: environment,
48
+ thingspace_oauth_credentials: thingspace_oauth_credentials,
49
+ vz_m2_m_session_token_credentials: vz_m2_m_session_token_credentials
50
+ )
51
+ else
52
+ config
53
+ end
54
+ user_agent_params = BaseApi.user_agent_parameters
55
+
56
+ @global_configuration = GlobalConfiguration.new(client_configuration: @config)
57
+ .base_uri_executor(@config.method(:get_base_uri))
58
+ .global_errors(BaseApi::GLOBAL_ERRORS)
59
+ .user_agent(BaseApi.user_agent,
60
+ agent_parameters: user_agent_params)
61
+
62
+ initialize_auth_managers(@global_configuration)
63
+ @global_configuration = @global_configuration.auth_managers(@auth_managers)
64
+ end
65
+
66
+ # Initializes the auth managers hash used for authenticating API calls.
67
+ # @param [GlobalConfiguration] global_config The global configuration of the SDK)
68
+ def initialize_auth_managers(global_config)
69
+ @auth_managers = {}
70
+ http_client_config = global_config.client_configuration
71
+ %w[thingspace_oauth vz-m2m-session_token].each { |auth| @auth_managers[auth] = nil }
72
+ @auth_managers['thingspace_oauth'] = ThingspaceOauth.new(
73
+ http_client_config.thingspace_oauth_credentials, global_config
74
+ )
75
+ @auth_managers['vz-m2m-session_token'] = VzM2MSessionToken.new(
76
+ http_client_config.vz_m2_m_session_token_credentials
77
+ )
78
+ end
79
+ end
80
+ end
@@ -0,0 +1,116 @@
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
+ # An enum for SDK environments.
8
+ class Environment
9
+ ENVIRONMENT = [
10
+ PRODUCTION = 'Production'.freeze,
11
+ STAGING = 'Staging'.freeze
12
+ ].freeze
13
+ end
14
+
15
+ # An enum for API servers.
16
+ class Server
17
+ SERVER = [
18
+ OAUTH_SERVER = 'OAuth Server'.freeze,
19
+ THINGSPACE = 'Thingspace'.freeze
20
+ ].freeze
21
+ end
22
+
23
+ # All configuration including auth info and base URI for the API access
24
+ # are configured in this class.
25
+ class Configuration < CoreLibrary::HttpClientConfiguration
26
+ # The attribute readers for properties.
27
+ attr_reader :environment, :thingspace_oauth_credentials,
28
+ :vz_m2_m_session_token_credentials
29
+
30
+ class << self
31
+ attr_reader :environments
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
+ thingspace_oauth_credentials: nil, vz_m2_m_session_token_credentials: nil
41
+ )
42
+ super connection: connection, adapter: adapter, timeout: timeout,
43
+ max_retries: max_retries, retry_interval: retry_interval,
44
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
45
+ retry_methods: retry_methods, http_callback: http_callback,
46
+ proxy_settings: proxy_settings,
47
+ logging_configuration: logging_configuration
48
+
49
+ # Current API environment
50
+ @environment = String(environment)
51
+
52
+ # The object holding OAuth 2 Client Credentials Grant credentials
53
+ @thingspace_oauth_credentials = thingspace_oauth_credentials
54
+
55
+ # The object holding Custom Header Signature credentials
56
+ @vz_m2_m_session_token_credentials = vz_m2_m_session_token_credentials
57
+
58
+ # The Http Client to use for making requests.
59
+ set_http_client CoreLibrary::FaradayClient.new(self)
60
+ end
61
+
62
+ def clone_with(connection: nil, adapter: nil, timeout: nil,
63
+ max_retries: nil, retry_interval: nil, backoff_factor: nil,
64
+ retry_statuses: nil, retry_methods: nil, http_callback: nil,
65
+ proxy_settings: nil, logging_configuration: nil,
66
+ environment: nil, thingspace_oauth_credentials: nil,
67
+ vz_m2_m_session_token_credentials: nil)
68
+ connection ||= self.connection
69
+ adapter ||= self.adapter
70
+ timeout ||= self.timeout
71
+ max_retries ||= self.max_retries
72
+ retry_interval ||= self.retry_interval
73
+ backoff_factor ||= self.backoff_factor
74
+ retry_statuses ||= self.retry_statuses
75
+ retry_methods ||= self.retry_methods
76
+ http_callback ||= self.http_callback
77
+ proxy_settings ||= self.proxy_settings
78
+ logging_configuration ||= self.logging_configuration
79
+ environment ||= self.environment
80
+ thingspace_oauth_credentials ||= self.thingspace_oauth_credentials
81
+ vz_m2_m_session_token_credentials ||= self.vz_m2_m_session_token_credentials
82
+
83
+ Configuration.new(
84
+ connection: connection, adapter: adapter, timeout: timeout,
85
+ max_retries: max_retries, retry_interval: retry_interval,
86
+ backoff_factor: backoff_factor, retry_statuses: retry_statuses,
87
+ retry_methods: retry_methods, http_callback: http_callback,
88
+ proxy_settings: proxy_settings,
89
+ logging_configuration: logging_configuration, environment: environment,
90
+ thingspace_oauth_credentials: thingspace_oauth_credentials,
91
+ vz_m2_m_session_token_credentials: vz_m2_m_session_token_credentials
92
+ )
93
+ end
94
+
95
+
96
+ # All the environments the SDK can run in.
97
+ ENVIRONMENTS = {
98
+ Environment::PRODUCTION => {
99
+ Server::OAUTH_SERVER => 'https://thingspace.verizon.com/api/ts/v1',
100
+ Server::THINGSPACE => 'https://thingspace.verizon.com/api'
101
+ },
102
+ Environment::STAGING => {
103
+ Server::OAUTH_SERVER => 'https://staging.thingspace.verizon.com/api/ts/v1',
104
+ Server::THINGSPACE => 'https://staging.thingspace.verizon.com/api'
105
+ }
106
+ }.freeze
107
+
108
+ # Generates the appropriate base URI for the environment and the server.
109
+ # @param [Configuration::Server] server The server enum for which the base URI is
110
+ # required.
111
+ # @return [String] The base URI.
112
+ def get_base_uri(server = Server::THINGSPACE)
113
+ ENVIRONMENTS[environment][server].clone
114
+ end
115
+ end
116
+ end
@@ -0,0 +1,21 @@
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
+ # 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,52 @@
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
+ # 5gbiRestErrorResponse class.
8
+ class M5GbiRestErrorResponseException < APIException
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # TODO: Write general description for this method
13
+ # @return [String]
14
+ attr_accessor :error_code
15
+
16
+ # TODO: Write general description for this method
17
+ # @return [String]
18
+ attr_accessor :error_message
19
+
20
+ # The constructor.
21
+ # @param [String] reason The reason for raising an exception.
22
+ # @param [HttpResponse] response The HttpReponse of the API call.
23
+ def initialize(reason, response)
24
+ super(reason, response)
25
+ hash = APIHelper.json_deserialize(@response.raw_body)
26
+ unbox(hash)
27
+ end
28
+
29
+ # Populates this object by extracting properties from a hash.
30
+ # @param [Hash] hash The deserialized response sent by the server in the
31
+ # response body.
32
+ def unbox(hash)
33
+ return nil unless hash
34
+
35
+ @error_code = hash.key?('errorCode') ? hash['errorCode'] : SKIP
36
+ @error_message = hash.key?('errorMessage') ? hash['errorMessage'] : SKIP
37
+ end
38
+
39
+ # Provides a human-readable string representation of the object.
40
+ def to_s
41
+ class_name = self.class.name.split('::').last
42
+ "<#{class_name} error_code: #{@error_code}, error_message: #{@error_message}>"
43
+ end
44
+
45
+ # Provides a debugging-friendly string with detailed object information.
46
+ def inspect
47
+ class_name = self.class.name.split('::').last
48
+ "<#{class_name} error_code: #{@error_code.inspect}, error_message:"\
49
+ " #{@error_message.inspect}>"
50
+ end
51
+ end
52
+ end