bandwidth-sdk 3.2.0 → 3.7.0

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 (41) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bandwidth.rb +2 -0
  3. data/lib/bandwidth/client.rb +11 -2
  4. data/lib/bandwidth/configuration.rb +23 -5
  5. data/lib/bandwidth/http/auth/web_rtc_basic_auth.rb +22 -0
  6. data/lib/bandwidth/messaging_lib/messaging/client.rb +7 -2
  7. data/lib/bandwidth/messaging_lib/messaging/controllers/base_controller.rb +1 -1
  8. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +1 -0
  9. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +7 -2
  10. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +24 -0
  11. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +1 -1
  12. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb +29 -0
  13. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb +30 -4
  14. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb +33 -10
  15. data/lib/bandwidth/voice_lib/bxml/verbs/bridge.rb +22 -0
  16. data/lib/bandwidth/voice_lib/bxml/verbs/conference.rb +28 -0
  17. data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +8 -0
  18. data/lib/bandwidth/voice_lib/voice.rb +2 -0
  19. data/lib/bandwidth/voice_lib/voice/client.rb +7 -2
  20. data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +145 -78
  21. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
  22. data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +20 -2
  23. data/lib/bandwidth/voice_lib/voice/models/call_engine_modify_conference_request.rb +35 -0
  24. data/lib/bandwidth/voice_lib/voice/models/disconnect_cause_enum.rb +4 -1
  25. data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +1 -1
  26. data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +8 -14
  27. data/lib/bandwidth/voice_lib/voice/models/status2_enum.rb +32 -0
  28. data/lib/bandwidth/voice_lib/voice/models/status_enum.rb +4 -13
  29. data/lib/bandwidth/voice_lib/voice/models/transcription.rb +1 -1
  30. data/lib/bandwidth/web_rtc_lib/web_rtc.rb +21 -0
  31. data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +49 -0
  32. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/api_controller.rb +682 -0
  33. data/lib/bandwidth/web_rtc_lib/web_rtc/controllers/base_controller.rb +49 -0
  34. data/lib/bandwidth/web_rtc_lib/web_rtc/exceptions/error_exception.rb +34 -0
  35. data/lib/bandwidth/web_rtc_lib/web_rtc/models/accounts_participants_response.rb +47 -0
  36. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +83 -0
  37. data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant_subscription.rb +35 -0
  38. data/lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb +17 -0
  39. data/lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb +44 -0
  40. data/lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb +54 -0
  41. metadata +19 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0a28919bebd82a316cecaedd2e6abdea2c60bd092021e6a8128577d3f6e2c07
4
- data.tar.gz: 1ecfc47dbe9ee1ea5a50654a86c25ed712fe685e65ee7dc9401818a4b2fea530
3
+ metadata.gz: e10eadbf6902f10e74e9e2574332439ce256b7b8a57d8c7e87f6a776857376c0
4
+ data.tar.gz: 585279582d7e65c7a88dbb284d72a05f399be1a4c36dbc169fdeecd8a5317e61
5
5
  SHA512:
6
- metadata.gz: 4d77b5a15e04975c3815cc9b39adaaf5828a3ebb71064a57e5dcea8209f36516ec7ff5cce85c987586aa52eb0f25410ba8f864336023d8a52c877c059b26115e
7
- data.tar.gz: b3f26d82dbcf9b7f16551e972d18a11c66759a745547978ca4165c19a23dfb36edf6d2d85f7905db33dc576cf536d8221cffa398382bc447fd0b51c08c29ef21
6
+ metadata.gz: e2c78bbe4acf58b05f186547b72e39f10cd198e68fe22051ab268027177544e51111b95af0f3a44b9ec1d1e038ca8420ef2a871c537fbb17138e430fc8cab1d1
7
+ data.tar.gz: ad3b16633b516c60e14c8a9469acb912f74bc36c5e737fa636d4f2c32808636e76e718a1e3bcd7f30e7dcf2d93b278e31fdd1a71c08e5fe1574d16a484a0d184
@@ -39,5 +39,7 @@ require_relative 'bandwidth/two_factor_auth_lib/two_factor_auth'
39
39
  require_relative 'bandwidth/http/auth/two_factor_auth_basic_auth.rb'
40
40
  require_relative 'bandwidth/voice_lib/voice'
41
41
  require_relative 'bandwidth/http/auth/voice_basic_auth.rb'
42
+ require_relative 'bandwidth/web_rtc_lib/web_rtc'
43
+ require_relative 'bandwidth/http/auth/web_rtc_basic_auth.rb'
42
44
 
