bandwidth-sdk 2.2.2 → 3.12.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bandwidth.rb +28 -2
- data/lib/bandwidth/api_helper.rb +14 -9
- data/lib/bandwidth/client.rb +22 -2
- data/lib/bandwidth/configuration.rb +67 -12
- data/lib/bandwidth/http/auth/two_factor_auth_basic_auth.rb +22 -0
- data/lib/bandwidth/http/auth/web_rtc_basic_auth.rb +22 -0
- data/lib/bandwidth/messaging_lib/messaging.rb +1 -3
- data/lib/bandwidth/messaging_lib/messaging/client.rb +13 -2
- data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +48 -95
- data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/messaging_lib/messaging/exceptions/{generic_client_exception.rb → messaging_exception.rb} +2 -14
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +20 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +51 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +158 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +49 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb +29 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb +88 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_messaging_response.rb +35 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_code_response.rb +35 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb +94 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_voice_response.rb +35 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +28 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +32 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +13 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/phone_number.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +6 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/redirect.rb +5 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/ring.rb +15 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/send_dtmf.rb +4 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/start_gather.rb +20 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb +14 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/transfer.rb +5 -1
- data/lib/bandwidth/voice_lib/voice.rb +8 -0
- data/lib/bandwidth/voice_lib/voice/client.rb +13 -2
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +768 -131
- data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/voice_lib/voice/models/answer_fallback_method_enum.rb +17 -0
- data/lib/bandwidth/voice_lib/voice/models/api_call_response.rb +45 -0
- data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +65 -2
- data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +36 -0
- data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +11 -2
- data/lib/bandwidth/voice_lib/voice/models/call_engine_modify_conference_request.rb +107 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_detail.rb +108 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_event_method_enum.rb +35 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_member_detail.rb +80 -0
- data/lib/bandwidth/voice_lib/voice/models/conference_recording_metadata_response.rb +126 -0
- data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +4 -1
- data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +33 -5
- data/lib/bandwidth/voice_lib/voice/models/redirect_fallback_method_enum.rb +17 -0
- data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +3 -3
- data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +10 -13
- data/lib/bandwidth/voice_lib/voice/models/status3_enum.rb +32 -0
- data/lib/bandwidth/voice_lib/voice/models/status_enum.rb +4 -13
- data/lib/bandwidth/voice_lib/voice/models/transcription.rb +1 -1
- data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +13 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc.rb +21 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +51 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +692 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +49 -0
- data/lib/bandwidth/{messaging_lib/messaging/exceptions/path_client_exception.rb → web_rtc_lib/web_rtc/exceptions/error_exception.rb} +4 -19
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +47 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +83 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +35 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb +17 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +44 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +54 -0
- metadata +60 -13
- data/lib/bandwidth/messaging_lib/messaging/models/field_error.rb +0 -44
@@ -4,8 +4,8 @@
|
|
4
4
|
# ( https://apimatic.io ).
|
5
5
|
|
6
6
|
module Bandwidth
|
7
|
-
#
|
8
|
-
class
|
7
|
+
# MessagingException class.
|
8
|
+
class MessagingException < APIException
|
9
9
|
# TODO: Write general description for this method
|
10
10
|
# @return [String]
|
11
11
|
attr_accessor :type
|
@@ -14,10 +14,6 @@ module Bandwidth
|
|
14
14
|
# @return [String]
|
15
15
|
attr_accessor :description
|
16
16
|
|
17
|
-
# TODO: Write general description for this method
|
18
|
-
# @return [List of FieldError]
|
19
|
-
attr_accessor :field_errors
|
20
|
-
|
21
17
|
# The constructor.
|
22
18
|
# @param [String] The reason for raising an exception.
|
23
19
|
# @param [HttpResponse] The HttpReponse of the API call.
|
@@ -33,14 +29,6 @@ module Bandwidth
|
|
33
29
|
def unbox(hash)
|
34
30
|
@type = hash['type']
|
35
31
|
@description = hash['description']
|
36
|
-
# Parameter is an array, so we need to iterate through it
|
37
|
-
@field_errors = nil
|
38
|
-
unless hash['fieldErrors'].nil?
|
39
|
-
@field_errors = []
|
40
|
-
hash['fieldErrors'].each do |structure|
|
41
|
-
@field_errors << (FieldError.from_hash(structure) if structure)
|
42
|
-
end
|
43
|
-
end
|
44
32
|
end
|
45
33
|
end
|
46
34
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
|
7
|
+
require_relative 'two_factor_auth/client.rb'
|
8
|
+
|
9
|
+
# Models
|
10
|
+
require_relative 'two_factor_auth/models/two_factor_code_request_schema.rb'
|
11
|
+
require_relative 'two_factor_auth/models/two_factor_voice_response.rb'
|
12
|
+
require_relative 'two_factor_auth/models/two_factor_messaging_response.rb'
|
13
|
+
require_relative 'two_factor_auth/models/two_factor_verify_request_schema.rb'
|
14
|
+
require_relative 'two_factor_auth/models/two_factor_verify_code_response.rb'
|
15
|
+
|
16
|
+
# Exceptions
|
17
|
+
require_relative 'two_factor_auth/exceptions/invalid_request_exception.rb'
|
18
|
+
# Controllers
|
19
|
+
require_relative 'two_factor_auth/controllers/base_controller.rb'
|
20
|
+
require_relative 'two_factor_auth/controllers/api_controller.rb'
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
module TwoFactorAuth
|
8
|
+
# bandwidth client class.
|
9
|
+
class Client
|
10
|
+
attr_reader :config
|
11
|
+
|
12
|
+
# Access to client controller.
|
13
|
+
# @return [APIController] Returns the controller instance.
|
14
|
+
def client
|
15
|
+
@client ||= APIController.new config
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
|
19
|
+
backoff_factor: 1, environment: Environment::PRODUCTION,
|
20
|
+
base_url: 'https://www.example.com',
|
21
|
+
messaging_basic_auth_user_name: 'TODO: Replace',
|
22
|
+
messaging_basic_auth_password: 'TODO: Replace',
|
23
|
+
two_factor_auth_basic_auth_user_name: 'TODO: Replace',
|
24
|
+
two_factor_auth_basic_auth_password: 'TODO: Replace',
|
25
|
+
voice_basic_auth_user_name: 'TODO: Replace',
|
26
|
+
voice_basic_auth_password: 'TODO: Replace',
|
27
|
+
web_rtc_basic_auth_user_name: 'TODO: Replace',
|
28
|
+
web_rtc_basic_auth_password: 'TODO: Replace',
|
29
|
+
config: nil)
|
30
|
+
@config = if config.nil?
|
31
|
+
Configuration.new(timeout: timeout,
|
32
|
+
max_retries: max_retries,
|
33
|
+
retry_interval: retry_interval,
|
34
|
+
backoff_factor: backoff_factor,
|
35
|
+
environment: environment,
|
36
|
+
base_url: base_url,
|
37
|
+
messaging_basic_auth_user_name: messaging_basic_auth_user_name,
|
38
|
+
messaging_basic_auth_password: messaging_basic_auth_password,
|
39
|
+
two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
|
40
|
+
two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
|
41
|
+
voice_basic_auth_user_name: voice_basic_auth_user_name,
|
42
|
+
voice_basic_auth_password: voice_basic_auth_password,
|
43
|
+
web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
|
44
|
+
web_rtc_basic_auth_password: web_rtc_basic_auth_password)
|
45
|
+
else
|
46
|
+
config
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
module TwoFactorAuth
|
8
|
+
# APIController
|
9
|
+
class APIController < BaseController
|
10
|
+
def initialize(config, http_call_back: nil)
|
11
|
+
super(config, http_call_back: http_call_back)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Two-Factor authentication with Bandwidth Voice services
|
15
|
+
# @param [String] account_id Required parameter: Bandwidth Account ID with
|
16
|
+
# Voice service enabled
|
17
|
+
# @param [TwoFactorCodeRequestSchema] body Required parameter: Example:
|
18
|
+
# @return [TwoFactorVoiceResponse] response from the API call
|
19
|
+
def create_voice_two_factor(account_id,
|
20
|
+
body)
|
21
|
+
# Prepare query url.
|
22
|
+
_query_builder = config.get_base_uri(Server::TWOFACTORAUTHDEFAULT)
|
23
|
+
_query_builder << '/accounts/{accountId}/code/voice'
|
24
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
25
|
+
_query_builder,
|
26
|
+
'accountId' => { 'value' => account_id, 'encode' => true }
|
27
|
+
)
|
28
|
+
_query_url = APIHelper.clean_url _query_builder
|
29
|
+
|
30
|
+
# Prepare headers.
|
31
|
+
_headers = {
|
32
|
+
'accept' => 'application/json',
|
33
|
+
'content-type' => 'application/json; charset=utf-8'
|
34
|
+
}
|
35
|
+
|
36
|
+
# Prepare and execute HttpRequest.
|
37
|
+
_request = config.http_client.post(
|
38
|
+
_query_url,
|
39
|
+
headers: _headers,
|
40
|
+
parameters: body.to_json
|
41
|
+
)
|
42
|
+
TwoFactorAuthBasicAuth.apply(config, _request)
|
43
|
+
_response = execute_request(_request)
|
44
|
+
|
45
|
+
# Validate response against endpoint and global error codes.
|
46
|
+
if _response.status_code == 400
|
47
|
+
raise InvalidRequestException.new(
|
48
|
+
'client request error',
|
49
|
+
_response
|
50
|
+
)
|
51
|
+
end
|
52
|
+
validate_response(_response)
|
53
|
+
|
54
|
+
# Return appropriate response type.
|
55
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
56
|
+
ApiResponse.new(
|
57
|
+
_response, data: TwoFactorVoiceResponse.from_hash(decoded)
|
58
|
+
)
|
59
|
+
end
|
60
|
+
|
61
|
+
# Two-Factor authentication with Bandwidth messaging services
|
62
|
+
# @param [String] account_id Required parameter: Bandwidth Account ID with
|
63
|
+
# Messaging service enabled
|
64
|
+
# @param [TwoFactorCodeRequestSchema] body Required parameter: Example:
|
65
|
+
# @return [TwoFactorMessagingResponse] response from the API call
|
66
|
+
def create_messaging_two_factor(account_id,
|
67
|
+
body)
|
68
|
+
# Prepare query url.
|
69
|
+
_query_builder = config.get_base_uri(Server::TWOFACTORAUTHDEFAULT)
|
70
|
+
_query_builder << '/accounts/{accountId}/code/messaging'
|
71
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
72
|
+
_query_builder,
|
73
|
+
'accountId' => { 'value' => account_id, 'encode' => true }
|
74
|
+
)
|
75
|
+
_query_url = APIHelper.clean_url _query_builder
|
76
|
+
|
77
|
+
# Prepare headers.
|
78
|
+
_headers = {
|
79
|
+
'accept' => 'application/json',
|
80
|
+
'content-type' => 'application/json; charset=utf-8'
|
81
|
+
}
|
82
|
+
|
83
|
+
# Prepare and execute HttpRequest.
|
84
|
+
_request = config.http_client.post(
|
85
|
+
_query_url,
|
86
|
+
headers: _headers,
|
87
|
+
parameters: body.to_json
|
88
|
+
)
|
89
|
+
TwoFactorAuthBasicAuth.apply(config, _request)
|
90
|
+
_response = execute_request(_request)
|
91
|
+
|
92
|
+
# Validate response against endpoint and global error codes.
|
93
|
+
if _response.status_code == 400
|
94
|
+
raise InvalidRequestException.new(
|
95
|
+
'client request error',
|
96
|
+
_response
|
97
|
+
)
|
98
|
+
end
|
99
|
+
validate_response(_response)
|
100
|
+
|
101
|
+
# Return appropriate response type.
|
102
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
103
|
+
ApiResponse.new(
|
104
|
+
_response,
|
105
|
+
data: TwoFactorMessagingResponse.from_hash(decoded)
|
106
|
+
)
|
107
|
+
end
|
108
|
+
|
109
|
+
# Verify a previously sent two-factor authentication code
|
110
|
+
# @param [String] account_id Required parameter: Bandwidth Account ID with
|
111
|
+
# Two-Factor enabled
|
112
|
+
# @param [TwoFactorVerifyRequestSchema] body Required parameter: Example:
|
113
|
+
# @return [TwoFactorVerifyCodeResponse] response from the API call
|
114
|
+
def create_verify_two_factor(account_id,
|
115
|
+
body)
|
116
|
+
# Prepare query url.
|
117
|
+
_query_builder = config.get_base_uri(Server::TWOFACTORAUTHDEFAULT)
|
118
|
+
_query_builder << '/accounts/{accountId}/code/verify'
|
119
|
+
_query_builder = APIHelper.append_url_with_template_parameters(
|
120
|
+
_query_builder,
|
121
|
+
'accountId' => { 'value' => account_id, 'encode' => true }
|
122
|
+
)
|
123
|
+
_query_url = APIHelper.clean_url _query_builder
|
124
|
+
|
125
|
+
# Prepare headers.
|
126
|
+
_headers = {
|
127
|
+
'accept' => 'application/json',
|
128
|
+
'content-type' => 'application/json; charset=utf-8'
|
129
|
+
}
|
130
|
+
|
131
|
+
# Prepare and execute HttpRequest.
|
132
|
+
_request = config.http_client.post(
|
133
|
+
_query_url,
|
134
|
+
headers: _headers,
|
135
|
+
parameters: body.to_json
|
136
|
+
)
|
137
|
+
TwoFactorAuthBasicAuth.apply(config, _request)
|
138
|
+
_response = execute_request(_request)
|
139
|
+
|
140
|
+
# Validate response against endpoint and global error codes.
|
141
|
+
if _response.status_code == 400
|
142
|
+
raise InvalidRequestException.new(
|
143
|
+
'client request error',
|
144
|
+
_response
|
145
|
+
)
|
146
|
+
end
|
147
|
+
validate_response(_response)
|
148
|
+
|
149
|
+
# Return appropriate response type.
|
150
|
+
decoded = APIHelper.json_deserialize(_response.raw_body)
|
151
|
+
ApiResponse.new(
|
152
|
+
_response,
|
153
|
+
data: TwoFactorVerifyCodeResponse.from_hash(decoded)
|
154
|
+
)
|
155
|
+
end
|
156
|
+
end
|
157
|
+
end
|
158
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
# BaseController.
|
8
|
+
class BaseController
|
9
|
+
attr_accessor :config, :http_call_back
|
10
|
+
|
11
|
+
def initialize(config, http_call_back: nil)
|
12
|
+
@config = config
|
13
|
+
@http_call_back = http_call_back
|
14
|
+
|
15
|
+
@global_headers = {
|
16
|
+
'user-agent' => 'ruby-sdk-refs/tags/ruby3.12.1'
|
17
|
+
}
|
18
|
+
end
|
19
|
+
|
20
|
+
def validate_parameters(args)
|
21
|
+
args.each do |_name, value|
|
22
|
+
if value.nil?
|
23
|
+
raise ArgumentError, "Required parameter #{_name} cannot be nil."
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def execute_request(request, binary: false)
|
29
|
+
@http_call_back.on_before_request(request) if @http_call_back
|
30
|
+
|
31
|
+
APIHelper.clean_hash(request.headers)
|
32
|
+
request.headers.merge!(@global_headers)
|
33
|
+
|
34
|
+
response = if binary
|
35
|
+
config.http_client.execute_as_binary(request)
|
36
|
+
else
|
37
|
+
config.http_client.execute_as_string(request)
|
38
|
+
end
|
39
|
+
@http_call_back.on_after_response(response) if @http_call_back
|
40
|
+
|
41
|
+
response
|
42
|
+
end
|
43
|
+
|
44
|
+
def validate_response(response)
|
45
|
+
raise APIException.new 'HTTP Response Not OK', response unless
|
46
|
+
response.status_code.between?(200, 208) # [200,208] = HTTP OK
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
# InvalidRequest class.
|
8
|
+
class InvalidRequestException < APIException
|
9
|
+
# An error message pertaining to what the issue could be
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :result
|
12
|
+
|
13
|
+
# The constructor.
|
14
|
+
# @param [String] The reason for raising an exception.
|
15
|
+
# @param [HttpResponse] The HttpReponse of the API call.
|
16
|
+
def initialize(reason, response)
|
17
|
+
super(reason, response)
|
18
|
+
hash = APIHelper.json_deserialize(@response.raw_body)
|
19
|
+
unbox(hash)
|
20
|
+
end
|
21
|
+
|
22
|
+
# Populates this object by extracting properties from a hash.
|
23
|
+
# @param [Hash] The deserialized response sent by the server in the
|
24
|
+
# response body.
|
25
|
+
def unbox(hash)
|
26
|
+
@result = hash['result']
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb
ADDED
@@ -0,0 +1,88 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
# TwoFactorCodeRequestSchema Model.
|
8
|
+
class TwoFactorCodeRequestSchema < BaseModel
|
9
|
+
# The phone number to send the 2fa code to.
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :to
|
12
|
+
|
13
|
+
# The application phone number, the sender of the 2fa code.
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :from
|
16
|
+
|
17
|
+
# The application unique ID, obtained from Bandwidth.
|
18
|
+
# @return [String]
|
19
|
+
attr_accessor :application_id
|
20
|
+
|
21
|
+
# An optional field to denote what scope or action the 2fa code is
|
22
|
+
# addressing. If not supplied, defaults to "2FA".
|
23
|
+
# @return [String]
|
24
|
+
attr_accessor :scope
|
25
|
+
|
26
|
+
# The message format of the 2fa code. There are three values that the
|
27
|
+
# system will replace "{CODE}", "{NAME}", "{SCOPE}". The "{SCOPE}" and
|
28
|
+
# "{NAME} value template are optional, while "{CODE}" must be supplied. As
|
29
|
+
# the name would suggest, code will be replace with the actual 2fa code.
|
30
|
+
# Name is replaced with the application name, configured during provisioning
|
31
|
+
# of 2fa. The scope value is the same value sent during the call and
|
32
|
+
# partitioned by the server.
|
33
|
+
# @return [String]
|
34
|
+
attr_accessor :message
|
35
|
+
|
36
|
+
# The number of digits for your 2fa code. The valid number ranges from 2 to
|
37
|
+
# 8, inclusively.
|
38
|
+
# @return [Float]
|
39
|
+
attr_accessor :digits
|
40
|
+
|
41
|
+
# A mapping from model property names to API property names.
|
42
|
+
def self.names
|
43
|
+
@_hash = {} if @_hash.nil?
|
44
|
+
@_hash['to'] = 'to'
|
45
|
+
@_hash['from'] = 'from'
|
46
|
+
@_hash['application_id'] = 'applicationId'
|
47
|
+
@_hash['scope'] = 'scope'
|
48
|
+
@_hash['message'] = 'message'
|
49
|
+
@_hash['digits'] = 'digits'
|
50
|
+
@_hash
|
51
|
+
end
|
52
|
+
|
53
|
+
def initialize(to = nil,
|
54
|
+
from = nil,
|
55
|
+
application_id = nil,
|
56
|
+
message = nil,
|
57
|
+
digits = nil,
|
58
|
+
scope = nil)
|
59
|
+
@to = to
|
60
|
+
@from = from
|
61
|
+
@application_id = application_id
|
62
|
+
@scope = scope
|
63
|
+
@message = message
|
64
|
+
@digits = digits
|
65
|
+
end
|
66
|
+
|
67
|
+
# Creates an instance of the object from a hash.
|
68
|
+
def self.from_hash(hash)
|
69
|
+
return nil unless hash
|
70
|
+
|
71
|
+
# 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']
|
78
|
+
|
79
|
+
# Create object from extracted values.
|
80
|
+
TwoFactorCodeRequestSchema.new(to,
|
81
|
+
from,
|
82
|
+
application_id,
|
83
|
+
message,
|
84
|
+
digits,
|
85
|
+
scope)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|