bandwidth-sdk 9.1.0 → 9.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72d08e72e19066da912c18946e2bcb7e38c3da78f58005388dd2a6d1b8bc98da
4
- data.tar.gz: 26a7f5cd86a6a3ea974062f66de43b7edee59bf1e7f74fb2ec6e5272a22cdbea
3
+ metadata.gz: 0ed289e0b089422d41faab212859f414160abfbd6783659a13bbee2aefa51ba3
4
+ data.tar.gz: 18d3984dbfd81229b320dce7f717bfefcf0b16ae533b3e19ad323fc19ed91478
5
5
  SHA512:
6
- metadata.gz: cfa230d51fe36a6c513821b05975e1d28a0a14f70e326cd802c20788cbc966f20405f9d3c82e478e2c0095b7ffedda699050d981986e50eecad4716c4c525453
7
- data.tar.gz: e99889889de6d0893da79e616aa9cce33dcc76395c692258c0dfb98f0cde7e38d7901579dd9542acd1e0594ebf0dde25407a5c06be09307fea30ea07197ba04e
6
+ metadata.gz: 5b168dab091d93d193d57a43f1f72a278ebebc7b5a8b90d1cd4fdd2700aadea10dd0867f73ff9c72b50480b3a218e2d2b12faa835f66c99a987847e32c4edd5b
7
+ data.tar.gz: abf5f883cb52faae585607f1e9b0d2d339f5393e48b996caaefc635f3be1090b6bfef433f848f599c2b8e911446587bfebe948b1a55904bdde45d0f98ab7a410
@@ -144,6 +144,7 @@ module Bandwidth
144
144
  # Parses JSON string.
145
145
  # @param [String] A JSON string.
146
146
  def self.json_deserialize(json)
147
+ return {} if json.nil? || json.empty?
147
148
  JSON.parse(json)
148
149
  rescue StandardError
149
150
  raise TypeError, 'Server responded with invalid JSON.'
@@ -590,15 +590,9 @@ module Voice
590
590
  )
591
591
  _query_url = APIHelper.clean_url _query_builder
592
592
 
593
- # Prepare headers.
594
- _headers = {
595
- 'accept' => 'application/json'
596
- }
597
-
598
593
  # Prepare and execute HttpRequest.
599
594
  _request = config.http_client.get(
600
- _query_url,
601
- headers: _headers
595
+ _query_url
602
596
  )
603
597
  VoiceBasicAuth.apply(config, _request)
604
598
  _response = execute_request(_request)
@@ -648,11 +642,8 @@ module Voice
648
642
  validate_response(_response)
649
643
 
650
644
  # Return appropriate response type.
651
- decoded = APIHelper.json_deserialize(_response.raw_body) unless
652
- _response.raw_body.nil? ||
653
- _response.raw_body.to_s.strip.empty?
654
645
  ApiResponse.new(
655
- _response, data: decoded
646
+ _response, data: _response.raw_body
656
647
  )
657
648
  end
658
649
 
@@ -38,6 +38,17 @@ class IntegrationTest < Test::Unit::TestCase
38
38
  phone_number_lookup_basic_auth_user_name: BW_USERNAME,
39
39
  phone_number_lookup_basic_auth_password: BW_PASSWORD
40
40
  )
41
+
42
+ @bandwidth_client_invalid_auth = Bandwidth::Client.new(
43
+ voice_basic_auth_user_name: "bad_username",
44
+ voice_basic_auth_password: "bad_password",
45
+ messaging_basic_auth_user_name: "bad_username",
46
+ messaging_basic_auth_password: "bad_password",
47
+ multi_factor_auth_basic_auth_user_name: "bad_username",
48
+ multi_factor_auth_basic_auth_password: "bad_password",
49
+ phone_number_lookup_basic_auth_user_name: "bad_username",
50
+ phone_number_lookup_basic_auth_password: "bad_password"
51
+ )
41
52
  end
42
53
 
43
54
  def test_create_message
@@ -79,6 +90,19 @@ class IntegrationTest < Test::Unit::TestCase
79
90
  assert_equal(downloaded_media, media, "Downloaded media file not equal to upload")
80
91
  end
81
92
 
93
+ def test_get_message
94
+ # Send a successful request to the GET messages API
95
+ response = @bandwidth_client.messaging_client.client.get_messages(BW_ACCOUNT_ID, :message_id => "abc123")
96
+ assert_equal(response.status_code, 200, "API did not return a 200 OK")
97
+ end
98
+
99
+ def test_get_message_invalid_auth
100
+ # Send an unsuccessful request to the GET messages API
101
+ assert_raise MessagingException do
102
+ response = @bandwidth_client_invalid_auth.messaging_client.client.get_messages(BW_ACCOUNT_ID)
103
+ end
104
+ end
105
+
82
106
  def test_create_call_and_get_call_state
83
107
  body = CreateCallRequest.new
84
108
  body.from = BW_NUMBER
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: 9.1.0
4
+ version: 9.1.1
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-11-09 00:00:00.000000000 Z
11
+ date: 2022-02-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: logging
@@ -33,7 +33,7 @@ dependencies:
33
33
  version: '1.0'
34
34
  - - "<="
35
35
  - !ruby/object:Gem::Version
36
- version: 1.3.0
36
+ version: 1.9.3
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -43,7 +43,7 @@ dependencies:
43
43
  version: '1.0'
44
44
  - - "<="
45
45
  - !ruby/object:Gem::Version
46
- version: 1.3.0
46
+ version: 1.9.3
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: faraday_middleware
49
49
  requirement: !ruby/object:Gem::Requirement
@@ -302,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
302
302
  - !ruby/object:Gem::Version
303
303
  version: '0'
304
304
  requirements: []
305
- rubygems_version: 3.2.22
305
+ rubygems_version: 3.3.3
306
306
  signing_key:
307
307
  specification_version: 4
308
308
  summary: Bandwidth