43
45
  # Controllers
@@ -22,6 +22,11 @@ module Bandwidth
22
22
  def voice_client
23
23
  @voice_client ||= Voice::Client.new(config: config)
24
24
  end
25
+ # Access to web_rtc_client controller.
26
+ # @return [WebRtc::Client] Returns the client instance.
27
+ def web_rtc_client
28
+ @web_rtc_client ||= WebRtc::Client.new(config: config)
29
+ end
25
30
 
26
31
  def initialize(timeout: 60, max_retries: 0, retry_interval: 1,
27
32
  backoff_factor: 1, environment: Environment::PRODUCTION,
@@ -30,7 +35,9 @@ module Bandwidth
30
35
  two_factor_auth_basic_auth_user_name: 'TODO: Replace',
31
36
  two_factor_auth_basic_auth_password: 'TODO: Replace',
32
37
  voice_basic_auth_user_name: 'TODO: Replace',
33
- voice_basic_auth_password: 'TODO: Replace', config: nil)
38
+ voice_basic_auth_password: 'TODO: Replace',
39
+ web_rtc_basic_auth_user_name: 'TODO: Replace',
40
+ web_rtc_basic_auth_password: 'TODO: Replace', config: nil)
34
41
  @config = if config.nil?
35
42
  Configuration.new(timeout: timeout, max_retries: max_retries,
36
43
  retry_interval: retry_interval,
@@ -41,7 +48,9 @@ module Bandwidth
41
48
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
42
49
  two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
43
50
  voice_basic_auth_user_name: voice_basic_auth_user_name,
44
- voice_basic_auth_password: voice_basic_auth_password)
51
+ voice_basic_auth_password: voice_basic_auth_password,
52
+ web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
53
+ web_rtc_basic_auth_password: web_rtc_basic_auth_password)
45
54
  else
46
55
  config
47
56
  end
@@ -17,7 +17,8 @@ module Bandwidth
17
17
  DEFAULT = 'default'.freeze,
18
18
  MESSAGINGDEFAULT = 'MessagingDefault'.freeze,
19
19
  TWOFACTORAUTHDEFAULT = 'TwoFactorAuthDefault'.freeze,
20
- VOICEDEFAULT = 'VoiceDefault'.freeze
20
+ VOICEDEFAULT = 'VoiceDefault'.freeze,
21
+ WEBRTCDEFAULT = 'WebRtcDefault'.freeze
21
22
  ].freeze
22
23
  end
23
24
 
@@ -37,6 +38,8 @@ module Bandwidth
37
38
  attr_reader :two_factor_auth_basic_auth_password
38
39
  attr_reader :voice_basic_auth_user_name
39
40
  attr_reader :voice_basic_auth_password
41
+ attr_reader :web_rtc_basic_auth_user_name
42
+ attr_reader :web_rtc_basic_auth_password
40
43
 
41
44
  class << self
42
45
  attr_reader :environments
@@ -49,7 +52,9 @@ module Bandwidth
49
52
  two_factor_auth_basic_auth_user_name: 'TODO: Replace',
50
53
  two_factor_auth_basic_auth_password: 'TODO: Replace',
51
54
  voice_basic_auth_user_name: 'TODO: Replace',
52
- voice_basic_auth_password: 'TODO: Replace')
55
+ voice_basic_auth_password: 'TODO: Replace',
56
+ web_rtc_basic_auth_user_name: 'TODO: Replace',
57
+ web_rtc_basic_auth_password: 'TODO: Replace')
53
58
  # The value to use for connection timeout
54
59
  @timeout = timeout
55
60
 
@@ -84,6 +89,12 @@ module Bandwidth
84
89
  # The password to use with basic authentication
85
90
  @voice_basic_auth_password = voice_basic_auth_password
86
91
 
92
+ # The username to use with basic authentication
93
+ @web_rtc_basic_auth_user_name = web_rtc_basic_auth_user_name
94
+
95
+ # The password to use with basic authentication
96
+ @web_rtc_basic_auth_password = web_rtc_basic_auth_password
97
+
87
98
  # The Http Client to use for making requests.
88
99
  @http_client = create_http_client
89
100
  end
@@ -95,7 +106,9 @@ module Bandwidth
95
106
  two_factor_auth_basic_auth_user_name: nil,
96
107
  two_factor_auth_basic_auth_password: nil,
97
108
  voice_basic_auth_user_name: nil,
98
- voice_basic_auth_password: nil)
109
+ voice_basic_auth_password: nil,
110
+ web_rtc_basic_auth_user_name: nil,
111
+ web_rtc_basic_auth_password: nil)
99
112
  timeout ||= self.timeout
