bandwidth-sdk 6.2.0 → 9.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bandwidth/api_helper.rb +19 -29
- data/lib/bandwidth/client.rb +8 -8
- data/lib/bandwidth/configuration.rb +20 -32
- data/lib/bandwidth/http/auth/{two_factor_auth_basic_auth.rb → multi_factor_auth_basic_auth.rb} +3 -3
- data/lib/bandwidth/http/faraday_client.rb +1 -1
- data/lib/bandwidth/messaging_lib/messaging/client.rb +14 -5
- data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +78 -71
- data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/messaging_lib/messaging/exceptions/messaging_exception.rb +5 -2
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_callback_message.rb +31 -11
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message.rb +54 -25
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message_item.rb +102 -24
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb +23 -4
- data/lib/bandwidth/messaging_lib/messaging/models/deferred_result.rb +20 -4
- data/lib/bandwidth/messaging_lib/messaging/models/media.rb +27 -80
- data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +32 -14
- data/lib/bandwidth/messaging_lib/messaging/models/page_info.rb +28 -8
- data/lib/bandwidth/messaging_lib/messaging/models/tag.rb +20 -4
- data/lib/bandwidth/models/base_model.rb +30 -8
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/client.rb +15 -6
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/controllers/mfa_controller.rb +28 -23
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/exceptions/error_with_request_exception.rb +5 -2
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/exceptions/forbidden_request_exception.rb +4 -1
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/exceptions/unauthorized_request_exception.rb +4 -1
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_code_request_schema.rb +27 -12
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_messaging_response.rb +17 -2
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_verify_code_response.rb +17 -2
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_verify_request_schema.rb +29 -10
- data/lib/bandwidth/{two_factor_auth_lib/two_factor_auth → multi_factor_auth_lib/multi_factor_auth}/models/two_factor_voice_response.rb +17 -2
- data/lib/bandwidth/multi_factor_auth_lib/multi_factor_auth.rb +23 -0
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/api_controller.rb +212 -210
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb +4 -1
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_request.rb +17 -2
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_response.rb +20 -4
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb +28 -7
- data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb +43 -18
- data/lib/bandwidth/utilities/date_time_helper.rb +156 -0
- data/lib/bandwidth/utilities/file_wrapper.rb +1 -2
- data/lib/bandwidth/voice_lib/voice/client.rb +14 -5
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +418 -379
- data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/voice_lib/voice/exceptions/{api_error_response_exception.rb → api_error_exception.rb} +8 -5
- data/lib/bandwidth/voice_lib/voice/models/call_callback.rb +343 -0
- data/lib/bandwidth/voice_lib/voice/models/call_recording_metadata.rb +250 -0
- data/lib/bandwidth/voice_lib/voice/models/call_state.rb +284 -0
- data/lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb +2 -20
- data/lib/bandwidth/voice_lib/voice/models/conference_callback.rb +211 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +2 -20
- data/lib/bandwidth/voice_lib/voice/models/{conference_member_detail.rb → conference_member_state.rb} +43 -20
- data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata.rb +173 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_state.rb +153 -0
- data/lib/bandwidth/voice_lib/voice/models/create_call_request.rb +301 -0
- data/lib/bandwidth/voice_lib/voice/models/create_call_response.rb +256 -0
- data/lib/bandwidth/voice_lib/voice/models/diversion.rb +80 -0
- data/lib/bandwidth/voice_lib/voice/models/fallback_method_enum.rb +17 -0
- data/lib/bandwidth/voice_lib/voice/models/machine_detection_configuration.rb +218 -0
- data/lib/bandwidth/voice_lib/voice/models/mode_enum.rb +20 -0
- data/lib/bandwidth/voice_lib/voice/models/{modify_call_recording_state.rb → modify_call_recording_request.rb} +19 -6
- data/lib/bandwidth/voice_lib/voice/models/modify_call_request.rb +156 -0
- data/lib/bandwidth/voice_lib/voice/models/modify_conference_request.rb +144 -0
- data/lib/bandwidth/voice_lib/voice/models/state1_enum.rb +7 -4
- data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +4 -7
- data/lib/bandwidth/voice_lib/voice/models/transcribe_recording_request.rb +108 -0
- data/lib/bandwidth/voice_lib/voice/models/transcript.rb +20 -4
- data/lib/bandwidth/voice_lib/voice/models/transcription.rb +35 -17
- data/lib/bandwidth/voice_lib/voice/models/transcription_metadata.rb +89 -0
- data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +18 -1
- data/lib/bandwidth/voice_lib/voice.rb +20 -18
- data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +7 -2
- data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +4 -4
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +75 -64
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +3 -5
- data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +5 -2
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +20 -5
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +37 -14
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +15 -2
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +20 -4
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +20 -3
- data/lib/bandwidth.rb +20 -18
- data/test/integration/test_integration.rb +92 -57
- metadata +35 -31
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +0 -22
- data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +0 -207
- data/lib/bandwidth/voice_lib/voice/models/api_call_state_response.rb +0 -164
- data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +0 -248
- data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +0 -116
- data/lib/bandwidth/voice_lib/voice/models/api_modify_conference_request.rb +0 -107
- data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +0 -80
- data/lib/bandwidth/voice_lib/voice/models/conference_detail.rb +0 -108
- data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata_response.rb +0 -126
- data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +0 -47
- data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +0 -190
- data/lib/bandwidth/voice_lib/voice/models/state2_enum.rb +0 -20
- data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +0 -29
- data/lib/bandwidth/voice_lib/voice/models/status3_enum.rb +0 -32
@@ -4,7 +4,7 @@
|
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
6
|
module Bandwidth
|
7
|
-
module
|
7
|
+
module MultiFactorAuth
|
8
8
|
# bandwidth client class.
|
9
9
|
class Client
|
10
10
|
attr_reader :config
|
@@ -16,12 +16,17 @@ module Bandwidth
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
19
|
-
backoff_factor:
|
19
|
+
backoff_factor: 2,
|
20
|
+
retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524, 408, 413, 429, 500, 502, 503, 504, 521, 522, 524],
|
21
|
+
retry_methods: %i[get put get put],
|
22
|
+
environment: Environment::PRODUCTION,
|
20
23
|
base_url: 'https://www.example.com',
|
21
24
|
messaging_basic_auth_user_name: 'TODO: Replace',
|
22
25
|
messaging_basic_auth_password: 'TODO: Replace',
|
23
|
-
|
24
|
-
|
26
|
+
multi_factor_auth_basic_auth_user_name: 'TODO: Replace',
|
27
|
+
multi_factor_auth_basic_auth_password: 'TODO: Replace',
|
28
|
+
phone_number_lookup_basic_auth_user_name: 'TODO: Replace',
|
29
|
+
phone_number_lookup_basic_auth_password: 'TODO: Replace',
|
25
30
|
voice_basic_auth_user_name: 'TODO: Replace',
|
26
31
|
voice_basic_auth_password: 'TODO: Replace',
|
27
32
|
web_rtc_basic_auth_user_name: 'TODO: Replace',
|
@@ -32,12 +37,16 @@ module Bandwidth
|
|
32
37
|
max_retries: max_retries,
|
33
38
|
retry_interval: retry_interval,
|
34
39
|
backoff_factor: backoff_factor,
|
40
|
+
retry_statuses: retry_statuses,
|
41
|
+
retry_methods: retry_methods,
|
35
42
|
environment: environment,
|
36
43
|
base_url: base_url,
|
37
44
|
messaging_basic_auth_user_name: messaging_basic_auth_user_name,
|
38
45
|
messaging_basic_auth_password: messaging_basic_auth_password,
|
39
|
-
|
40
|
-
|
46
|
+
multi_factor_auth_basic_auth_user_name: multi_factor_auth_basic_auth_user_name,
|
47
|
+
multi_factor_auth_basic_auth_password: multi_factor_auth_basic_auth_password,
|
48
|
+
phone_number_lookup_basic_auth_user_name: phone_number_lookup_basic_auth_user_name,
|
49
|
+
phone_number_lookup_basic_auth_password: phone_number_lookup_basic_auth_password,
|
41
50
|
voice_basic_auth_user_name: voice_basic_auth_user_name,
|
42
51
|
voice_basic_auth_password: voice_basic_auth_password,
|
43
52
|
web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
|
@@ -19,14 +19,12 @@ module Bandwidth
|
|
19
19
|
|
20
20
|
def validate_parameters(args)
|
21
21
|
args.each do |_name, value|
|
22
|
-
if value.nil?
|
23
|
-
raise ArgumentError, "Required parameter #{_name} cannot be nil."
|
24
|
-
end
|
22
|
+
raise ArgumentError, "Required parameter #{_name} cannot be nil." if value.nil?
|
25
23
|
end
|
26
24
|
end
|
27
25
|
|
28
26
|
def execute_request(request, binary: false)
|
29
|
-
@http_call_back
|
27
|
+
@http_call_back&.on_before_request(request)
|
30
28
|
|
31
29
|
APIHelper.clean_hash(request.headers)
|
32
30
|
request.headers.merge!(@global_headers)
|
@@ -36,7 +34,7 @@ module Bandwidth
|
|
36
34
|
else
|
37
35
|
config.http_client.execute_as_string(request)
|
38
36
|
end
|
39
|
-
@http_call_back
|
37
|
+
@http_call_back&.on_after_response(response)
|
40
38
|
|
41
39
|
response
|
42
40
|
end
|
@@ -4,14 +4,15 @@
|
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
6
|
module Bandwidth
|
7
|
-
module
|
7
|
+
module MultiFactorAuth
|
8
8
|
# MFAController
|
9
9
|
class MFAController < BaseController
|
10
10
|
def initialize(config, http_call_back: nil)
|
11
11
|
super(config, http_call_back: http_call_back)
|
12
12
|
end
|
13
13
|
|
14
|
-
#
|
14
|
+
# Multi-Factor authentication with Bandwidth Voice services. Allows for a
|
15
|
+
# user to send an MFA code via a phone call.
|
15
16
|
# @param [String] account_id Required parameter: Bandwidth Account ID with
|
16
17
|
# Voice service enabled
|
17
18
|
# @param [TwoFactorCodeRequestSchema] body Required parameter: Example:
|
@@ -19,7 +20,7 @@ module TwoFactorAuth
|
|
19
20
|
def create_voice_two_factor(account_id,
|
20
21
|
body)
|
21
22
|
# Prepare query url.
|
22
|
-
_query_builder = config.get_base_uri(Server::
|
23
|
+
_query_builder = config.get_base_uri(Server::MULTIFACTORAUTHDEFAULT)
|
23
24
|
_query_builder << '/accounts/{accountId}/code/voice'
|
24
25
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
25
26
|
_query_builder,
|
@@ -39,26 +40,27 @@ module TwoFactorAuth
|
|
39
40
|
headers: _headers,
|
40
41
|
parameters: body.to_json
|
41
42
|
)
|
42
|
-
|
43
|
+
MultiFactorAuthBasicAuth.apply(config, _request)
|
43
44
|
_response = execute_request(_request)
|
44
45
|
|
45
46
|
# Validate response against endpoint and global error codes.
|
46
|
-
|
47
|
+
case _response.status_code
|
48
|
+
when 400
|
47
49
|
raise ErrorWithRequestException.new(
|
48
50
|
'If there is any issue with values passed in by the user',
|
49
51
|
_response
|
50
52
|
)
|
51
|
-
|
53
|
+
when 401
|
52
54
|
raise UnauthorizedRequestException.new(
|
53
55
|
'Authentication is either incorrect or not present',
|
54
56
|
_response
|
55
57
|
)
|
56
|
-
|
58
|
+
when 403
|
57
59
|
raise ForbiddenRequestException.new(
|
58
60
|
'The user is not authorized to access this resource',
|
59
61
|
_response
|
60
62
|
)
|
61
|
-
|
63
|
+
when 500
|
62
64
|
raise ErrorWithRequestException.new(
|
63
65
|
'An internal server error occurred',
|
64
66
|
_response
|
@@ -73,7 +75,8 @@ module TwoFactorAuth
|
|
73
75
|
)
|
74
76
|
end
|
75
77
|
|
76
|
-
#
|
78
|
+
# Multi-Factor authentication with Bandwidth Messaging services. Allows a
|
79
|
+
# user to send an MFA code via a text message (SMS).
|
77
80
|
# @param [String] account_id Required parameter: Bandwidth Account ID with
|
78
81
|
# Messaging service enabled
|
79
82
|
# @param [TwoFactorCodeRequestSchema] body Required parameter: Example:
|
@@ -81,7 +84,7 @@ module TwoFactorAuth
|
|
81
84
|
def create_messaging_two_factor(account_id,
|
82
85
|
body)
|
83
86
|
# Prepare query url.
|
84
|
-
_query_builder = config.get_base_uri(Server::
|
87
|
+
_query_builder = config.get_base_uri(Server::MULTIFACTORAUTHDEFAULT)
|
85
88
|
_query_builder << '/accounts/{accountId}/code/messaging'
|
86
89
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
87
90
|
_query_builder,
|
@@ -101,26 +104,27 @@ module TwoFactorAuth
|
|
101
104
|
headers: _headers,
|
102
105
|
parameters: body.to_json
|
103
106
|
)
|
104
|
-
|
107
|
+
MultiFactorAuthBasicAuth.apply(config, _request)
|
105
108
|
_response = execute_request(_request)
|
106
109
|
|
107
110
|
# Validate response against endpoint and global error codes.
|
108
|
-
|
111
|
+
case _response.status_code
|
112
|
+
when 400
|
109
113
|
raise ErrorWithRequestException.new(
|
110
114
|
'If there is any issue with values passed in by the user',
|
111
115
|
_response
|
112
116
|
)
|
113
|
-
|
117
|
+
when 401
|
114
118
|
raise UnauthorizedRequestException.new(
|
115
119
|
'Authentication is either incorrect or not present',
|
116
120
|
_response
|
117
121
|
)
|
118
|
-
|
122
|
+
when 403
|
119
123
|
raise ForbiddenRequestException.new(
|
120
124
|
'The user is not authorized to access this resource',
|
121
125
|
_response
|
122
126
|
)
|
123
|
-
|
127
|
+
when 500
|
124
128
|
raise ErrorWithRequestException.new(
|
125
129
|
'An internal server error occurred',
|
126
130
|
_response
|
@@ -136,7 +140,7 @@ module TwoFactorAuth
|
|
136
140
|
)
|
137
141
|
end
|
138
142
|
|
139
|
-
# Allows a user to verify an MFA code
|
143
|
+
# Allows a user to verify an MFA code.
|
140
144
|
# @param [String] account_id Required parameter: Bandwidth Account ID with
|
141
145
|
# Two-Factor enabled
|
142
146
|
# @param [TwoFactorVerifyRequestSchema] body Required parameter: Example:
|
@@ -144,7 +148,7 @@ module TwoFactorAuth
|
|
144
148
|
def create_verify_two_factor(account_id,
|
145
149
|
body)
|
146
150
|
# Prepare query url.
|
147
|
-
_query_builder = config.get_base_uri(Server::
|
151
|
+
_query_builder = config.get_base_uri(Server::MULTIFACTORAUTHDEFAULT)
|
148
152
|
_query_builder << '/accounts/{accountId}/code/verify'
|
149
153
|
_query_builder = APIHelper.append_url_with_template_parameters(
|
150
154
|
_query_builder,
|
@@ -164,32 +168,33 @@ module TwoFactorAuth
|
|
164
168
|
headers: _headers,
|
165
169
|
parameters: body.to_json
|
166
170
|
)
|
167
|
-
|
171
|
+
MultiFactorAuthBasicAuth.apply(config, _request)
|
168
172
|
_response = execute_request(_request)
|
169
173
|
|
170
174
|
# Validate response against endpoint and global error codes.
|
171
|
-
|
175
|
+
case _response.status_code
|
176
|
+
when 400
|
172
177
|
raise ErrorWithRequestException.new(
|
173
178
|
'If there is any issue with values passed in by the user',
|
174
179
|
_response
|
175
180
|
)
|
176
|
-
|
181
|
+
when 401
|
177
182
|
raise UnauthorizedRequestException.new(
|
178
183
|
'Authentication is either incorrect or not present',
|
179
184
|
_response
|
180
185
|
)
|
181
|
-
|
186
|
+
when 403
|
182
187
|
raise ForbiddenRequestException.new(
|
183
188
|
'The user is not authorized to access this resource',
|
184
189
|
_response
|
185
190
|
)
|
186
|
-
|
191
|
+
when 429
|
187
192
|
raise ErrorWithRequestException.new(
|
188
193
|
'The user has made too many bad requests and is temporarily locked' \
|
189
194
|
' out',
|
190
195
|
_response
|
191
196
|
)
|
192
|
-
|
197
|
+
when 500
|
193
198
|
raise ErrorWithRequestException.new(
|
194
199
|
'An internal server error occurred',
|
195
200
|
_response
|
@@ -6,6 +6,9 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# ErrorWithRequest class.
|
8
8
|
class ErrorWithRequestException < APIException
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
9
12
|
# An error message pertaining to what the issue could be
|
10
13
|
# @return [String]
|
11
14
|
attr_accessor :error
|
@@ -27,8 +30,8 @@ module Bandwidth
|
|
27
30
|
# @param [Hash] The deserialized response sent by the server in the
|
28
31
|
# response body.
|
29
32
|
def unbox(hash)
|
30
|
-
@error = hash['error']
|
31
|
-
@request_id = hash['requestId']
|
33
|
+
@error = hash.key?('error') ? hash['error'] : SKIP
|
34
|
+
@request_id = hash.key?('requestId') ? hash['requestId'] : SKIP
|
32
35
|
end
|
33
36
|
end
|
34
37
|
end
|
@@ -6,6 +6,9 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# ForbiddenRequest class.
|
8
8
|
class ForbiddenRequestException < APIException
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
9
12
|
# The message containing the reason behind the request being forbidden
|
10
13
|
# @return [String]
|
11
14
|
attr_accessor :message
|
@@ -23,7 +26,7 @@ module Bandwidth
|
|
23
26
|
# @param [Hash] The deserialized response sent by the server in the
|
24
27
|
# response body.
|
25
28
|
def unbox(hash)
|
26
|
-
@message = hash['Message']
|
29
|
+
@message = hash.key?('Message') ? hash['Message'] : SKIP
|
27
30
|
end
|
28
31
|
end
|
29
32
|
end
|
@@ -6,6 +6,9 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# UnauthorizedRequest class.
|
8
8
|
class UnauthorizedRequestException < APIException
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
9
12
|
# The message containing the reason behind the request being unauthorized
|
10
13
|
# @return [String]
|
11
14
|
attr_accessor :message
|
@@ -23,7 +26,7 @@ module Bandwidth
|
|
23
26
|
# @param [Hash] The deserialized response sent by the server in the
|
24
27
|
# response body.
|
25
28
|
def unbox(hash)
|
26
|
-
@message = hash['message']
|
29
|
+
@message = hash.key?('message') ? hash['message'] : SKIP
|
27
30
|
end
|
28
31
|
end
|
29
32
|
end
|
@@ -6,6 +6,9 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# TwoFactorCodeRequestSchema Model.
|
8
8
|
class TwoFactorCodeRequestSchema < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
9
12
|
# The phone number to send the 2fa code to.
|
10
13
|
# @return [String]
|
11
14
|
attr_accessor :to
|
@@ -50,18 +53,30 @@ module Bandwidth
|
|
50
53
|
@_hash
|
51
54
|
end
|
52
55
|
|
56
|
+
# An array for optional fields
|
57
|
+
def optionals
|
58
|
+
%w[
|
59
|
+
scope
|
60
|
+
]
|
61
|
+
end
|
62
|
+
|
63
|
+
# An array for nullable fields
|
64
|
+
def nullables
|
65
|
+
[]
|
66
|
+
end
|
67
|
+
|
53
68
|
def initialize(to = nil,
|
54
69
|
from = nil,
|
55
70
|
application_id = nil,
|
56
71
|
message = nil,
|
57
72
|
digits = nil,
|
58
73
|
scope = nil)
|
59
|
-
@to = to
|
60
|
-
@from = from
|
61
|
-
@application_id = application_id
|
62
|
-
@scope = scope
|
63
|
-
@message = message
|
64
|
-
@digits = digits
|
74
|
+
@to = to unless to == SKIP
|
75
|
+
@from = from unless from == SKIP
|
76
|
+
@application_id = application_id unless application_id == SKIP
|
77
|
+
@scope = scope unless scope == SKIP
|
78
|
+
@message = message unless message == SKIP
|
79
|
+
@digits = digits unless digits == SKIP
|
65
80
|
end
|
66
81
|
|
67
82
|
# Creates an instance of the object from a hash.
|
@@ -69,12 +84,12 @@ module Bandwidth
|
|
69
84
|
return nil unless hash
|
70
85
|
|
71
86
|
# Extract variables from the hash.
|
72
|
-
to = hash['to']
|
73
|
-
from = hash['from']
|
74
|
-
application_id = hash['applicationId']
|
75
|
-
message = hash['message']
|
76
|
-
digits = hash['digits']
|
77
|
-
scope = hash['scope']
|
87
|
+
to = hash.key?('to') ? hash['to'] : SKIP
|
88
|
+
from = hash.key?('from') ? hash['from'] : SKIP
|
89
|
+
application_id = hash.key?('applicationId') ? hash['applicationId'] : SKIP
|
90
|
+
message = hash.key?('message') ? hash['message'] : SKIP
|
91
|
+
digits = hash.key?('digits') ? hash['digits'] : SKIP
|
92
|
+
scope = hash.key?('scope') ? hash['scope'] : SKIP
|
78
93
|
|
79
94
|
# Create object from extracted values.
|
80
95
|
TwoFactorCodeRequestSchema.new(to,
|
@@ -6,6 +6,9 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# TwoFactorMessagingResponse Model.
|
8
8
|
class TwoFactorMessagingResponse < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
9
12
|
# TODO: Write general description for this method
|
10
13
|
# @return [String]
|
11
14
|
attr_accessor :message_id
|
@@ -17,8 +20,20 @@ module Bandwidth
|
|
17
20
|
@_hash
|
18
21
|
end
|
19
22
|
|
23
|
+
# An array for optional fields
|
24
|
+
def optionals
|
25
|
+
%w[
|
26
|
+
message_id
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
# An array for nullable fields
|
31
|
+
def nullables
|
32
|
+
[]
|
33
|
+
end
|
34
|
+
|
20
35
|
def initialize(message_id = nil)
|
21
|
-
@message_id = message_id
|
36
|
+
@message_id = message_id unless message_id == SKIP
|
22
37
|
end
|
23
38
|
|
24
39
|
# Creates an instance of the object from a hash.
|
@@ -26,7 +41,7 @@ module Bandwidth
|
|
26
41
|
return nil unless hash
|
27
42
|
|
28
43
|
# Extract variables from the hash.
|
29
|
-
message_id = hash['messageId']
|
44
|
+
message_id = hash.key?('messageId') ? hash['messageId'] : SKIP
|
30
45
|
|
31
46
|
# Create object from extracted values.
|
32
47
|
TwoFactorMessagingResponse.new(message_id)
|
@@ -6,6 +6,9 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# TwoFactorVerifyCodeResponse Model.
|
8
8
|
class TwoFactorVerifyCodeResponse < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
9
12
|
# TODO: Write general description for this method
|
10
13
|
# @return [Boolean]
|
11
14
|
attr_accessor :valid
|
@@ -17,8 +20,20 @@ module Bandwidth
|
|
17
20
|
@_hash
|
18
21
|
end
|
19
22
|
|
23
|
+
# An array for optional fields
|
24
|
+
def optionals
|
25
|
+
%w[
|
26
|
+
valid
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
# An array for nullable fields
|
31
|
+
def nullables
|
32
|
+
[]
|
33
|
+
end
|
34
|
+
|
20
35
|
def initialize(valid = nil)
|
21
|
-
@valid = valid
|
36
|
+
@valid = valid unless valid == SKIP
|
22
37
|
end
|
23
38
|
|
24
39
|
# Creates an instance of the object from a hash.
|
@@ -26,7 +41,7 @@ module Bandwidth
|
|
26
41
|
return nil unless hash
|
27
42
|
|
28
43
|
# Extract variables from the hash.
|
29
|
-
valid = hash['valid']
|
44
|
+
valid = hash.key?('valid') ? hash['valid'] : SKIP
|
30
45
|
|
31
46
|
# Create object from extracted values.
|
32
47
|
TwoFactorVerifyCodeResponse.new(valid)
|
@@ -6,6 +6,9 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# TwoFactorVerifyRequestSchema Model.
|
8
8
|
class TwoFactorVerifyRequestSchema < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
9
12
|
# The phone number to send the 2fa code to.
|
10
13
|
# @return [String]
|
11
14
|
attr_accessor :to
|
@@ -41,16 +44,31 @@ module Bandwidth
|
|
41
44
|
@_hash
|
42
45
|
end
|
43
46
|
|
47
|
+
# An array for optional fields
|
48
|
+
def optionals
|
49
|
+
%w[
|
50
|
+
scope
|
51
|
+
]
|
52
|
+
end
|
53
|
+
|
54
|
+
# An array for nullable fields
|
55
|
+
def nullables
|
56
|
+
[]
|
57
|
+
end
|
58
|
+
|
44
59
|
def initialize(to = nil,
|
45
60
|
application_id = nil,
|
46
61
|
expiration_time_in_minutes = nil,
|
47
62
|
code = nil,
|
48
63
|
scope = nil)
|
49
|
-
@to = to
|
50
|
-
@application_id = application_id
|
51
|
-
@scope = scope
|
52
|
-
|
53
|
-
|
64
|
+
@to = to unless to == SKIP
|
65
|
+
@application_id = application_id unless application_id == SKIP
|
66
|
+
@scope = scope unless scope == SKIP
|
67
|
+
unless expiration_time_in_minutes == SKIP
|
68
|
+
@expiration_time_in_minutes =
|
69
|
+
expiration_time_in_minutes
|
70
|
+
end
|
71
|
+
@code = code unless code == SKIP
|
54
72
|
end
|
55
73
|
|
56
74
|
# Creates an instance of the object from a hash.
|
@@ -58,11 +76,12 @@ module Bandwidth
|
|
58
76
|
return nil unless hash
|
59
77
|
|
60
78
|
# Extract variables from the hash.
|
61
|
-
to = hash['to']
|
62
|
-
application_id = hash['applicationId']
|
63
|
-
expiration_time_in_minutes =
|
64
|
-
|
65
|
-
|
79
|
+
to = hash.key?('to') ? hash['to'] : SKIP
|
80
|
+
application_id = hash.key?('applicationId') ? hash['applicationId'] : SKIP
|
81
|
+
expiration_time_in_minutes =
|
82
|
+
hash.key?('expirationTimeInMinutes') ? hash['expirationTimeInMinutes'] : SKIP
|
83
|
+
code = hash.key?('code') ? hash['code'] : SKIP
|
84
|
+
scope = hash.key?('scope') ? hash['scope'] : SKIP
|
66
85
|
|
67
86
|
# Create object from extracted values.
|
68
87
|
TwoFactorVerifyRequestSchema.new(to,
|
@@ -6,6 +6,9 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# TwoFactorVoiceResponse Model.
|
8
8
|
class TwoFactorVoiceResponse < BaseModel
|
9
|
+
SKIP = Object.new
|
10
|
+
private_constant :SKIP
|
11
|
+
|
9
12
|
# TODO: Write general description for this method
|
10
13
|
# @return [String]
|
11
14
|
attr_accessor :call_id
|
@@ -17,8 +20,20 @@ module Bandwidth
|
|
17
20
|
@_hash
|
18
21
|
end
|
19
22
|
|
23
|
+
# An array for optional fields
|
24
|
+
def optionals
|
25
|
+
%w[
|
26
|
+
call_id
|
27
|
+
]
|
28
|
+
end
|
29
|
+
|
30
|
+
# An array for nullable fields
|
31
|
+
def nullables
|
32
|
+
[]
|
33
|
+
end
|
34
|
+
|
20
35
|
def initialize(call_id = nil)
|
21
|
-
@call_id = call_id
|
36
|
+
@call_id = call_id unless call_id == SKIP
|
22
37
|
end
|
23
38
|
|
24
39
|
# Creates an instance of the object from a hash.
|
@@ -26,7 +41,7 @@ module Bandwidth
|
|
26
41
|
return nil unless hash
|
27
42
|
|
28
43
|
# Extract variables from the hash.
|
29
|
-
call_id = hash['callId']
|
44
|
+
call_id = hash.key?('callId') ? hash['callId'] : SKIP
|
30
45
|
|
31
46
|
# Create object from extracted values.
|
32
47
|
TwoFactorVoiceResponse.new(call_id)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
|
7
|
+
require_relative 'multi_factor_auth/client.rb'
|
8
|
+
|
9
|
+
# Models
|
10
|
+
require_relative 'multi_factor_auth/models/two_factor_code_request_schema.rb'
|
11
|
+
require_relative 'multi_factor_auth/models/two_factor_voice_response.rb'
|
12
|
+
require_relative 'multi_factor_auth/models/two_factor_messaging_response.rb'
|
13
|
+
require_relative 'multi_factor_auth/models/two_factor_verify_request_schema.rb'
|
14
|
+
require_relative 'multi_factor_auth/models/two_factor_verify_code_response.rb'
|
15
|
+
|
16
|
+
# Exceptions
|
17
|
+
require_relative 'multi_factor_auth/exceptions/error_with_request_exception.rb'
|
18
|
+
require_relative 'multi_factor_auth/exceptions/unauthorized_request' \
|
19
|
+
'_exception.rb'
|
20
|
+
require_relative 'multi_factor_auth/exceptions/forbidden_request_exception.rb'
|
21
|
+
# Controllers
|
22
|
+
require_relative 'multi_factor_auth/controllers/base_controller.rb'
|
23
|
+
require_relative 'multi_factor_auth/controllers/mfa_controller.rb'
|