telnyx 3.0.3 → 3.0.4
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/VERSION +1 -1
- data/lib/telnyx/telephony_credential.rb +6 -5
- data/lib/telnyx/telnyx_response.rb +13 -1
- data/lib/telnyx/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19e901560274959ee4663cac4796bf299c899d4bd9426257815507573cd1075a
|
4
|
+
data.tar.gz: a61bc5ee783350ce9332410a4d03954a96a5a83b068882bef54123639ee63fba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1e224fe8598c6f343d435f3ccfc9fb5afd37e264000ad8a6ac41634de614b34bc92e88fc5f502bb72cfc110fb7ad0eb0eb2a9f7343546632fc045ed2952b6ec7
|
7
|
+
data.tar.gz: f34fce7939700971e5e4a5c5377035ee652135879095e3d3a0192699efd0fa2546f6fe5966054dc418c793180d799c61c9caf891390be638be6c469f05048954
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.0.
|
1
|
+
3.0.4
|
@@ -16,12 +16,13 @@ module Telnyx
|
|
16
16
|
instance_methods: { create: action }
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
19
|
+
# Manually create JSON response object from JWT when calling token
|
20
|
+
def create_token(params = {}, opts = {})
|
21
|
+
url = "#{resource_url}/token"
|
22
|
+
resp, opts = request(:post, url, params, opts)
|
23
|
+
Util.convert_to_telnyx_object(resp.data, opts)
|
24
24
|
end
|
25
|
+
|
25
26
|
# Additional action to list tags
|
26
27
|
def self.tags(params = {}, opts = {})
|
27
28
|
opts = Util.normalize_opts(opts)
|
@@ -26,7 +26,7 @@ module Telnyx
|
|
26
26
|
# This may throw JSON::ParserError if the response body is not valid JSON.
|
27
27
|
def self.from_faraday_hash(http_resp)
|
28
28
|
resp = TelnyxResponse.new
|
29
|
-
resp.data =
|
29
|
+
resp.data = parse_response_body(http_resp[:body])
|
30
30
|
resp.http_body = http_resp[:body]
|
31
31
|
resp.http_headers = http_resp[:headers]
|
32
32
|
resp.http_status = http_resp[:status]
|
@@ -34,6 +34,18 @@ module Telnyx
|
|
34
34
|
resp
|
35
35
|
end
|
36
36
|
|
37
|
+
def self.parse_response_body(body)
|
38
|
+
if jwt_format?(body)
|
39
|
+
{ token: body }
|
40
|
+
else
|
41
|
+
JSON.parse(preprocess_response(body), symbolize_names: true)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.jwt_format?(body)
|
46
|
+
body.count(".") == 2 && body.split(".").all? { |segment| segment.match?(/\A[a-zA-Z0-9_-]+\z/) }
|
47
|
+
end
|
48
|
+
|
37
49
|
# Initializes a TelnyxResponse object from a Faraday HTTP response object.
|
38
50
|
#
|
39
51
|
# This may throw JSON::ParserError if the response body is not valid JSON.
|
data/lib/telnyx/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: telnyx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Telnyx
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|