bandwidth-sdk 2.1.1 → 6.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE +1 -1
- data/README.md +85 -70
- data/lib/bandwidth.rb +31 -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/api_response.rb +2 -0
- 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/http/faraday_client.rb +5 -2
- data/lib/bandwidth/messaging_lib/messaging.rb +5 -3
- data/lib/bandwidth/messaging_lib/messaging/client.rb +13 -2
- data/lib/bandwidth/messaging_lib/messaging/controllers/api_controller.rb +191 -113
- 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/messaging_lib/messaging/models/bandwidth_message.rb +23 -13
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_message_item.rb +125 -0
- data/lib/bandwidth/messaging_lib/messaging/models/bandwidth_messages_list.rb +60 -0
- data/lib/bandwidth/messaging_lib/messaging/models/media.rb +4 -4
- data/lib/bandwidth/messaging_lib/messaging/models/message_request.rb +21 -8
- data/lib/bandwidth/messaging_lib/messaging/models/page_info.rb +62 -0
- data/lib/bandwidth/messaging_lib/messaging/models/priority_enum.rb +19 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb +22 -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/base_controller.rb +49 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/mfa_controller.rb +209 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/error_with_request_exception.rb +34 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/forbidden_request_exception.rb +29 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/unauthorized_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 +75 -0
- data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_voice_response.rb +35 -0
- data/lib/bandwidth/utilities/file_wrapper.rb +17 -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 +7 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/record.rb +9 -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/sip_uri.rb +25 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/start_gather.rb +20 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/start_recording.rb +4 -1
- data/lib/bandwidth/voice_lib/bxml/verbs/stop_gather.rb +14 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/tag.rb +13 -0
- data/lib/bandwidth/voice_lib/bxml/verbs/transfer.rb +14 -3
- data/lib/bandwidth/voice_lib/voice.rb +19 -4
- data/lib/bandwidth/voice_lib/voice/client.rb +13 -2
- data/lib/bandwidth/voice_lib/voice/controllers/api_controller.rb +1219 -133
- data/lib/bandwidth/voice_lib/voice/controllers/base_controller.rb +1 -1
- data/lib/bandwidth/voice_lib/voice/exceptions/{error_response_exception.rb → api_error_response_exception.rb} +3 -3
- 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 +56 -2
- data/lib/bandwidth/voice_lib/voice/models/api_call_state_response.rb +164 -0
- data/lib/bandwidth/voice_lib/voice/models/api_create_call_request.rb +135 -12
- data/lib/bandwidth/voice_lib/voice/models/api_modify_call_request.rb +37 -1
- data/lib/bandwidth/voice_lib/voice/models/api_modify_conference_request.rb +107 -0
- data/lib/bandwidth/voice_lib/voice/models/api_transcribe_recording_request.rb +80 -0
- data/lib/bandwidth/voice_lib/voice/models/callback_method_enum.rb +35 -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 +47 -0
- data/lib/bandwidth/voice_lib/voice/models/modify_call_recording_state.rb +1 -1
- data/lib/bandwidth/voice_lib/voice/models/recording_metadata_response.rb +66 -28
- data/lib/bandwidth/voice_lib/voice/models/redirect_fallback_method_enum.rb +17 -0
- data/lib/bandwidth/voice_lib/voice/models/state1_enum.rb +4 -7
- data/lib/bandwidth/voice_lib/voice/models/state2_enum.rb +20 -0
- data/lib/bandwidth/voice_lib/voice/models/state_enum.rb +7 -4
- data/lib/bandwidth/voice_lib/voice/models/status1_enum.rb +29 -0
- data/lib/bandwidth/voice_lib/voice/models/status3_enum.rb +32 -0
- data/lib/bandwidth/voice_lib/voice/models/status_enum.rb +17 -0
- data/lib/bandwidth/{messaging_lib/messaging/models/field_error.rb → voice_lib/voice/models/transcript.rb} +15 -15
- data/lib/bandwidth/voice_lib/voice/models/transcription.rb +62 -0
- data/lib/bandwidth/voice_lib/voice/models/transcription_response.rb +42 -0
- data/lib/bandwidth/web_rtc_lib/utils/web_rtc_transfer.rb +13 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc.rb +22 -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/device_api_version_enum.rb +17 -0
- data/lib/bandwidth/web_rtc_lib/web_rtc/models/participant.rb +92 -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
- data/test/integration/test_integration.rb +570 -0
- metadata +132 -19
- data/lib/bandwidth/voice_lib/voice/models/api_get_account_recordings_metadata_request.rb +0 -65
- data/lib/bandwidth/voice_lib/voice/models/transcription_status_enum.rb +0 -20
- data/lib/bandwidth/voice_lib/voice/models/type_enum.rb +0 -32
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/forbidden_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
|
+
# ForbiddenRequest class.
|
8
|
+
class ForbiddenRequestException < APIException
|
9
|
+
# The message containing the reason behind the request being forbidden
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :message
|
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
|
+
@message = hash['Message']
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/exceptions/unauthorized_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
|
+
# UnauthorizedRequest class.
|
8
|
+
class UnauthorizedRequestException < APIException
|
9
|
+
# The message containing the reason behind the request being unauthorized
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :message
|
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
|
+
@message = hash['message']
|
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
|
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_messaging_response.rb
ADDED
@@ -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
|
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_code_response.rb
ADDED
@@ -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
|
data/lib/bandwidth/two_factor_auth_lib/two_factor_auth/models/two_factor_verify_request_schema.rb
ADDED
@@ -0,0 +1,75 @@
|
|
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
|
+
# The phone number to send the 2fa code to.
|
10
|
+
# @return [String]
|
11
|
+
attr_accessor :to
|
12
|
+
|
13
|
+
# The application unique ID, obtained from Bandwidth.
|
14
|
+
# @return [String]
|
15
|
+
attr_accessor :application_id
|
16
|
+
|
17
|
+
# An optional field to denote what scope or action the 2fa code is
|
18
|
+
# addressing. If not supplied, defaults to "2FA".
|
19
|
+
# @return [String]
|
20
|
+
attr_accessor :scope
|
21
|
+
|
22
|
+
# The time period, in minutes, to validate the 2fa code. By setting this to
|
23
|
+
# 3 minutes, it will mean any code generated within the last 3 minutes are
|
24
|
+
# still valid. The valid range for expiration time is between 0 and 15
|
25
|
+
# minutes, exclusively and inclusively, respectively.
|
26
|
+
# @return [Float]
|
27
|
+
attr_accessor :expiration_time_in_minutes
|
28
|
+
|
29
|
+
# The generated 2fa code to check if valid
|
30
|
+
# @return [String]
|
31
|
+
attr_accessor :code
|
32
|
+
|
33
|
+
# A mapping from model property names to API property names.
|
34
|
+
def self.names
|
35
|
+
@_hash = {} if @_hash.nil?
|
36
|
+
@_hash['to'] = 'to'
|
37
|
+
@_hash['application_id'] = 'applicationId'
|
38
|
+
@_hash['scope'] = 'scope'
|
39
|
+
@_hash['expiration_time_in_minutes'] = 'expirationTimeInMinutes'
|
40
|
+
@_hash['code'] = 'code'
|
41
|
+
@_hash
|
42
|
+
end
|
43
|
+
|
44
|
+
def initialize(to = nil,
|
45
|
+
application_id = nil,
|
46
|
+
expiration_time_in_minutes = nil,
|
47
|
+
code = nil,
|
48
|
+
scope = nil)
|
49
|
+
@to = to
|
50
|
+
@application_id = application_id
|
51
|
+
@scope = scope
|
52
|
+
@expiration_time_in_minutes = expiration_time_in_minutes
|
53
|
+
@code = code
|
54
|
+
end
|
55
|
+
|
56
|
+
# Creates an instance of the object from a hash.
|
57
|
+
def self.from_hash(hash)
|
58
|
+
return nil unless hash
|
59
|
+
|
60
|
+
# Extract variables from the hash.
|
61
|
+
to = hash['to']
|
62
|
+
application_id = hash['applicationId']
|
63
|
+
expiration_time_in_minutes = hash['expirationTimeInMinutes']
|
64
|
+
code = hash['code']
|
65
|
+
scope = hash['scope']
|
66
|
+
|
67
|
+
# Create object from extracted values.
|
68
|
+
TwoFactorVerifyRequestSchema.new(to,
|
69
|
+
application_id,
|
70
|
+
expiration_time_in_minutes,
|
71
|
+
code,
|
72
|
+
scope)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
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
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# bandwidth
|
2
|
+
#
|
3
|
+
# This file was automatically generated by APIMATIC v2.0
|
4
|
+
# ( https://apimatic.io ).
|
5
|
+
|
6
|
+
module Bandwidth
|
7
|
+
# A utility to allow users to set the content-type for files
|
8
|
+
class FileWrapper
|
9
|
+
attr_reader :content_type
|
10
|
+
attr_reader :file
|
11
|
+
|
12
|
+
def initialize(file, content_type: 'application/octet-stream')
|
13
|
+
@file = file
|
14
|
+
@content_type = content_type
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require_relative 'xml_verb'
|
2
|
+
|
3
|
+
module Bandwidth
|
4
|
+
module Voice
|
5
|
+
# The Bridge verb allows you to connect 2 calls
|
6
|
+
class Bridge
|
7
|
+
include XmlVerb
|
8
|
+
|
9
|
+
def to_bxml(xml)
|
10
|
+
xml.Bridge(call_id, compact_hash({
|
11
|
+
'bridgeCompleteUrl' => bridge_complete_url,
|
12
|
+
'bridgeCompleteMethod' => bridge_complete_method,
|
13
|
+
'bridgeTargetCompleteUrl' => bridge_target_complete_url,
|
14
|
+
'bridgeTargetCompleteMethod' => bridge_target_complete_method,
|
15
|
+
'username' => username,
|
16
|
+
'password' => password,
|
17
|
+
'tag' => tag,
|
18
|
+
'bridgeCompleteFallbackUrl' => bridge_complete_fallback_url,
|
19
|
+
'bridgeCompleteFallbackMethod' => bridge_complete_fallback_method,
|
20
|
+
'bridgeTargetCompleteFallbackUrl' => bridge_target_complete_fallback_url,
|
21
|
+
'bridgeTargetCompleteFallbackMethod' => bridge_target_complete_fallback_method,
|
22
|
+
'fallbackUsername' => fallback_username,
|
23
|
+
'fallbackPassword' => fallback_password
|
24
|
+
}))
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative 'xml_verb'
|
2
|
+
|
3
|
+
module Bandwidth
|
4
|
+
module Voice
|
5
|
+
# The Conference verb is used to add callees to conferences
|
6
|
+
class Conference
|
7
|
+
include XmlVerb
|
8
|
+
|
9
|
+
def to_bxml(xml)
|
10
|
+
if not call_ids_to_coach.nil?
|
11
|
+
coach_ids = call_ids_to_coach.instance_of?(String) ? call_ids_to_coach : call_ids_to_coach.join(",")
|
12
|
+
else
|
13
|
+
coach_ids = nil
|
14
|
+
end
|
15
|
+
xml.Conference(conference_name, compact_hash({
|
16
|
+
'mute' => mute,
|
17
|
+
'hold' => hold,
|
18
|
+
'callIdsToCoach' => coach_ids,
|
19
|
+
'conferenceEventUrl' => conference_event_url,
|
20
|
+
'conferenceEventMethod' => conference_event_method,
|
21
|
+
'username' => username,
|
22
|
+
'password' => password,
|
23
|
+
'tag' => tag,
|
24
|
+
'conferenceEventFallbackUrl' => conference_event_fallback_url,
|
25
|
+
'conferenceEventFallbackMethod' => conference_event_fallback_method,
|
26
|
+
'fallbackUsername' => fallback_username,
|
27
|
+
'fallbackPassword' => fallback_password
|
28
|
+
}))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -17,7 +17,11 @@ module Bandwidth
|
|
17
17
|
'username' => username,
|
18
18
|
'password' => password,
|
19
19
|
'firstDigitTimeout' => first_digit_timeout,
|
20
|
-
'repeatCount' => repeat_count
|
20
|
+
'repeatCount' => repeat_count,
|
21
|
+
'gatherFallbackUrl' => gather_fallback_url,
|
22
|
+
'gatherFallbackMethod' => gather_fallback_method,
|
23
|
+
'fallbackUsername' => fallback_username,
|
24
|
+
'fallbackPassword' => fallback_password
|
21
25
|
})) do
|
22
26
|
def embedded_xml(xml, property, type)
|
23
27
|
if property
|
@@ -28,8 +32,16 @@ module Bandwidth
|
|
28
32
|
s.to_bxml(xml)
|
29
33
|
end
|
30
34
|
end
|
35
|
+
def nest_verbs_list(xml, property)
|
36
|
+
if property
|
37
|
+
property.each do |verb|
|
38
|
+
verb.to_bxml(xml)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
31
42
|
embedded_xml(xml, speak_sentence, SpeakSentence)
|
32
43
|
embedded_xml(xml, play_audio, PlayAudio)
|
44
|
+
nest_verbs_list(xml, nested_verbs)
|
33
45
|
end
|
34
46
|
end
|
35
47
|
end
|