bandwidth-sdk 3.0.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (22) hide show
  1. checksums.yaml +4 -4
  2. data/lib/bandwidth.rb +2 -1
  3. data/lib/bandwidth/client.rb +9 -0
  4. data/lib/bandwidth/configuration.rb +22 -4
  5. data/lib/bandwidth/http/auth/two_factor_auth_basic_auth.rb +22 -0
  6. data/lib/bandwidth/messaging_lib/messaging/client.rb +4 -0
  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 +19 -0
  9. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb +44 -0
  10. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +129 -0
  11. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +49 -0
  12. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb +62 -0
  13. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_messaging_response.rb +35 -0
  14. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_code_response.rb +35 -0
  15. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb +71 -0
  16. data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_voice_response.rb +35 -0
  17. data/lib/bandwidth/voice_lib/bxml/verbs/gather.rb +8 -0
  18. data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +2 -1
  19. data/lib/bandwidth/voice_lib/bxml/verbs/send_dtmf.rb +4 -1
  20. data/lib/bandwidth/voice_lib/voice/client.rb +4 -0
  21. data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
  22. metadata +14 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80138bdbd6672138cc92a5377acd770c7dcf06a327187c498111f207d27cb15c
4
- data.tar.gz: db58f2a2dd4195dfcf9cd5d85209021157eb5d49df8c01d48028814839839959
3
+ metadata.gz: db721efc4186c0731719649e2bde114ffc72d80b1ac76f4a072ba216232b10c1
4
+ data.tar.gz: bd2ee7c57603b5aad60d06f65093001fb72b7eb92527e34c425f8d7ba5d0ccf9
5
5
  SHA512:
6
- metadata.gz: c61848b0e1bbe13e31b813e87dd64e37588789b868785ae4f28ee9996abed6ea15d228290b1eb8e68099e0b9b02e1c75a60c06faf8f419ab4df3a527e6a4a6bb
7
- data.tar.gz: 77a0d973247f2fc116eb15e637a05d48931a3b433c2362e35f7747787bd0522797710237fd65a7d4b15261fd449ebd2604bea4244af2d767d44badb433903456
6
+ metadata.gz: d748d911c24f76ab1a83768f43fbcdb7ce291ec78029108516ec584efc5a1b5c78aefe1900c2bce269a362d38af246e68076775ed529d68b15833c9cd3ecd217
7
+ data.tar.gz: 2554808b7efba12a144353204518746df52313bb3c8296178fa1f5629301c00e1c12c6140615032a159c6f45986920292f9d63fc5d803d505df33c91ba7633d4
data/lib/bandwidth.rb CHANGED
@@ -35,8 +35,9 @@ require_relative 'bandwidth/configuration.rb'
35
35
  # Namespaces
36
36
  require_relative 'bandwidth/messaging_lib/messaging'
37
37
  require_relative 'bandwidth/http/auth/messaging_basic_auth.rb'
38
+ require_relative 'bandwidth/two_factor_auth_lib/two_factor_auth'
39
+ require_relative 'bandwidth/http/auth/two_factor_auth_basic_auth.rb'
38
40
  require_relative 'bandwidth/voice_lib/voice'
39
41
  require_relative 'bandwidth/http/auth/voice_basic_auth.rb'
40
42
 
41
-
42
43
  # Controllers
@@ -12,6 +12,11 @@ module Bandwidth
12
12
  def messaging_client
13
13
  @messaging_client ||= Messaging::Client.new(config: config)
14
14
  end
15
+ # Access to two_factor_auth_client controller.
16
+ # @return [TwoFactorAuth::Client] Returns the client instance.
17
+ def two_factor_auth_client
18
+ @two_factor_auth_client ||= TwoFactorAuth::Client.new(config: config)
19
+ end
15
20
  # Access to voice_client controller.
16
21
  # @return [Voice::Client] Returns the client instance.
17
22
  def voice_client
@@ -22,6 +27,8 @@ module Bandwidth
22
27
  backoff_factor: 1, environment: Environment::PRODUCTION,
23
28
  messaging_basic_auth_user_name: 'TODO: Replace',
24
29
  messaging_basic_auth_password: 'TODO: Replace',
30
+ two_factor_auth_basic_auth_user_name: 'TODO: Replace',
31
+ two_factor_auth_basic_auth_password: 'TODO: Replace',
25
32
  voice_basic_auth_user_name: 'TODO: Replace',