100
113
  max_retries ||= self.max_retries
101
114
  retry_interval ||= self.retry_interval
@@ -107,6 +120,8 @@ module Bandwidth
107
120
  two_factor_auth_basic_auth_password ||= self.two_factor_auth_basic_auth_password
108
121
  voice_basic_auth_user_name ||= self.voice_basic_auth_user_name
109
122
  voice_basic_auth_password ||= self.voice_basic_auth_password
123
+ web_rtc_basic_auth_user_name ||= self.web_rtc_basic_auth_user_name
124
+ web_rtc_basic_auth_password ||= self.web_rtc_basic_auth_password
110
125
 
111
126
  Configuration.new(
112
127
  timeout: timeout, max_retries: max_retries,
@@ -117,7 +132,9 @@ module Bandwidth
117
132
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
118
133
  two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
119
134
  voice_basic_auth_user_name: voice_basic_auth_user_name,
120
- voice_basic_auth_password: voice_basic_auth_password
135
+ voice_basic_auth_password: voice_basic_auth_password,
136
+ web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
137
+ web_rtc_basic_auth_password: web_rtc_basic_auth_password
121
138
  )
122
139
  end
123
140
 
@@ -133,7 +150,8 @@ module Bandwidth
133
150
  Server::DEFAULT => 'api.bandwidth.com',
134
151
  Server::MESSAGINGDEFAULT => 'https://messaging.bandwidth.com/api/v2',
135
152
  Server::TWOFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1/',
136
- Server::VOICEDEFAULT => 'https://voice.bandwidth.com'
153
+ Server::VOICEDEFAULT => 'https://voice.bandwidth.com',
154
+ Server::WEBRTCDEFAULT => 'https://api.webrtc.bandwidth.com/v1'
137
155
  }
138
156
  }.freeze
139
157
 
@@ -0,0 +1,22 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'base64'
7
+
8
+ module Bandwidth
9
+ # Utility class for basic authorization.
10
+ class WebRtcBasicAuth
11
+ # Add basic authentication to the request.
12
+ # @param [HttpRequest] The HttpRequest object to which authentication will
13
+ # be added.
14
+ def self.apply(config, http_request)
15
+ username = config.web_rtc_basic_auth_user_name
16
+ password = config.web_rtc_basic_auth_password
17
+ value = Base64.strict_encode64("#{username}:#{password}")
18
+ header_value = "Basic #{value}"
19
+ http_request.headers['Authorization'] = header_value
20
+ end
21
+ end
22
+ end
@@ -22,7 +22,10 @@ module Bandwidth
22
22
  two_factor_auth_basic_auth_user_name: 'TODO: Replace',
23
23
  two_factor_auth_basic_auth_password: 'TODO: Replace',
24
24
  voice_basic_auth_user_name: 'TODO: Replace',
25
- voice_basic_auth_password: 'TODO: Replace', config: nil)
25
+ voice_basic_auth_password: 'TODO: Replace',
26
+ web_rtc_basic_auth_user_name: 'TODO: Replace',
27
+ web_rtc_basic_auth_password: 'TODO: Replace',
28
+ config: nil)
26
29
  @config = if config.nil?
27
30
  Configuration.new(timeout: timeout,
28
31
  max_retries: max_retries,
@@ -34,7 +37,9 @@ module Bandwidth
34
37
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
35
38
  two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
36
39
  voice_basic_auth_user_name: voice_basic_auth_user_name,
37
- voice_basic_auth_password: voice_basic_auth_password)
40
+ voice_basic_auth_password: voice_basic_auth_password,
41
+ web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
42
+ web_rtc_basic_auth_password: web_rtc_basic_auth_password)
38
43
  else
39
44
  config
40
45
  end
@@ -13,7 +13,7 @@ module Bandwidth
13
13
  @http_call_back = http_call_back
14
14
 
15
15
  @global_headers = {
16
- 'user-agent' => 'ruby-sdk-refs/tags/ruby3.2.0'
16
+ 'user-agent' => 'ruby-sdk-refs/tags/ruby3.7.0'
17
17
  }
18
18
  end
19
19
 
@@ -14,6 +14,7 @@ require_relative 'two_factor_auth/models/two_factor_verify_request_schema.rb'
14
14
  require_relative 'two_factor_auth/models/two_factor_verify_code_response.rb'
15
15
 
16
16
  # Exceptions
17
+ require_relative 'two_factor_auth/exceptions/invalid_request_exception.rb'
17
18
  # Controllers
