bandwidth-sdk 3.4.0 → 3.5.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/messaging_lib/messaging/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +1 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb +24 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb +1 -1
- 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 +30 -4
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb +33 -10
- data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48115c5ef2d3c4b9f64d4ef6afce6b6ecb94cdde4b445afb21fc4c1819b079c0
|
4
|
+
data.tar.gz: d9f295c220a2ac75b090ca8a419a1ae2375779119d9cb4bd7a14d09f0f5fed93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e0d4a309e16b781e6e020688cc1ab153b171aa6a9f59e1e34ddaa81d442c851623cae0a4fdc9d081d62623cee0935277e28265b8da883c7dc2a66aab0c762093
|
7
|
+
data.tar.gz: d2c7435d3f124001aa11bc8c610336086309b511e65c9744d3007082b03b812c7c14e200005774b5d078b3fb512e62fa483218d7855791efd8206b6868531fc9
|
@@ -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'
|
@@ -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.
|
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
CHANGED
@@ -6,22 +6,38 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# TwoFactorCodeRequestSchema Model.
|
8
8
|
class TwoFactorCodeRequestSchema < BaseModel
|
9
|
-
#
|
9
|
+
# The phone number to send the 2fa code to.
|
10
10
|
# @return [String]
|
11
11
|
attr_accessor :to
|
12
12
|
|
13
|
-
#
|
13
|
+
# The application phone number, the sender of the 2fa code.
|
14
14
|
# @return [String]
|
15
15
|
attr_accessor :from
|
16
16
|
|
17
|
-
#
|
17
|
+
# The application unique ID, obtained from Bandwidth.
|
18
18
|
# @return [String]
|
19
19
|
attr_accessor :application_id
|
20
20
|
|
21
|
-
#
|
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
|
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb
CHANGED
@@ -6,23 +6,36 @@
|
|
6
6
|
module Bandwidth
|
7
7
|
# TwoFactorVerifyRequestSchema Model.
|
8
8
|
class TwoFactorVerifyRequestSchema < BaseModel
|
9
|
-
#
|
9
|
+
# The phone number to send the 2fa code to.
|
10
10
|
# @return [String]
|
11
11
|
attr_accessor :to
|
12
12
|
|
13
|
-
#
|
13
|
+
# The application phone number, the sender of the 2fa code.
|
14
14
|
# @return [String]
|
15
15
|
attr_accessor :from
|
16
16
|
|
17
|
-
#
|
17
|
+
# The application unique ID, obtained from Bandwidth.
|
18
18
|
# @return [String]
|
19
19
|
attr_accessor :application_id
|
20
20
|
|
21
|
-
#
|
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
|
-
#
|
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
|
-
|
44
|
-
|
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
|
-
|
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
|
-
|
68
|
-
|
88
|
+
digits,
|
89
|
+
expiration_time_in_minutes,
|
90
|
+
code,
|
91
|
+
scope)
|
69
92
|
end
|
70
93
|
end
|
71
94
|
end
|
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.
|
4
|
+
version: 3.5.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-06-
|
11
|
+
date: 2020-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: logging
|
@@ -133,6 +133,7 @@ files:
|
|
133
133
|
- lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb
|
134
134
|
- lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/api_controller.rb
|
135
135
|
- lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb
|
136
|
+
- lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/invalid_request_exception.rb
|
136
137
|
- lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_code_request_schema.rb
|
137
138
|
- lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_messaging_response.rb
|
138
139
|
- lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_code_response.rb
|