bandwidth-sdk 6.1.0 → 6.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (24) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +89 -12
  3. data/lib/bandwidth.rb +2 -0
  4. data/lib/bandwidth/api_helper.rb +5 -5
  5. data/lib/bandwidth/client.rb +15 -1
  6. data/lib/bandwidth/configuration.rb +39 -3
  7. data/lib/bandwidth/http/auth/phone_number_lookup_basic_auth.rb +22 -0
  8. data/lib/bandwidth/http/faraday_client.rb +5 -2
  9. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup.rb +20 -0
  10. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/client.rb +60 -0
  11. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/api_controller.rb +1551 -0
  12. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/base_controller.rb +49 -0
  13. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb +29 -0
  14. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_request.rb +35 -0
  15. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_response.rb +45 -0
  16. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb +74 -0
  17. data/lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb +107 -0
  18. data/lib/bandwidth/web_rtc_lib/web_rtc/client.rb +10 -1
  19. data/lib/bandwidth/web_rtc_lib/web_rtc/models/device_api_version_enum.rb +2 -2
  20. data/test/controllers/controller_test_base.rb +21 -0
  21. data/test/http_response_catcher.rb +19 -0
  22. data/test/integration/test_integration.rb +14 -1
  23. data/test/test_helper.rb +94 -0
  24. metadata +20 -7
@@ -0,0 +1,94 @@
1
+ # bandwidth
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ require 'tempfile'
7
+ require 'open-uri'
8
+
9
+ class TestHelper
10
+
11
+ @cache = Hash.new
12
+
13
+ # Class method to compare the received headers with the expected headers.
14
+ # @param [Hash] A hash of expected headers (keys in lower case).
15
+ # @param [Hash] A hash of received headers.
16
+ # @param [Boolean, optional] A flag which determines if we allow extra headers.
17
+ def self.match_headers(expected_headers,
18
+ received_headers,
19
+ allow_extra: true)
20
+ return false if ((received_headers.length < expected_headers.length) ||
21
+ ((allow_extra == false) && (received_headers.length > expected_headers.length)))
22
+
23
+ received_headers = Hash[received_headers.map{|k, v| [k.to_s.downcase, v]}]
24
+ expected_headers.each do |e_key, e_value|
25
+ return false unless received_headers.key?(e_key)
26
+ return false if ((e_value != nil) &&
27
+ (e_value != received_headers[e_key]))
28
+ end
29
+
30
+ return true
31
+ end
32
+
33
+ # Class method to compare the received body with the expected body.
34
+ # @param [Dynamic] The expected body.
35
+ # @param [Dynamic] The received body.
36
+ # @param [Boolean, optional] A flag which determines if we check values in dictionaries.
37
+ # @param [Boolean, optional] A flag which determines if we check the order of array elements.
38
+ # @param [Boolean, optional] A flag which determines if we check the count of array elements.
39
+ def self.match_body(expected_body,
40
+ received_body,
41
+ check_values: false,
42
+ check_order: false,
43
+ check_count: false)
44
+ if expected_body.instance_of? Hash
45
+ return false unless received_body.instance_of? Hash
46
+ for key in expected_body.keys
47
+ return false unless received_body.keys.include? key
48
+ if check_values or expected_body[key].instance_of? Hash
49
+ return false unless TestHelper.match_body(expected_body[key],
50
+ received_body[key],
51
+ check_values: check_values,
52
+ check_order: check_order,
53
+ check_count: check_count)
54
+ end
55
+ end
56
+ elsif expected_body.instance_of? Array
57
+ return False unless received_body.instance_of? Array
58
+ if check_count == true && (expected_body.length != received_body.length)
59
+ return false
60
+ else
61
+ previous_matches = Array.new
62
+ expected_body.each.with_index do |expected_element, i|
63
+ matches = (received_body.map.with_index do |received_element, j|
64
+ j if TestHelper.match_body(expected_element,
65
+ received_element,
66
+ check_values: check_values,
67
+ check_order: check_order,
68
+ check_count: check_count)
69
+ end).compact
70
+ return false if matches.length == 0
71
+ if check_order == true
72
+ return false if (i != 0 && matches.map{|x| previous_matches.map{|y| y > x}.all?}.all?)
73
+ previous_matches = matches
74
+ end
75
+ end
76
+ end
77
+ elsif expected_body != received_body
78
+ return false
79
+ end
80
+ return true
81
+ end
82
+
83
+ # Class method which takes a URL, downloads the file (if not already downloaded
84
+ # for this test session) and returns the path of the file.
85
+ # @param [String] The URL of the required file.
86
+ def self.get_file(url)
87
+ unless @cache.keys.include? url
88
+ @cache[url] = Tempfile.new('APIMatic')
89
+ @cache[url].binmode
90
+ @cache[url].write(open(url, {ssl_ca_cert: Certifi.where}).read)
91
+ end
92
+ return @cache[url].path
93
+ end
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: 6.1.0
4
+ version: 6.2.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: 2021-03-23 00:00:00.000000000 Z
11
+ date: 2021-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -31,9 +31,9 @@ dependencies:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.0'
34
- - - ">="
34
+ - - "<="
35
35
  - !ruby/object:Gem::Version