26
33
  voice_basic_auth_password: 'TODO: Replace', config: nil)
27
34
  @config = if config.nil?
@@ -31,6 +38,8 @@ module Bandwidth
31
38
  environment: environment,
32
39
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
33
40
  messaging_basic_auth_password: messaging_basic_auth_password,
41
+ two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
42
+ two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
34
43
  voice_basic_auth_user_name: voice_basic_auth_user_name,
35
44
  voice_basic_auth_password: voice_basic_auth_password)
36
45
  else
@@ -16,6 +16,7 @@ module Bandwidth
16
16
  SERVER = [
17
17
  DEFAULT = 'default'.freeze,
18
18
  MESSAGINGDEFAULT = 'MessagingDefault'.freeze,
19
+ TWOFACTORAUTHDEFAULT = 'TwoFactorAuthDefault'.freeze,
19
20
  VOICEDEFAULT = 'VoiceDefault'.freeze
20
21
  ].freeze
21
22
  end
@@ -32,6 +33,8 @@ module Bandwidth
32
33
  attr_reader :environment
33
34
  attr_reader :messaging_basic_auth_user_name
34
35
  attr_reader :messaging_basic_auth_password
36
+ attr_reader :two_factor_auth_basic_auth_user_name
37
+ attr_reader :two_factor_auth_basic_auth_password
35
38
  attr_reader :voice_basic_auth_user_name
36
39
  attr_reader :voice_basic_auth_password
37
40
 
@@ -43,6 +46,8 @@ module Bandwidth
43
46
  backoff_factor: 1, environment: Environment::PRODUCTION,
44
47
  messaging_basic_auth_user_name: 'TODO: Replace',
45
48
  messaging_basic_auth_password: 'TODO: Replace',
49
+ two_factor_auth_basic_auth_user_name: 'TODO: Replace',
50
+ two_factor_auth_basic_auth_password: 'TODO: Replace',
46
51
  voice_basic_auth_user_name: 'TODO: Replace',
47
52
  voice_basic_auth_password: 'TODO: Replace')
48
53
  # The value to use for connection timeout
@@ -59,7 +64,7 @@ module Bandwidth
59
64
  @backoff_factor = backoff_factor
60
65
 
61
66
  # Current API environment
62
- @environment = environment
67
+ @environment = String(environment)
63
68
 
64
69
  # The username to use with basic authentication
65
70
  @messaging_basic_auth_user_name = messaging_basic_auth_user_name
@@ -67,6 +72,12 @@ module Bandwidth
67
72
  # The password to use with basic authentication
68
73
  @messaging_basic_auth_password = messaging_basic_auth_password
69
74
 
75
+ # The username to use with basic authentication
76
+ @two_factor_auth_basic_auth_user_name = two_factor_auth_basic_auth_user_name
77
+
78
+ # The password to use with basic authentication
79
+ @two_factor_auth_basic_auth_password = two_factor_auth_basic_auth_password
80
+
70
81
  # The username to use with basic authentication
71
82
  @voice_basic_auth_user_name = voice_basic_auth_user_name
72
83
 
@@ -81,6 +92,8 @@ module Bandwidth
81
92
  backoff_factor: nil, environment: nil,
82
93
  messaging_basic_auth_user_name: nil,
83
94
  messaging_basic_auth_password: nil,
95
+ two_factor_auth_basic_auth_user_name: nil,
96
+ two_factor_auth_basic_auth_password: nil,
84
97
  voice_basic_auth_user_name: nil,
85
98
  voice_basic_auth_password: nil)
86
99
  timeout ||= self.timeout
@@ -90,6 +103,8 @@ module Bandwidth
90
103
  environment ||= self.environment
91
104
  messaging_basic_auth_user_name ||= self.messaging_basic_auth_user_name
92
105
  messaging_basic_auth_password ||= self.messaging_basic_auth_password
106
+ two_factor_auth_basic_auth_user_name ||= self.two_factor_auth_basic_auth_user_name
107
+ two_factor_auth_basic_auth_password ||= self.two_factor_auth_basic_auth_password
93
108
  voice_basic_auth_user_name ||= self.voice_basic_auth_user_name
94
109
  voice_basic_auth_password ||= self.voice_basic_auth_password
95
110
 
