bandwidth-sdk 16.2.2 → 17.0.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +9 -9
- data/README.md +31 -10
- data/bandwidth.yml +629 -299
- data/coverage/.last_run.json +1 -1
- data/coverage/.resultset.json +241 -119
- data/coverage/index.html +2752 -1364
- data/docs/AsyncLookupRequest.md +18 -0
- data/docs/{LookupRequest.md → CompletedLookupStatusEnum.md} +2 -5
- data/docs/CreateAsyncBulkLookupResponse.md +22 -0
- data/docs/{CreateLookupResponse.md → CreateAsyncBulkLookupResponseData.md} +4 -4
- data/docs/CreateSyncLookupResponse.md +22 -0
- data/docs/CreateSyncLookupResponseData.md +22 -0
- data/docs/DeactivationEventEnum.md +15 -0
- data/docs/GetAsyncBulkLookupResponse.md +22 -0
- data/docs/GetAsyncBulkLookupResponseData.md +22 -0
- data/docs/InProgressLookupStatusEnum.md +15 -0
- data/docs/LatestMessageDeliveryStatusEnum.md +15 -0
- data/docs/{LookupStatusEnum.md → LineTypeEnum.md} +2 -2
- data/docs/LinkSchema.md +22 -0
- data/docs/LookupErrorResponse.md +22 -0
- data/docs/LookupErrorSchema.md +24 -0
- data/docs/LookupErrorSchemaMeta.md +22 -0
- data/docs/LookupResult.md +22 -18
- data/docs/MultiChannelAction.md +32 -81
- data/docs/MultiChannelApi.md +1 -1
- data/docs/{MultiChannelChannelListObject.md → MultiChannelChannelListMMSObject.md} +3 -3
- data/docs/{MultiChannelMessageResponseDataChannelListInner.md → MultiChannelChannelListMMSResponseObject.md} +3 -3
- data/docs/MultiChannelChannelListObjectBase.md +22 -0
- data/docs/MultiChannelChannelListOwnerObject.md +18 -0
- data/docs/MultiChannelChannelListRBMObject.md +24 -0
- data/docs/{MultiChannelChannelListObjectContent.md → MultiChannelChannelListRBMObjectAllOfContent.md} +6 -10
- data/docs/MultiChannelChannelListRBMResponseObject.md +26 -0
- data/docs/MultiChannelChannelListRequestObject.md +24 -0
- data/docs/MultiChannelChannelListResponseObject.md +26 -0
- data/docs/MultiChannelChannelListSMSObject.md +24 -0
- data/docs/MultiChannelChannelListSMSResponseObject.md +26 -0
- data/docs/MultiChannelMessageRequest.md +1 -1
- data/docs/MultiChannelMessageResponseData.md +1 -1
- data/docs/PhoneNumberLookupApi.md +111 -38
- data/docs/RbmActionBase.md +1 -1
- data/docs/RbmSuggestionResponse.md +1 -1
- data/docs/SyncLookupRequest.md +18 -0
- data/lib/bandwidth-sdk/api/phone_number_lookup_api.rb +117 -47
- data/lib/bandwidth-sdk/configuration.rb +10 -4
- data/lib/bandwidth-sdk/models/async_lookup_request.rb +232 -0
- data/lib/bandwidth-sdk/models/completed_lookup_status_enum.rb +41 -0
- data/lib/bandwidth-sdk/models/create_async_bulk_lookup_response.rb +235 -0
- data/lib/bandwidth-sdk/models/{create_lookup_response.rb → create_async_bulk_lookup_response_data.rb} +5 -5
- data/lib/bandwidth-sdk/models/create_sync_lookup_response.rb +234 -0
- data/lib/bandwidth-sdk/models/{lookup_status.rb → create_sync_lookup_response_data.rb} +15 -27
- data/lib/bandwidth-sdk/models/deactivation_event_enum.rb +39 -0
- data/lib/bandwidth-sdk/models/get_async_bulk_lookup_response.rb +234 -0
- data/lib/bandwidth-sdk/models/get_async_bulk_lookup_response_data.rb +257 -0
- data/lib/bandwidth-sdk/models/{lookup_status_enum.rb → in_progress_lookup_status_enum.rb} +3 -3
- data/lib/bandwidth-sdk/models/latest_message_delivery_status_enum.rb +41 -0
- data/lib/bandwidth-sdk/models/line_type_enum.rb +42 -0
- data/lib/bandwidth-sdk/models/{tn_lookup_request_error.rb → link_schema.rb} +31 -11
- data/lib/bandwidth-sdk/models/lookup_error_response.rb +235 -0
- data/lib/bandwidth-sdk/models/lookup_error_schema.rb +242 -0
- data/lib/bandwidth-sdk/models/lookup_error_schema_meta.rb +234 -0
- data/lib/bandwidth-sdk/models/lookup_result.rb +102 -63
- data/lib/bandwidth-sdk/models/multi_channel_action.rb +71 -26
- data/lib/bandwidth-sdk/models/{multi_channel_channel_list_object.rb → multi_channel_channel_list_mms_object.rb} +11 -4
- data/lib/bandwidth-sdk/models/{multi_channel_message_response_data_channel_list_inner.rb → multi_channel_channel_list_mms_response_object.rb} +6 -5
- data/lib/bandwidth-sdk/models/multi_channel_channel_list_object_base.rb +275 -0
- data/lib/bandwidth-sdk/models/{lookup_request.rb → multi_channel_channel_list_owner_object.rb} +15 -17
- data/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_object.rb +298 -0
- data/lib/bandwidth-sdk/models/{multi_channel_channel_list_object_content.rb → multi_channel_channel_list_rbm_object_all_of_content.rb} +2 -4
- data/lib/bandwidth-sdk/models/multi_channel_channel_list_rbm_response_object.rb +316 -0
- data/lib/bandwidth-sdk/models/multi_channel_channel_list_request_object.rb +104 -0
- data/lib/bandwidth-sdk/models/multi_channel_channel_list_response_object.rb +104 -0
- data/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_object.rb +298 -0
- data/lib/bandwidth-sdk/models/multi_channel_channel_list_sms_response_object.rb +316 -0
- data/lib/bandwidth-sdk/models/multi_channel_message_request.rb +1 -1
- data/lib/bandwidth-sdk/models/multi_channel_message_response_data.rb +1 -1
- data/lib/bandwidth-sdk/models/sync_lookup_request.rb +232 -0
- data/lib/bandwidth-sdk/version.rb +1 -1
- data/lib/bandwidth-sdk.rb +28 -8
- data/spec/smoke/multi_channel_api_spec.rb +125 -24
- data/spec/smoke/phone_number_lookup_api_spec.rb +65 -70
- data/spec/unit/api/multi_channel_api_spec.rb +13 -2
- data/spec/unit/api/phone_number_lookup_api_spec.rb +71 -56
- metadata +58 -18
- data/docs/LookupStatus.md +0 -24
- data/docs/TnLookupRequestError.md +0 -18
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
=begin
|
|
2
|
+
#Bandwidth
|
|
3
|
+
|
|
4
|
+
#Bandwidth's Communication APIs
|
|
5
|
+
|
|
6
|
+
The version of the OpenAPI document: 1.0.0
|
|
7
|
+
Contact: letstalk@bandwidth.com
|
|
8
|
+
Generated by: https://openapi-generator.tech
|
|
9
|
+
Generator version: 7.8.0
|
|
10
|
+
|
|
11
|
+
=end
|
|
12
|
+
|
|
13
|
+
require 'date'
|
|
14
|
+
require 'time'
|
|
15
|
+
|
|
16
|
+
module Bandwidth
|
|
17
|
+
class SyncLookupRequest
|
|
18
|
+
# Telephone numbers in E.164 format.
|
|
19
|
+
attr_accessor :phone_numbers
|
|
20
|
+
|
|
21
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
22
|
+
def self.attribute_map
|
|
23
|
+
{
|
|
24
|
+
:'phone_numbers' => :'phoneNumbers'
|
|
25
|
+
}
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# Returns all the JSON keys this model knows about
|
|
29
|
+
def self.acceptable_attributes
|
|
30
|
+
attribute_map.values
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
# Attribute type mapping.
|
|
34
|
+
def self.openapi_types
|
|
35
|
+
{
|
|
36
|
+
:'phone_numbers' => :'Array<String>'
|
|
37
|
+
}
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# List of attributes with nullable: true
|
|
41
|
+
def self.openapi_nullable
|
|
42
|
+
Set.new([
|
|
43
|
+
])
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Initializes the object
|
|
47
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
48
|
+
def initialize(attributes = {})
|
|
49
|
+
if (!attributes.is_a?(Hash))
|
|
50
|
+
fail ArgumentError, 'The input argument (attributes) must be a hash in `Bandwidth::SyncLookupRequest` initialize method'
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
55
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
56
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Bandwidth::SyncLookupRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
57
|
+
end
|
|
58
|
+
h[k.to_sym] = v
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if attributes.key?(:'phone_numbers')
|
|
62
|
+
if (value = attributes[:'phone_numbers']).is_a?(Array)
|
|
63
|
+
self.phone_numbers = value
|
|
64
|
+
end
|
|
65
|
+
else
|
|
66
|
+
self.phone_numbers = nil
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
71
|
+
# @return Array for valid properties with the reasons
|
|
72
|
+
def list_invalid_properties
|
|
73
|
+
warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
|
|
74
|
+
invalid_properties = Array.new
|
|
75
|
+
if @phone_numbers.nil?
|
|
76
|
+
invalid_properties.push('invalid value for "phone_numbers", phone_numbers cannot be nil.')
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
invalid_properties
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# Check to see if the all the properties in the model are valid
|
|
83
|
+
# @return true if the model is valid
|
|
84
|
+
def valid?
|
|
85
|
+
warn '[DEPRECATED] the `valid?` method is obsolete'
|
|
86
|
+
return false if @phone_numbers.nil?
|
|
87
|
+
true
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
# Custom attribute writer method with validation
|
|
91
|
+
# @param [Object] phone_numbers Value to be assigned
|
|
92
|
+
def phone_numbers=(phone_numbers)
|
|
93
|
+
if phone_numbers.nil?
|
|
94
|
+
fail ArgumentError, 'phone_numbers cannot be nil'
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
@phone_numbers = phone_numbers
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Checks equality by comparing each attribute.
|
|
101
|
+
# @param [Object] Object to be compared
|
|
102
|
+
def ==(o)
|
|
103
|
+
return true if self.equal?(o)
|
|
104
|
+
self.class == o.class &&
|
|
105
|
+
phone_numbers == o.phone_numbers
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
# @see the `==` method
|
|
109
|
+
# @param [Object] Object to be compared
|
|
110
|
+
def eql?(o)
|
|
111
|
+
self == o
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
# Calculates hash code according to all attributes.
|
|
115
|
+
# @return [Integer] Hash code
|
|
116
|
+
def hash
|
|
117
|
+
[phone_numbers].hash
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
# Builds the object from hash
|
|
121
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
122
|
+
# @return [Object] Returns the model itself
|
|
123
|
+
def self.build_from_hash(attributes)
|
|
124
|
+
return nil unless attributes.is_a?(Hash)
|
|
125
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
126
|
+
transformed_hash = {}
|
|
127
|
+
openapi_types.each_pair do |key, type|
|
|
128
|
+
if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
|
|
129
|
+
transformed_hash["#{key}"] = nil
|
|
130
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
131
|
+
# check to ensure the input is an array given that the attribute
|
|
132
|
+
# is documented as an array but the input is not
|
|
133
|
+
if attributes[attribute_map[key]].is_a?(Array)
|
|
134
|
+
transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
|
|
135
|
+
end
|
|
136
|
+
elsif !attributes[attribute_map[key]].nil?
|
|
137
|
+
transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
new(transformed_hash)
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
# Deserializes the data based on type
|
|
144
|
+
# @param string type Data type
|
|
145
|
+
# @param string value Value to be deserialized
|
|
146
|
+
# @return [Object] Deserialized data
|
|
147
|
+
def self._deserialize(type, value)
|
|
148
|
+
case type.to_sym
|
|
149
|
+
when :Time
|
|
150
|
+
Time.parse(value)
|
|
151
|
+
when :Date
|
|
152
|
+
Date.parse(value)
|
|
153
|
+
when :String
|
|
154
|
+
value.to_s
|
|
155
|
+
when :Integer
|
|
156
|
+
value.to_i
|
|
157
|
+
when :Float
|
|
158
|
+
value.to_f
|
|
159
|
+
when :Boolean
|
|
160
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
161
|
+
true
|
|
162
|
+
else
|
|
163
|
+
false
|
|
164
|
+
end
|
|
165
|
+
when :Object
|
|
166
|
+
# generic object (usually a Hash), return directly
|
|
167
|
+
value
|
|
168
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
169
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
170
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
171
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
172
|
+
k_type = Regexp.last_match[:k_type]
|
|
173
|
+
v_type = Regexp.last_match[:v_type]
|
|
174
|
+
{}.tap do |hash|
|
|
175
|
+
value.each do |k, v|
|
|
176
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
177
|
+
end
|
|
178
|
+
end
|
|
179
|
+
else # model
|
|
180
|
+
# models (e.g. Pet) or oneOf
|
|
181
|
+
klass = Bandwidth.const_get(type)
|
|
182
|
+
klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
183
|
+
end
|
|
184
|
+
end
|
|
185
|
+
|
|
186
|
+
# Returns the string representation of the object
|
|
187
|
+
# @return [String] String presentation of the object
|
|
188
|
+
def to_s
|
|
189
|
+
to_hash.to_s
|
|
190
|
+
end
|
|
191
|
+
|
|
192
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
|
194
|
+
def to_body
|
|
195
|
+
to_hash
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
# Returns the object in the form of hash
|
|
199
|
+
# @return [Hash] Returns the object in the form of hash
|
|
200
|
+
def to_hash
|
|
201
|
+
hash = {}
|
|
202
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
203
|
+
value = self.send(attr)
|
|
204
|
+
if value.nil?
|
|
205
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
206
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
hash[param] = _to_hash(value)
|
|
210
|
+
end
|
|
211
|
+
hash
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Outputs non-array value in the form of hash
|
|
215
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
216
|
+
# @param [Object] value Any valid value
|
|
217
|
+
# @return [Hash] Returns the value in the form of hash
|
|
218
|
+
def _to_hash(value)
|
|
219
|
+
if value.is_a?(Array)
|
|
220
|
+
value.compact.map { |v| _to_hash(v) }
|
|
221
|
+
elsif value.is_a?(Hash)
|
|
222
|
+
{}.tap do |hash|
|
|
223
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
224
|
+
end
|
|
225
|
+
elsif value.respond_to? :to_hash
|
|
226
|
+
value.to_hash
|
|
227
|
+
else
|
|
228
|
+
value
|
|
229
|
+
end
|
|
230
|
+
end
|
|
231
|
+
end
|
|
232
|
+
end
|
data/lib/bandwidth-sdk.rb
CHANGED
|
@@ -21,6 +21,7 @@ require 'bandwidth-sdk/models/account_statistics'
|
|
|
21
21
|
require 'bandwidth-sdk/models/additional_denial_reason'
|
|
22
22
|
require 'bandwidth-sdk/models/address'
|
|
23
23
|
require 'bandwidth-sdk/models/answer_callback'
|
|
24
|
+
require 'bandwidth-sdk/models/async_lookup_request'
|
|
24
25
|
require 'bandwidth-sdk/models/blocked_webhook'
|
|
25
26
|
require 'bandwidth-sdk/models/bridge_complete_callback'
|
|
26
27
|
require 'bandwidth-sdk/models/bridge_target_complete_callback'
|
|
@@ -39,6 +40,7 @@ require 'bandwidth-sdk/models/callback'
|
|
|
39
40
|
require 'bandwidth-sdk/models/callback_method_enum'
|
|
40
41
|
require 'bandwidth-sdk/models/card_width_enum'
|
|
41
42
|
require 'bandwidth-sdk/models/code_request'
|
|
43
|
+
require 'bandwidth-sdk/models/completed_lookup_status_enum'
|
|
42
44
|
require 'bandwidth-sdk/models/conference'
|
|
43
45
|
require 'bandwidth-sdk/models/conference_completed_callback'
|
|
44
46
|
require 'bandwidth-sdk/models/conference_created_callback'
|
|
@@ -50,11 +52,15 @@ require 'bandwidth-sdk/models/conference_recording_metadata'
|
|
|
50
52
|
require 'bandwidth-sdk/models/conference_redirect_callback'
|
|
51
53
|
require 'bandwidth-sdk/models/conference_state_enum'
|
|
52
54
|
require 'bandwidth-sdk/models/contact'
|
|
55
|
+
require 'bandwidth-sdk/models/create_async_bulk_lookup_response'
|
|
56
|
+
require 'bandwidth-sdk/models/create_async_bulk_lookup_response_data'
|
|
53
57
|
require 'bandwidth-sdk/models/create_call'
|
|
54
58
|
require 'bandwidth-sdk/models/create_call_response'
|
|
55
|
-
require 'bandwidth-sdk/models/create_lookup_response'
|
|
56
59
|
require 'bandwidth-sdk/models/create_message_request_error'
|
|
57
60
|
require 'bandwidth-sdk/models/create_multi_channel_message_response'
|
|
61
|
+
require 'bandwidth-sdk/models/create_sync_lookup_response'
|
|
62
|
+
require 'bandwidth-sdk/models/create_sync_lookup_response_data'
|
|
63
|
+
require 'bandwidth-sdk/models/deactivation_event_enum'
|
|
58
64
|
require 'bandwidth-sdk/models/disconnect_callback'
|
|
59
65
|
require 'bandwidth-sdk/models/diversion'
|
|
60
66
|
require 'bandwidth-sdk/models/dtmf_callback'
|
|
@@ -65,18 +71,24 @@ require 'bandwidth-sdk/models/failure_webhook'
|
|
|
65
71
|
require 'bandwidth-sdk/models/field_error'
|
|
66
72
|
require 'bandwidth-sdk/models/file_format_enum'
|
|
67
73
|
require 'bandwidth-sdk/models/gather_callback'
|
|
74
|
+
require 'bandwidth-sdk/models/get_async_bulk_lookup_response'
|
|
75
|
+
require 'bandwidth-sdk/models/get_async_bulk_lookup_response_data'
|
|
76
|
+
require 'bandwidth-sdk/models/in_progress_lookup_status_enum'
|
|
68
77
|
require 'bandwidth-sdk/models/inbound_callback'
|
|
69
78
|
require 'bandwidth-sdk/models/inbound_callback_message'
|
|
70
79
|
require 'bandwidth-sdk/models/inbound_callback_type_enum'
|
|
71
80
|
require 'bandwidth-sdk/models/initiate_callback'
|
|
81
|
+
require 'bandwidth-sdk/models/latest_message_delivery_status_enum'
|
|
82
|
+
require 'bandwidth-sdk/models/line_type_enum'
|
|
72
83
|
require 'bandwidth-sdk/models/link'
|
|
84
|
+
require 'bandwidth-sdk/models/link_schema'
|
|
73
85
|
require 'bandwidth-sdk/models/links_object'
|
|
74
86
|
require 'bandwidth-sdk/models/list_message_direction_enum'
|
|
75
87
|
require 'bandwidth-sdk/models/list_message_item'
|
|
76
|
-
require 'bandwidth-sdk/models/
|
|
88
|
+
require 'bandwidth-sdk/models/lookup_error_response'
|
|
89
|
+
require 'bandwidth-sdk/models/lookup_error_schema'
|
|
90
|
+
require 'bandwidth-sdk/models/lookup_error_schema_meta'
|
|
77
91
|
require 'bandwidth-sdk/models/lookup_result'
|
|
78
|
-
require 'bandwidth-sdk/models/lookup_status'
|
|
79
|
-
require 'bandwidth-sdk/models/lookup_status_enum'
|
|
80
92
|
require 'bandwidth-sdk/models/machine_detection_complete_callback'
|
|
81
93
|
require 'bandwidth-sdk/models/machine_detection_configuration'
|
|
82
94
|
require 'bandwidth-sdk/models/machine_detection_mode_enum'
|
|
@@ -97,14 +109,22 @@ require 'bandwidth-sdk/models/mms_message_content'
|
|
|
97
109
|
require 'bandwidth-sdk/models/mms_message_content_file'
|
|
98
110
|
require 'bandwidth-sdk/models/multi_channel_action'
|
|
99
111
|
require 'bandwidth-sdk/models/multi_channel_action_calendar_event'
|
|
100
|
-
require 'bandwidth-sdk/models/
|
|
101
|
-
require 'bandwidth-sdk/models/
|
|
112
|
+
require 'bandwidth-sdk/models/multi_channel_channel_list_mms_object'
|
|
113
|
+
require 'bandwidth-sdk/models/multi_channel_channel_list_mms_response_object'
|
|
114
|
+
require 'bandwidth-sdk/models/multi_channel_channel_list_object_base'
|
|
115
|
+
require 'bandwidth-sdk/models/multi_channel_channel_list_owner_object'
|
|
116
|
+
require 'bandwidth-sdk/models/multi_channel_channel_list_rbm_object'
|
|
117
|
+
require 'bandwidth-sdk/models/multi_channel_channel_list_rbm_object_all_of_content'
|
|
118
|
+
require 'bandwidth-sdk/models/multi_channel_channel_list_rbm_response_object'
|
|
119
|
+
require 'bandwidth-sdk/models/multi_channel_channel_list_request_object'
|
|
120
|
+
require 'bandwidth-sdk/models/multi_channel_channel_list_response_object'
|
|
121
|
+
require 'bandwidth-sdk/models/multi_channel_channel_list_sms_object'
|
|
122
|
+
require 'bandwidth-sdk/models/multi_channel_channel_list_sms_response_object'
|
|
102
123
|
require 'bandwidth-sdk/models/multi_channel_error'
|
|
103
124
|
require 'bandwidth-sdk/models/multi_channel_message_channel_enum'
|
|
104
125
|
require 'bandwidth-sdk/models/multi_channel_message_content'
|
|
105
126
|
require 'bandwidth-sdk/models/multi_channel_message_request'
|
|
106
127
|
require 'bandwidth-sdk/models/multi_channel_message_response_data'
|
|
107
|
-
require 'bandwidth-sdk/models/multi_channel_message_response_data_channel_list_inner'
|
|
108
128
|
require 'bandwidth-sdk/models/opt_in_workflow'
|
|
109
129
|
require 'bandwidth-sdk/models/page_info'
|
|
110
130
|
require 'bandwidth-sdk/models/priority_enum'
|
|
@@ -138,6 +158,7 @@ require 'bandwidth-sdk/models/status_callback'
|
|
|
138
158
|
require 'bandwidth-sdk/models/status_callback_message'
|
|
139
159
|
require 'bandwidth-sdk/models/status_callback_type_enum'
|
|
140
160
|
require 'bandwidth-sdk/models/stir_shaken'
|
|
161
|
+
require 'bandwidth-sdk/models/sync_lookup_request'
|
|
141
162
|
require 'bandwidth-sdk/models/telephone_number'
|
|
142
163
|
require 'bandwidth-sdk/models/tfv_basic_authentication'
|
|
143
164
|
require 'bandwidth-sdk/models/tfv_callback_status_enum'
|
|
@@ -147,7 +168,6 @@ require 'bandwidth-sdk/models/tfv_status_enum'
|
|
|
147
168
|
require 'bandwidth-sdk/models/tfv_submission_info'
|
|
148
169
|
require 'bandwidth-sdk/models/tfv_submission_wrapper'
|
|
149
170
|
require 'bandwidth-sdk/models/thumbnail_alignment_enum'
|
|
150
|
-
require 'bandwidth-sdk/models/tn_lookup_request_error'
|
|
151
171
|
require 'bandwidth-sdk/models/transcribe_recording'
|
|
152
172
|
require 'bandwidth-sdk/models/transcription'
|
|
153
173
|
require 'bandwidth-sdk/models/transcription_available_callback'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Integration tests for Bandwidth::MultiChannelApi
|
|
2
2
|
describe 'MultiChannelApi' do
|
|
3
3
|
before(:all) do
|
|
4
4
|
Bandwidth.configure do |config|
|
|
@@ -10,29 +10,130 @@ describe 'MultiChannelApi' do
|
|
|
10
10
|
@expiration_time = (Time.now + 60).round.to_datetime.rfc3339
|
|
11
11
|
end
|
|
12
12
|
|
|
13
|
-
# Create Multi-Channel Message
|
|
14
|
-
describe '
|
|
15
|
-
it 'creates a multi channel message' do
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
13
|
+
# Create Multi-Channel SMS Message
|
|
14
|
+
describe 'create_multi_channel_sms_message' do
|
|
15
|
+
it 'creates a multi channel sms message' do
|
|
16
|
+
message_body = Bandwidth::MultiChannelChannelListSMSObject.new(
|
|
17
|
+
from: BW_NUMBER,
|
|
18
|
+
application_id: BW_MESSAGING_APPLICATION_ID,
|
|
19
|
+
channel: Bandwidth::MultiChannelMessageChannelEnum::SMS,
|
|
20
|
+
content: Bandwidth::SmsMessageContent.new(
|
|
21
|
+
text: 'Hello, this is a test message.',
|
|
22
|
+
)
|
|
22
23
|
)
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
24
|
+
multi_channel_message_request = Bandwidth::MultiChannelMessageRequest.new(
|
|
25
|
+
to: USER_NUMBER,
|
|
26
|
+
channel_list: [message_body],
|
|
27
|
+
tag: 'tag',
|
|
28
|
+
priority: 'high',
|
|
29
|
+
expiration: @expiration_time,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
data, status_code = @multi_channel_api_instance.create_multi_channel_message_with_http_info(BW_ACCOUNT_ID, multi_channel_message_request)
|
|
33
|
+
|
|
34
|
+
expect(status_code).to eq(202)
|
|
35
|
+
p data.data
|
|
36
|
+
expect(data).to be_instance_of(Bandwidth::CreateMultiChannelMessageResponse)
|
|
37
|
+
expect(data.links).to be_instance_of(Array)
|
|
38
|
+
expect(data.data).to be_instance_of(Bandwidth::MultiChannelMessageResponseData)
|
|
39
|
+
expect(data.data.id).to be_instance_of(String)
|
|
40
|
+
expect(data.data.time).to be_instance_of(Time)
|
|
41
|
+
expect(data.data.direction).to be_one_of(Bandwidth::MessageDirectionEnum.all_vars)
|
|
42
|
+
expect(data.data.to).to be_instance_of(Array)
|
|
43
|
+
expect(data.data.tag).to be_instance_of(String)
|
|
44
|
+
expect(data.data.priority).to be_one_of(Bandwidth::PriorityEnum.all_vars)
|
|
45
|
+
expect(data.data.expiration).to be_instance_of(Time)
|
|
46
|
+
expect(data.data.channel_list).to be_instance_of(Array)
|
|
47
|
+
# add more assertions once SDK supports discriminators
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Create Multi-Channel MMS Message
|
|
52
|
+
describe 'create_multi_channel_mms_message' do
|
|
53
|
+
it 'creates a multi channel mms message' do
|
|
54
|
+
message_body = Bandwidth::MultiChannelChannelListMMSObject.new(
|
|
55
|
+
from: BW_NUMBER,
|
|
56
|
+
application_id: BW_MESSAGING_APPLICATION_ID,
|
|
57
|
+
channel: Bandwidth::MultiChannelMessageChannelEnum::MMS,
|
|
58
|
+
content: Bandwidth::MmsMessageContent.new(
|
|
59
|
+
media: [
|
|
60
|
+
Bandwidth::MmsMessageContentFile.new(
|
|
61
|
+
file_url: 'https://example.com/image.jpg'
|
|
62
|
+
)
|
|
63
|
+
],
|
|
64
|
+
text: 'Hello, this is a test message.',
|
|
65
|
+
)
|
|
66
|
+
)
|
|
67
|
+
multi_channel_message_request = Bandwidth::MultiChannelMessageRequest.new(
|
|
68
|
+
to: USER_NUMBER,
|
|
69
|
+
channel_list: [message_body],
|
|
70
|
+
tag: 'tag',
|
|
71
|
+
priority: 'high',
|
|
72
|
+
expiration: @expiration_time,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
data, status_code = @multi_channel_api_instance.create_multi_channel_message_with_http_info(BW_ACCOUNT_ID, multi_channel_message_request)
|
|
76
|
+
|
|
77
|
+
expect(status_code).to eq(202)
|
|
78
|
+
p data.data
|
|
79
|
+
expect(data).to be_instance_of(Bandwidth::CreateMultiChannelMessageResponse)
|
|
80
|
+
expect(data.links).to be_instance_of(Array)
|
|
81
|
+
expect(data.data).to be_instance_of(Bandwidth::MultiChannelMessageResponseData)
|
|
82
|
+
expect(data.data.id).to be_instance_of(String)
|
|
83
|
+
expect(data.data.time).to be_instance_of(Time)
|
|
84
|
+
expect(data.data.direction).to be_one_of(Bandwidth::MessageDirectionEnum.all_vars)
|
|
85
|
+
expect(data.data.to).to be_instance_of(Array)
|
|
86
|
+
expect(data.data.tag).to be_instance_of(String)
|
|
87
|
+
expect(data.data.priority).to be_one_of(Bandwidth::PriorityEnum.all_vars)
|
|
88
|
+
expect(data.data.expiration).to be_instance_of(Time)
|
|
89
|
+
expect(data.data.channel_list).to be_instance_of(Array)
|
|
90
|
+
# add more assertions once SDK supports discriminators
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
# Create Multi-Channel RBM Message
|
|
95
|
+
describe 'create_multi_channel_rbm_message' do
|
|
96
|
+
it 'creates a multi channel rbm message' do
|
|
97
|
+
message_body = Bandwidth::MultiChannelChannelListRBMObject.new(
|
|
98
|
+
from: BW_NUMBER,
|
|
99
|
+
application_id: BW_MESSAGING_APPLICATION_ID,
|
|
100
|
+
channel: Bandwidth::MultiChannelMessageChannelEnum::RBM,
|
|
101
|
+
content: Bandwidth::RbmMessageContentText.new(
|
|
102
|
+
text: 'Hello, this is a test message.',
|
|
103
|
+
suggestions: [
|
|
104
|
+
Bandwidth::RbmActionDial.new(
|
|
105
|
+
type: Bandwidth::RbmActionTypeEnum::DIAL_PHONE,
|
|
106
|
+
text: 'Call Us',
|
|
107
|
+
postback_data: 'abcdefg12345678',
|
|
108
|
+
phone_number: BW_NUMBER
|
|
109
|
+
)
|
|
110
|
+
]
|
|
111
|
+
)
|
|
112
|
+
)
|
|
113
|
+
multi_channel_message_request = Bandwidth::MultiChannelMessageRequest.new(
|
|
114
|
+
to: USER_NUMBER,
|
|
115
|
+
channel_list: [message_body],
|
|
116
|
+
tag: 'tag',
|
|
117
|
+
priority: 'high',
|
|
118
|
+
expiration: @expiration_time,
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
data, status_code = @multi_channel_api_instance.create_multi_channel_message_with_http_info(BW_ACCOUNT_ID, multi_channel_message_request)
|
|
122
|
+
|
|
123
|
+
expect(status_code).to eq(202)
|
|
124
|
+
p data.data
|
|
125
|
+
expect(data).to be_instance_of(Bandwidth::CreateMultiChannelMessageResponse)
|
|
126
|
+
expect(data.links).to be_instance_of(Array)
|
|
127
|
+
expect(data.data).to be_instance_of(Bandwidth::MultiChannelMessageResponseData)
|
|
128
|
+
expect(data.data.id).to be_instance_of(String)
|
|
129
|
+
expect(data.data.time).to be_instance_of(Time)
|
|
130
|
+
expect(data.data.direction).to be_one_of(Bandwidth::MessageDirectionEnum.all_vars)
|
|
131
|
+
expect(data.data.to).to be_instance_of(Array)
|
|
132
|
+
expect(data.data.tag).to be_instance_of(String)
|
|
133
|
+
expect(data.data.priority).to be_one_of(Bandwidth::PriorityEnum.all_vars)
|
|
134
|
+
expect(data.data.expiration).to be_instance_of(Time)
|
|
135
|
+
expect(data.data.channel_list).to be_instance_of(Array)
|
|
136
|
+
# add more assertions once SDK supports discriminators
|
|
137
|
+
end
|
|
37
138
|
end
|
|
38
139
|
end
|
|
@@ -1,91 +1,86 @@
|
|
|
1
|
-
# Integration
|
|
2
|
-
describe 'PhoneNumberLookupApi
|
|
1
|
+
# Integration tests for Bandwidth::PhoneNumberLookupApi
|
|
2
|
+
describe 'PhoneNumberLookupApi' do
|
|
3
|
+
let(:phone_numbers) { [BW_NUMBER, USER_NUMBER] }
|
|
4
|
+
|
|
3
5
|
before(:all) do
|
|
4
6
|
Bandwidth.configure do |config|
|
|
5
7
|
config.username = BW_USERNAME
|
|
6
8
|
config.password = BW_PASSWORD
|
|
7
9
|
end
|
|
8
|
-
@
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
@api_instance = Bandwidth::PhoneNumberLookupApi.new
|
|
11
|
+
end
|
|
12
|
+
describe 'test an instance of PhoneNumberLookupApi' do
|
|
13
|
+
it 'should create an instance of PhoneNumberLookupApi' do
|
|
14
|
+
expect(@api_instance).to be_instance_of(Bandwidth::PhoneNumberLookupApi)
|
|
15
|
+
end
|
|
12
16
|
end
|
|
13
17
|
|
|
14
|
-
# Create Lookup
|
|
15
|
-
describe '
|
|
16
|
-
it '
|
|
17
|
-
|
|
18
|
-
|
|
18
|
+
# Create Asynchronous Bulk Number Lookup
|
|
19
|
+
describe 'create_get_async_bulk_lookup test' do
|
|
20
|
+
it 'should work' do
|
|
21
|
+
request = Bandwidth::AsyncLookupRequest.new(
|
|
22
|
+
phone_numbers: phone_numbers,
|
|
19
23
|
)
|
|
20
|
-
data, status_code = @api_instance_tnlookup.create_lookup_with_http_info(BW_ACCOUNT_ID, tn_body)
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
expect(data).to be_instance_of(Bandwidth::CreateLookupResponse)
|
|
24
|
-
expect(data.request_id.length).to eq(36)
|
|
25
|
-
expect(data.status).to be_instance_of(String)
|
|
25
|
+
create_data, create_status_code = @api_instance.create_async_bulk_lookup_with_http_info(BW_ACCOUNT_ID, request)
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
expect(create_status_code).to eq(202)
|
|
28
|
+
expect(create_data).to be_instance_of(Bandwidth::CreateAsyncBulkLookupResponse)
|
|
29
|
+
expect(create_data.links[0]).to be_instance_of(Bandwidth::LinkSchema)
|
|
30
|
+
expect(create_data.links[0].rel).to be_instance_of(String)
|
|
31
|
+
expect(create_data.links[0].href).to be_instance_of(String)
|
|
32
|
+
expect(create_data.links[0].method).to be_instance_of(String)
|
|
33
|
+
expect(create_data.data).to be_instance_of(Bandwidth::CreateAsyncBulkLookupResponseData)
|
|
34
|
+
expect(create_data.data.request_id).to be_instance_of(String)
|
|
35
|
+
expect(create_data.data.status).to be_one_of(Bandwidth::InProgressLookupStatusEnum.all_vars)
|
|
36
|
+
expect(create_data.errors).to be_instance_of(Array)
|
|
31
37
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
it 'gets lookup status' do
|
|
35
|
-
data, status_code = @api_instance_tnlookup.get_lookup_status_with_http_info(BW_ACCOUNT_ID, $lookup_request_id)
|
|
38
|
+
request_id = create_data.data.request_id
|
|
39
|
+
sleep(30)
|
|
36
40
|
|
|
37
|
-
|
|
38
|
-
expect(
|
|
39
|
-
expect(
|
|
40
|
-
expect(
|
|
41
|
-
expect(
|
|
42
|
-
expect(
|
|
43
|
-
expect(
|
|
41
|
+
get_data, get_status_code = @api_instance.get_async_bulk_lookup_with_http_info(BW_ACCOUNT_ID, request_id)
|
|
42
|
+
expect(get_status_code).to equal_to(200)
|
|
43
|
+
expect(get_data).to be_instance_of(Bandwidth::GetAsyncBulkLookupResponse)
|
|
44
|
+
expect(get_data.links[0]).to be_instance_of(Bandwidth::LinkSchema)
|
|
45
|
+
expect(get_data.links[0].rel).to be_instance_of(String)
|
|
46
|
+
expect(get_data.links[0].href).to be_instance_of(String)
|
|
47
|
+
expect(get_data.links[0].method).to be_instance_of(String)
|
|
48
|
+
expect(get_data.data.request_id).to eq(request_id)
|
|
49
|
+
expect(get_data.data.status).to eq(Bandwidth::InProgressLookupStatusEnum::COMPLETE)
|
|
50
|
+
expect(get_data.data.results).to be_instance_of(Array)
|
|
51
|
+
expect(get_data.data.results[0]).to be_instance_of(Bandwidth::LookupResult)
|
|
52
|
+
expect(get_data.data.results[0].phone_number).to be_instance_of(String)
|
|
53
|
+
expect(get_data.data.results[0].line_type).to be_one_of(Bandwidth::LineTypeEnum.all_vars)
|
|
54
|
+
expect(get_data.data.results[0].messaging_provider).to be_instance_of(String)
|
|
55
|
+
expect(get_data.data.results[0].voice_provider).to be_instance_of(String)
|
|
56
|
+
expect(get_data.data.results[0].country_code_a3).to be_instance_of(String)
|
|
44
57
|
end
|
|
45
58
|
end
|
|
46
59
|
|
|
47
|
-
#
|
|
48
|
-
describe '
|
|
49
|
-
it '
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
# Create Synchronous Number Lookup
|
|
61
|
+
describe 'create_sync_lookup test' do
|
|
62
|
+
it 'should work' do
|
|
63
|
+
request = Bandwidth::SyncLookupRequest.new(
|
|
64
|
+
phone_numbers: phone_numbers,
|
|
52
65
|
)
|
|
53
66
|
|
|
54
|
-
|
|
55
|
-
@api_instance_tnlookup.create_lookup_with_http_info(BW_ACCOUNT_ID, tn_body_bad)
|
|
56
|
-
}.to raise_error { |e|
|
|
57
|
-
expect(e).to be_instance_of(Bandwidth::ApiError)
|
|
58
|
-
expect(e.code).to eq(400)
|
|
59
|
-
}
|
|
60
|
-
end
|
|
61
|
-
|
|
62
|
-
it 'causes a 404 error' do
|
|
63
|
-
req_id_dne = '12345678-abcd-cdef-9876-12345678abcd'
|
|
64
|
-
|
|
65
|
-
expect {
|
|
66
|
-
@api_instance_tnlookup.get_lookup_status_with_http_info(BW_ACCOUNT_ID, req_id_dne)
|
|
67
|
-
}.to raise_error { |e|
|
|
68
|
-
expect(e).to be_instance_of(Bandwidth::ApiError)
|
|
69
|
-
expect(e.code).to eq(404)
|
|
70
|
-
}
|
|
71
|
-
end
|
|
72
|
-
|
|
73
|
-
it 'causes a 401 error' do
|
|
74
|
-
Bandwidth.configure do |config|
|
|
75
|
-
config.username = UNAUTHORIZED_USERNAME
|
|
76
|
-
config.password = UNAUTHORIZED_PASSWORD
|
|
77
|
-
end
|
|
78
|
-
|
|
79
|
-
tn_body = Bandwidth::LookupRequest.new(
|
|
80
|
-
tns: [BW_NUMBER]
|
|
81
|
-
)
|
|
67
|
+
data, status_code = @api_instance.create_sync_lookup_with_http_info(BW_ACCOUNT_ID, request)
|
|
82
68
|
|
|
83
|
-
expect
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
69
|
+
expect(status_code).to equal_to(200)
|
|
70
|
+
expect(data).to be_instance_of(Bandwidth::CreateSyncLookupResponse)
|
|
71
|
+
expect(data.links[0]).to be_instance_of(Bandwidth::LinkSchema)
|
|
72
|
+
expect(data.links[0].rel).to be_instance_of(String)
|
|
73
|
+
expect(data.links[0].href).to be_instance_of(String)
|
|
74
|
+
expect(data.links[0].method).to be_instance_of(String)
|
|
75
|
+
expect(data.data.request_id).to be_instance_of(String)
|
|
76
|
+
expect(data.data.status).to eq(Bandwidth::CompletedLookupStatusEnum::COMPLETE)
|
|
77
|
+
expect(data.data.results).to be_instance_of(Array)
|
|
78
|
+
expect(data.data.results[0]).to be_instance_of(Bandwidth::LookupResult)
|
|
79
|
+
expect(data.data.results[0].phone_number).to be_instance_of(String)
|
|
80
|
+
expect(data.data.results[0].line_type).to be_one_of(Bandwidth::LineTypeEnum.all_vars)
|
|
81
|
+
expect(data.data.results[0].messaging_provider).to be_instance_of(String)
|
|
82
|
+
expect(data.data.results[0].voice_provider).to be_instance_of(String)
|
|
83
|
+
expect(data.data.results[0].country_code_a3).to be_instance_of(String)
|
|
89
84
|
end
|
|
90
85
|
end
|
|
91
86
|
end
|