36
- version: 1.0.1
36
+ version: 1.3.0
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -41,9 +41,9 @@ dependencies:
41
41
  - - "~>"
42
42
  - !ruby/object:Gem::Version
43
43
  version: '1.0'
44
- - - ">="
44
+ - - "<="
45
45
  - !ruby/object:Gem::Version
46
- version: 1.0.1
46
+ version: 1.3.0
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: faraday_middleware
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -155,6 +155,7 @@ files:
155
155
  - lib/bandwidth/exceptions/api_exception.rb
156
156
  - lib/bandwidth/http/api_response.rb
157
157
  - lib/bandwidth/http/auth/messaging_basic_auth.rb
158
+ - lib/bandwidth/http/auth/phone_number_lookup_basic_auth.rb
158
159
  - lib/bandwidth/http/auth/two_factor_auth_basic_auth.rb
159
160
  - lib/bandwidth/http/auth/voice_basic_auth.rb
160
161
  - lib/bandwidth/http/auth/web_rtc_basic_auth.rb
@@ -180,6 +181,15 @@ files:
180
181
  - lib/bandwidth/messaging_lib/messaging/models/priority_enum.rb
181
182
  - lib/bandwidth/messaging_lib/messaging/models/tag.rb
182
183
  - lib/bandwidth/models/base_model.rb
184
+ - lib/bandwidth/phone_number_lookup_lib/phone_number_lookup.rb
185
+ - lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/client.rb
186
+ - lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/api_controller.rb
187
+ - lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/controllers/base_controller.rb
188
+ - lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/exceptions/accounts_tnlookup400_error_exception.rb
189
+ - lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_request.rb
190
+ - lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_response.rb
191
+ - lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/order_status.rb
192
+ - lib/bandwidth/phone_number_lookup_lib/phone_number_lookup/models/result.rb
183
193
  - lib/bandwidth/two_factor_auth_lib/two_factor_auth.rb
184
194
  - lib/bandwidth/two_factor_auth_lib/two_factor_auth/client.rb
185
195
  - lib/bandwidth/two_factor_auth_lib/two_factor_auth/controllers/base_controller.rb
@@ -265,7 +275,10 @@ files:
265
275
  - lib/bandwidth/web_rtc_lib/web_rtc/models/publish_permission_enum.rb
266
276
  - lib/bandwidth/web_rtc_lib/web_rtc/models/session.rb
267
277
  - lib/bandwidth/web_rtc_lib/web_rtc/models/subscriptions.rb
278
+ - test/controllers/controller_test_base.rb
279
+ - test/http_response_catcher.rb
268
280
  - test/integration/test_integration.rb
281
+ - test/test_helper.rb
269
282
  homepage: https://apimatic.io
270
283
  licenses:
271
284
  - MIT
@@ -285,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
285
298
  - !ruby/object:Gem::Version
286
299
  version: '0'
287
300
  requirements: []
288
- rubygems_version: 3.2.3
301
+ rubygems_version: 3.2.22
289
302
  signing_key:
290
303
  specification_version: 4
291
304
  summary: bandwidth