@@ -99,6 +114,8 @@ module Bandwidth
99
114
  environment: environment,
100
115
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
101
116
  messaging_basic_auth_password: messaging_basic_auth_password,
117
+ two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
118
+ two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
102
119
  voice_basic_auth_user_name: voice_basic_auth_user_name,
103
120
  voice_basic_auth_password: voice_basic_auth_password
104
121
  )
@@ -111,20 +128,21 @@ module Bandwidth
111
128
  end
112
129
 
113
130
  # All the environments the SDK can run in.
114
- @environments = {
131
+ ENVIRONMENTS = {
115
132
  Environment::PRODUCTION => {
116
133
  Server::DEFAULT => 'api.bandwidth.com',
117
134
  Server::MESSAGINGDEFAULT => 'https://messaging.bandwidth.com/api/v2',
135
+ Server::TWOFACTORAUTHDEFAULT => 'https://mfa.bandwidth.com/api/v1/',
118
136
  Server::VOICEDEFAULT => 'https://voice.bandwidth.com'
119
137
  }
120
- }
138
+ }.freeze
121
139
 
122
140
  # Generates the appropriate base URI for the environment and the server.
123
141
  # @param [Configuration::Server] The server enum for which the base URI is
124
142
  # required.
125
143
  # @return [String] The base URI.
126
144
  def get_base_uri(server = Server::DEFAULT)
127
- self.class.environments[environment][server].clone
145
+ ENVIRONMENTS[environment][server].clone
128
146
  end
129
147
  end
130
148
  end
@@ -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 TwoFactorAuthBasicAuth
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.two_factor_auth_basic_auth_user_name
16
+ password = config.two_factor_auth_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
@@ -19,6 +19,8 @@ module Bandwidth
19
19
  backoff_factor: 1, environment: Environment::PRODUCTION,
20
20
  messaging_basic_auth_user_name: 'TODO: Replace',
21
21
  messaging_basic_auth_password: 'TODO: Replace',
22
+ two_factor_auth_basic_auth_user_name: 'TODO: Replace',
23
+ two_factor_auth_basic_auth_password: 'TODO: Replace',
22
24
  voice_basic_auth_user_name: 'TODO: Replace',
23
25
  voice_basic_auth_password: 'TODO: Replace', config: nil)
24
26
  @config = if config.nil?
@@ -29,6 +31,8 @@ module Bandwidth
29
31
  environment: environment,
30
32
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
31
33
  messaging_basic_auth_password: messaging_basic_auth_password,
34
+ two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
35
+ two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
32
36
  voice_basic_auth_user_name: voice_basic_auth_user_name,
33
37
  voice_basic_auth_password: voice_basic_auth_password)
34
38
  else
@@ -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.0.0'
16
+ 'user-agent' => 'ruby-sdk-refs/tags/ruby3.3.0'
17
17
  }
18
18
  end
19
19
 