18
19
  require_relative 'two_factor_auth/controllers/base_controller.rb'
19
20
  require_relative 'two_factor_auth/controllers/api_controller.rb'
@@ -22,7 +22,10 @@ module Bandwidth
22
22
  two_factor_auth_basic_auth_user_name: 'TODO: Replace',
23
23
  two_factor_auth_basic_auth_password: 'TODO: Replace',
24
24
  voice_basic_auth_user_name: 'TODO: Replace',
25
- voice_basic_auth_password: 'TODO: Replace', config: nil)
25
+ voice_basic_auth_password: 'TODO: Replace',
26
+ web_rtc_basic_auth_user_name: 'TODO: Replace',
27
+ web_rtc_basic_auth_password: 'TODO: Replace',
28
+ config: nil)
26
29
  @config = if config.nil?
27
30
  Configuration.new(timeout: timeout,
28
31
  max_retries: max_retries,
@@ -34,7 +37,9 @@ module Bandwidth
34
37
  two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
35
38
  two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
36
39
  voice_basic_auth_user_name: voice_basic_auth_user_name,
37
- voice_basic_auth_password: voice_basic_auth_password)
40
+ voice_basic_auth_password: voice_basic_auth_password,
41
+ web_rtc_basic_auth_user_name: web_rtc_basic_auth_user_name,
42
+ web_rtc_basic_auth_password: web_rtc_basic_auth_password)
38
43
  else
39
44
  config
40
45
  end
@@ -41,6 +41,14 @@ module TwoFactorAuth
41
41
  )
42
42
  TwoFactorAuthBasicAuth.apply(config, _request)
43
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
44
52
  validate_response(_response)
45
53
 
46
54
  # Return appropriate response type.
@@ -79,6 +87,14 @@ module TwoFactorAuth
79
87
  )
80
88
  TwoFactorAuthBasicAuth.apply(config, _request)
81
89
  _response = execute_request(_request)
90
+
91
+ # Validate response against endpoint and global error codes.
92
+ if _response.status_code == 400
93
+ raise InvalidRequestException.new(
94
+ 'client request error',
95
+ _response
96
+ )
97
+ end
82
98
  validate_response(_response)
83
99
 
84
100
  # Return appropriate response type.
@@ -117,6 +133,14 @@ module TwoFactorAuth
117
133
  )
118
134
  TwoFactorAuthBasicAuth.apply(config, _request)
119
135
  _response = execute_request(_request)
136
+
137
+ # Validate response against endpoint and global error codes.
138
+ if _response.status_code == 400
139
+ raise InvalidRequestException.new(
140
+ 'client request error',
141
+ _response
142
+ )
143
+ end
120
144
  validate_response(_response)
121
145
 
122
146
  # Return appropriate response type.
@@ -13,7 +13,7 @@ module Bandwidth
13
13
  @http_call_back = http_call_back
14
14
 
15
15
  @global_headers = {
16
- 'user-agent' => 'ruby-sdk-refs/tags/ruby3.2.0'
16
+ 'user-agent' => 'ruby-sdk-refs/tags/ruby3.7.0'
17
17
  }
18
18
  end
19
19
 
@@ -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
@@ -6,22 +6,38 @@
6
6
  module Bandwidth
7
7
  # TwoFactorCodeRequestSchema Model.
8
8
  class TwoFactorCodeRequestSchema < BaseModel
9
- # TODO: Write general description for this method
9
+ # The phone number to send the 2fa code to.
10
10
  # @return [String]
11
11
  attr_accessor :to
12
12
 
13
- # TODO: Write general description for this method
13
+ # The application phone number, the sender of the 2fa code.
14
14
  # @return [String]
15
15
  attr_accessor :from
16
16
 
17
- # TODO: Write general description for this method
17
+ # The application unique ID, obtained from Bandwidth.
18
18
  # @return [String]
19
19
  attr_accessor :application_id
20
20
 
21
- # TODO: Write general description for this method
21
+ # An optional field to denote what scope or action the 2fa code is
22
+ # addressing. If not supplied, defaults to "2FA".
22
23
  # @return [String]
23
24
  attr_accessor :scope
24
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
+
25
41
  # A mapping from model property names to API property names.
26
42
  def self.names
27
43
  @_hash = {} if @_hash.nil?
@@ -29,17 +45,23 @@ module Bandwidth
29
45
  @_hash['from'] = 'from'
30
46
  @_hash['application_id'] = 'applicationId'
31
47
  @_hash['scope'] = 'scope'
48
+ @_hash['message'] = 'message'
49
+ @_hash['digits'] = 'digits'
32
50
  @_hash
