telnyx 3.0.4 → 3.0.5

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: 19e901560274959ee4663cac4796bf299c899d4bd9426257815507573cd1075a
4
- data.tar.gz: a61bc5ee783350ce9332410a4d03954a96a5a83b068882bef54123639ee63fba
3
+ metadata.gz: 1c54ee2fae1e5040ea3a33bab7b8d103e0727f9a4bfd966d3ce33bd8c5fef194
4
+ data.tar.gz: f9c16f95c3bf511e70002362b18caf01f4455bbfcb79252946b665f968b1131d
5
5
  SHA512:
6
- metadata.gz: 1e224fe8598c6f343d435f3ccfc9fb5afd37e264000ad8a6ac41634de614b34bc92e88fc5f502bb72cfc110fb7ad0eb0eb2a9f7343546632fc045ed2952b6ec7
7
- data.tar.gz: f34fce7939700971e5e4a5c5377035ee652135879095e3d3a0192699efd0fa2546f6fe5966054dc418c793180d799c61c9caf891390be638be6c469f05048954
6
+ metadata.gz: 19b78fe8dab94fc40f4ed470339e612dccd1db21b059d5ee58620f57f3d02035d1aece4778d9c0179cb9f212908c62e8bddbe26894dae231dd823293b22ba2a3
7
+ data.tar.gz: 8065a019140e93780bd21c69b3479b02ebd2b90ddf1b29945e2053c768e811e12d11aa9e94f28de3ffd5f42d3a4bec576b6f8aa5b39bb132c5860cacffc901d1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.4
1
+ 3.0.5
@@ -64,7 +64,17 @@ module Telnyx
64
64
 
65
65
  # Helper to handle when the server responds with a blank body (as is the case with SimCards).
66
66
  def preprocess_response(resp)
67
- resp.empty? ? "{}" : resp
67
+ return "{}" if resp.empty?
68
+
69
+ return resp if valid_json?(resp)
70
+
71
+ # If the response is a plain string (as is with JWTs), wrap it in a JSON object
72
+ { token: resp }.to_json
73
+ end
74
+
75
+ # Helper method to check if the string is a valid JSON format
76
+ def valid_json?(resp)
77
+ resp.strip.start_with?("{", "[")
68
78
  end
69
79
  end
70
80
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Telnyx
4
- VERSION = "3.0.4".freeze
4
+ VERSION = "3.0.5".freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: telnyx
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Telnyx