@@ -0,0 +1,19 @@
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
+ # Controllers
18
+ require_relative 'two_factor_auth/controllers/base_controller.rb'
19
+ require_relative 'two_factor_auth/controllers/api_controller.rb'
@@ -0,0 +1,44 @@
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
+ messaging_basic_auth_user_name: 'TODO: Replace',
21
+ messaging_basic_auth_password: 'TODO: Replace',
22
+ two_factor_auth_basic_auth_user_name: 'TODO: Replace',
23
+ two_factor_auth_basic_auth_password: 'TODO: Replace',
24
+ voice_basic_auth_user_name: 'TODO: Replace',
25
+ voice_basic_auth_password: 'TODO: Replace', config: nil)
26
+ @config = if config.nil?
27
+ Configuration.new(timeout: timeout,
28
+ max_retries: max_retries,
29
+ retry_interval: retry_interval,
30
+ backoff_factor: backoff_factor,
31
+ environment: environment,
32
+ messaging_basic_auth_user_name: messaging_basic_auth_user_name,
33
+ messaging_basic_auth_password: messaging_basic_auth_password,
34
+ two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
35
+ two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
36
+ voice_basic_auth_user_name: voice_basic_auth_user_name,
37
+ voice_basic_auth_password: voice_basic_auth_password)
38
+ else
39
+ config
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,129 @@
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' => account_id
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
+ validate_response(_response)
45
+
46
+ # Return appropriate response type.
47
+ decoded = APIHelper.json_deserialize(_response.raw_body)
48
+ ApiResponse.new(_response,
49
+ data: TwoFactorVoiceResponse.from_hash(decoded))
50
+ end
51
+
52
+ # Two-Factor authentication with Bandwidth messaging services
53
+ # @param [String] account_id Required parameter: Bandwidth Account ID with
54
+ # Messaging service enabled
55
+ # @param [TwoFactorCodeRequestSchema] body Required parameter: Example:
56
+ # @return [TwoFactorMessagingResponse] response from the API call
57
+ def create_messaging_two_factor(account_id,
58
+ body)
59
+ # Prepare query url.
60
+ _query_builder = config.get_base_uri(Server::TWOFACTORAUTHDEFAULT)
61
+ _query_builder << '/accounts/{accountId}/code/messaging'
62
+ _query_builder = APIHelper.append_url_with_template_parameters(
63
+ _query_builder,
64
+ 'accountId' => account_id
65
+ )
66
+ _query_url = APIHelper.clean_url _query_builder
67
+
68
+ # Prepare headers.
69
+ _headers = {
70
+ 'accept' => 'application/json',
71
+ 'content-type' => 'application/json; charset=utf-8'
72
+ }
73
+
74
+ # Prepare and execute HttpRequest.
75
+ _request = config.http_client.post(
76
+ _query_url,
77
+ headers: _headers,
78
+ parameters: body.to_json
79
+ )
80
+ TwoFactorAuthBasicAuth.apply(config, _request)
81
+ _response = execute_request(_request)
82
+ validate_response(_response)
83
+
84
+ # Return appropriate response type.
85
+ decoded = APIHelper.json_deserialize(_response.raw_body)
86
+ ApiResponse.new(_response,
87
+ data: TwoFactorMessagingResponse.from_hash(decoded))
88
+ end
89
+
90
+ # Verify a previously sent two-factor authentication code
91
+ # @param [String] account_id Required parameter: Bandwidth Account ID with
92
+ # Two-Factor enabled
93
+ # @param [TwoFactorVerifyRequestSchema] body Required parameter: Example:
94
+ # @return [TwoFactorVerifyCodeResponse] response from the API call
95
+ def create_verify_two_factor(account_id,
96
+ body)
97
+ # Prepare query url.
98
+ _query_builder = config.get_base_uri(Server::TWOFACTORAUTHDEFAULT)
99
+ _query_builder << '/accounts/{accountId}/code/verify'
100
+ _query_builder = APIHelper.append_url_with_template_parameters(
101
+ _query_builder,
102
+ 'accountId' => account_id
103
+ )
104
+ _query_url = APIHelper.clean_url _query_builder
105
+
106
+ # Prepare headers.
107
+ _headers = {
108
+ 'accept' => 'application/json',
109
+ 'content-type' => 'application/json; charset=utf-8'
110
+ }
111
+
112
+ # Prepare and execute HttpRequest.
113
+ _request = config.http_client.post(
114
+ _query_url,
115
+ headers: _headers,
116
+ parameters: body.to_json
117
+ )
118
+ TwoFactorAuthBasicAuth.apply(config, _request)
119
+ _response = execute_request(_request)
120
+ validate_response(_response)
121
+
122
+ # Return appropriate response type.
123
+ decoded = APIHelper.json_deserialize(_response.raw_body)
124
+ ApiResponse.new(_response,
125
+ data: TwoFactorVerifyCodeResponse.from_hash(decoded))
126
+ end
127
+ end
128
+ end
129
+ 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.3.0'
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
@@ -0,0 +1,62 @@
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
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :to
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :from
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :application_id
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :scope
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['to'] = 'to'
29
+ @_hash['from'] = 'from'
30
+ @_hash['application_id'] = 'applicationId'
31
+ @_hash['scope'] = 'scope'
32
+ @_hash
33
+ end
34
+
35
+ def initialize(to = nil,
36
+ from = nil,
37
+ application_id = nil,
38
+ scope = nil)
39
+ @to = to
40
+ @from = from
41
+ @application_id = application_id
42
+ @scope = scope
43
+ end
44
+
45
+ # Creates an instance of the object from a hash.
46
+ def self.from_hash(hash)
47
+ return nil unless hash
48
+
49
+ # Extract variables from the hash.
50
+ to = hash['to']
51
+ from = hash['from']
52
+ application_id = hash['applicationId']
53
+ scope = hash['scope']
54
+
55
+ # Create object from extracted values.
56
+ TwoFactorCodeRequestSchema.new(to,
57
+ from,
58
+ application_id,
59
+ scope)
60
+ end
61
+ end
62
+ end
@@ -0,0 +1,35 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # TwoFactorMessagingResponse Model.
8
+ class TwoFactorMessagingResponse < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :message_id
12
+
13
+ # A mapping from model property names to API property names.
14
+ def self.names
15
+ @_hash = {} if @_hash.nil?
16
+ @_hash['message_id'] = 'messageId'
17
+ @_hash
18
+ end
19
+
20
+ def initialize(message_id = nil)
21
+ @message_id = message_id
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ message_id = hash['messageId']
30
+
31
+ # Create object from extracted values.
32
+ TwoFactorMessagingResponse.new(message_id)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,35 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # TwoFactorVerifyCodeResponse Model.
8
+ class TwoFactorVerifyCodeResponse < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [Boolean]
11
+ attr_accessor :valid
12
+
13
+ # A mapping from model property names to API property names.
14
+ def self.names
15
+ @_hash = {} if @_hash.nil?
16
+ @_hash['valid'] = 'valid'
17
+ @_hash
18
+ end
19
+
20
+ def initialize(valid = nil)
21
+ @valid = valid
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ valid = hash['valid']
30
+
31
+ # Create object from extracted values.
32
+ TwoFactorVerifyCodeResponse.new(valid)
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,71 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # TwoFactorVerifyRequestSchema Model.
8
+ class TwoFactorVerifyRequestSchema < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :to
12
+
13
+ # TODO: Write general description for this method
14
+ # @return [String]
15
+ attr_accessor :from
16
+
17
+ # TODO: Write general description for this method
18
+ # @return [String]
19
+ attr_accessor :application_id
20
+
21
+ # TODO: Write general description for this method
22
+ # @return [String]
23
+ attr_accessor :scope
24
+
25
+ # TODO: Write general description for this method
26
+ # @return [String]
27
+ attr_accessor :code
28
+
29
+ # A mapping from model property names to API property names.
30
+ def self.names
31
+ @_hash = {} if @_hash.nil?
32
+ @_hash['to'] = 'to'
33
+ @_hash['from'] = 'from'
34
+ @_hash['application_id'] = 'applicationId'
35
+ @_hash['scope'] = 'scope'
36
+ @_hash['code'] = 'code'
37
+ @_hash
38
+ end
39
+
40
+ def initialize(to = nil,
41
+ from = nil,
42
+ application_id = nil,
43
+ scope = nil,
44
+ code = nil)
45
+ @to = to
46
+ @from = from
47
+ @application_id = application_id
48
+ @scope = scope
49
+ @code = code
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ to = hash['to']
58
+ from = hash['from']
59
+ application_id = hash['applicationId']
60
+ scope = hash['scope']
61
+ code = hash['code']
62
+
63
+ # Create object from extracted values.
64
+ TwoFactorVerifyRequestSchema.new(to,
65
+ from,
66
+ application_id,
67
+ scope,
68
+ code)
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,35 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module Bandwidth
7
+ # TwoFactorVoiceResponse Model.
8
+ class TwoFactorVoiceResponse < BaseModel
9
+ # TODO: Write general description for this method
10
+ # @return [String]
11
+ attr_accessor :call_id
12
+
13
+ # A mapping from model property names to API property names.
14
+ def self.names
15
+ @_hash = {} if @_hash.nil?
16
+ @_hash['call_id'] = 'callId'
17
+ @_hash
18
+ end
19
+
20
+ def initialize(call_id = nil)
21
+ @call_id = call_id
22
+ end
23
+
24
+ # Creates an instance of the object from a hash.
25
+ def self.from_hash(hash)
26
+ return nil unless hash
27
+
28
+ # Extract variables from the hash.
29
+ call_id = hash['callId']
30
+
31
+ # Create object from extracted values.
32
+ TwoFactorVoiceResponse.new(call_id)
33
+ end
34
+ end
35
+ end
@@ -28,8 +28,16 @@ module Bandwidth
28
28
  s.to_bxml(xml)