33
51
  end
34
52
 
35
53
  def initialize(to = nil,
36
54
  from = nil,
37
55
  application_id = nil,
56
+ message = nil,
57
+ digits = nil,
38
58
  scope = nil)
39
59
  @to = to
40
60
  @from = from
41
61
  @application_id = application_id
42
62
  @scope = scope
63
+ @message = message
64
+ @digits = digits
43
65
  end
44
66
 
45
67
  # Creates an instance of the object from a hash.
@@ -50,12 +72,16 @@ module Bandwidth
50
72
  to = hash['to']
51
73
  from = hash['from']
52
74
  application_id = hash['applicationId']
75
+ message = hash['message']
76
+ digits = hash['digits']
53
77
  scope = hash['scope']
54
78
 
55
79
  # Create object from extracted values.
56
80
  TwoFactorCodeRequestSchema.new(to,
57
81
  from,
58
82
  application_id,
83
+ message,
84
+ digits,
59
85
  scope)
60
86
  end
61
87
  end
@@ -6,23 +6,36 @@
6
6
  module Bandwidth
7
7
  # TwoFactorVerifyRequestSchema Model.
8
8
  class TwoFactorVerifyRequestSchema < BaseModel
9
- # TODO: Write general description for this method
9
+ # The phone number to send the 2fa code to.
10
10
  # @return [String]
11
11
  attr_accessor :to
12
12
 
13
- # TODO: Write general description for this method
13
+ # The application phone number, the sender of the 2fa code.
14
14
  # @return [String]
15
15
  attr_accessor :from
16
16
 
17
- # TODO: Write general description for this method
17
+ # The application unique ID, obtained from Bandwidth.
18
18
  # @return [String]
19
19
  attr_accessor :application_id
20
20
 
21
- # TODO: Write general description for this method
21
+ # An optional field to denote what scope or action the 2fa code is
22
+ # addressing. If not supplied, defaults to "2FA".
22
23
  # @return [String]
23
24
  attr_accessor :scope
24
25
 
25
- # TODO: Write general description for this method
26
+ # The number of digits for your 2fa code. The valid number ranges from 2 to
27
+ # 8, inclusively.
28
+ # @return [Float]
29
+ attr_accessor :digits
30
+
31
+ # The time period, in minutes, to validate the 2fa code. By setting this to
32
+ # 3 minutes, it will mean any code generated within the last 3 minutes are
33
+ # still valid. The valid range for expiration time is between 0 and 15
34
+ # minutes, exclusively and inclusively, respectively.
35
+ # @return [Float]
36
+ attr_accessor :expiration_time_in_minutes
37
+
38
+ # The generated 2fa code to check if valid
26
39
  # @return [String]
27
40
  attr_accessor :code
28
41
 
@@ -33,6 +46,8 @@ module Bandwidth
33
46
  @_hash['from'] = 'from'
34
47
  @_hash['application_id'] = 'applicationId'
35
48
  @_hash['scope'] = 'scope'
49
+ @_hash['digits'] = 'digits'
50
+ @_hash['expiration_time_in_minutes'] = 'expirationTimeInMinutes'
36
51
  @_hash['code'] = 'code'
37
52
  @_hash
38
53
  end
@@ -40,12 +55,16 @@ module Bandwidth
40
55
  def initialize(to = nil,
41
56
  from = nil,
42
57
  application_id = nil,
43
- scope = nil,
44
- code = nil)
58
+ digits = nil,
59
+ expiration_time_in_minutes = nil,
60
+ code = nil,
61
+ scope = nil)
45
62
  @to = to
46
63
  @from = from
47
64
  @application_id = application_id
48
65
  @scope = scope
66
+ @digits = digits
67
+ @expiration_time_in_minutes = expiration_time_in_minutes
49
68
  @code = code
50
69
  end
51
70
 
@@ -57,15 +76,19 @@ module Bandwidth
57
76
  to = hash['to']
58
77
  from = hash['from']
59
78
  application_id = hash['applicationId']
60
- scope = hash['scope']
79
+ digits = hash['digits']
80
+ expiration_time_in_minutes = hash['expirationTimeInMinutes']
61
81
  code = hash['code']
82
+ scope = hash['scope']
62
83
 
63
84
  # Create object from extracted values.
64
85
  TwoFactorVerifyRequestSchema.new(to,
65
86
  from,
66
87
  application_id,
67
- scope,
68
- code)
88
+ digits,
89
+ expiration_time_in_minutes,
90
+ code,
91
+ scope)
69
92
  end
70
93
  end
71
94
  end