29
29
  end
30
30
  end
31
+ def nest_verbs_list(xml, property)
32
+ if property
33
+ property.each do |verb|
34
+ verb.to_bxml(xml)
35
+ end
36
+ end
37
+ end
31
38
  embedded_xml(xml, speak_sentence, SpeakSentence)
32
39
  embedded_xml(xml, play_audio, PlayAudio)
40
+ nest_verbs_list(xml, nested_verbs)
33
41
  end
34
42
  end
35
43
  end
@@ -20,7 +20,8 @@ module Bandwidth
20
20
  'fileFormat' => file_format,
21
21
  'transcribe' => transcribe,
22
22
  'transcriptionAvailableUrl' => transcription_available_url,
23
- 'transcriptionAvailableMethod' => transcription_available_method
23
+ 'transcriptionAvailableMethod' => transcription_available_method,
24
+ 'silenceTimeout' => silence_timeout
24
25
  }))
25
26
  end
26
27
  end
@@ -6,7 +6,10 @@ module Bandwidth
6
6
  include XmlVerb
7
7
 
8
8
  def to_bxml(xml)
9
- xml.SendDtmf(dtmf)
9
+ xml.SendDtmf(dtmf, compact_hash({
10
+ 'toneDuration' => tone_duration,
11
+ 'toneInterval' => tone_interval
12
+ }))
10
13
  end
11
14
  end
12
15
  end
@@ -19,6 +19,8 @@ module Bandwidth
19
19
  backoff_factor: 1, environment: Environment::PRODUCTION,
20
20
  messaging_basic_auth_user_name: 'TODO: Replace',
21
21
  messaging_basic_auth_password: 'TODO: Replace',
22
+ two_factor_auth_basic_auth_user_name: 'TODO: Replace',
23
+ two_factor_auth_basic_auth_password: 'TODO: Replace',
22
24
  voice_basic_auth_user_name: 'TODO: Replace',
23
25
  voice_basic_auth_password: 'TODO: Replace', config: nil)
24
26
  @config = if config.nil?
@@ -29,6 +31,8 @@ module Bandwidth
29
31
  environment: environment,
30
32
  messaging_basic_auth_user_name: messaging_basic_auth_user_name,
31
33
  messaging_basic_auth_password: messaging_basic_auth_password,
34
+ two_factor_auth_basic_auth_user_name: two_factor_auth_basic_auth_user_name,
35
+ two_factor_auth_basic_auth_password: two_factor_auth_basic_auth_password,
32
36
  voice_basic_auth_user_name: voice_basic_auth_user_name,
33
37
  voice_basic_auth_password: voice_basic_auth_password)
34
38
  else
@@ -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.0.0'
16
+ 'user-agent' => 'ruby-sdk-refs/tags/ruby3.3.0'
17
17
  }
18
18
  end
19
19
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bandwidth-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - APIMatic SDK Generator
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-03 00:00:00.000000000 Z
11
+ date: 2020-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -72,14 +72,14 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 2.0.0
75
+ version: '2.0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 2.0.0
82
+ version: '2.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: builder
85
85
  requirement: !ruby/object:Gem::Requirement
@@ -109,6 +109,7 @@ files:
109
109
  - lib/bandwidth/exceptions/api_exception.rb
110
110
  - lib/bandwidth/http/api_response.rb
111
111
  - lib/bandwidth/http/auth/messaging_basic_auth.rb
112
+ - lib/bandwidth/http/auth/two_factor_auth_basic_auth.rb
112
113
  - lib/bandwidth/http/auth/voice_basic_auth.rb
113
114
  - lib/bandwidth/http/faraday_client.rb
114
115
  - lib/bandwidth/http/http_call_back.rb
@@ -128,6 +129,15 @@ files:
128
129
  - lib/bandwidth/messaging_lib/messaging/models/message_request.rb
129
130
  - lib/bandwidth/messaging_lib/messaging/models/tag.rb
130
131
  - lib/bandwidth/models/base_model.rb
132
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb
133
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb
134
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb
135
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb
136
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb
137
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_messaging_response.rb
138
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_code_response.rb
139
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb
140
+ - lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_voice_response.rb
131
141
  - lib/bandwidth/utilities/file_wrapper.rb
132
142
  - lib/bandwidth/voice_lib/bxml/bxml.rb
133
143
  - lib/bandwidth/voice_lib/bxml/verbs/forward.rb