classy_plivo 0.1.0 → 0.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
  SHA1:
3
- metadata.gz: 319d9a4ada1a05f394bd3d77fb4f4d55862a8038
4
- data.tar.gz: 236e725fd6da9f8b19673c247ccbf98a3eb4153f
3
+ metadata.gz: a009b6a057ada298d7d39fe1e3b45c721eec3f8f
4
+ data.tar.gz: 7a4ea8acaec01d6d0e097b7e5d8a9481207ccb0d
5
5
  SHA512:
6
- metadata.gz: 79738e1a4a175f6656045006caed17b0982342f9ff8a4ed2a1f8f3e02de3157569369ef18a5aae54ae6c5ff1990ed886617e55da696678490e7fe8a39027c1a2
7
- data.tar.gz: 0ba13573698a1ca99d002263e9c276f7d43029b03f912254954f2692fc52bb54df2d03833a0afb7a41440edbd501178563c68ec653b419e280cfd7ce5f64859f
6
+ metadata.gz: 256eeb04c87a759ec214af5359a507124a6e9eabf16e7fa1d87d8829dead6671b638b460999679b80ce3fa63843cc702ab4a1c3bb8b02a39a220c999c82776b1
7
+ data.tar.gz: 76472a3700f46e84f9c7206608b8af39c07762bceb347faa00bacc2c0b1706189f83c7af115624eaff81d7357501558aba4d569885409fbe7d0ec1de2a9c4058
@@ -7,8 +7,7 @@ module ClassyPlivo
7
7
  NoPayloadKeyError = Class.new(NoMethodError)
8
8
 
9
9
  def initialize(response)
10
- @http_status = response[0]
11
- @payload = response[1]
10
+ @http_status, @payload = response
12
11
  end
13
12
 
14
13
  # True if 4XX or 5XX status code is received
@@ -7,7 +7,23 @@ module ClassyPlivo
7
7
  end
8
8
 
9
9
  def method_missing(method, *args, &block)
10
- Response.new(plivo_api.send(method, args, &block))
10
+ result = plivo_api.send(method, *args, &block)
11
+ if resembles_plivo_response?(result)
12
+ Response.new(result)
13
+ else
14
+ result
15
+ end
16
+ end
17
+
18
+ private
19
+
20
+ def resembles_plivo_response?(result)
21
+ if result.is_a?(Array)
22
+ http_status, payload = result
23
+ http_status.is_a?(Integer) && payload.is_a?(Hash)
24
+ else
25
+ false
26
+ end
11
27
  end
12
28
  end
13
29
  end
@@ -1,3 +1,3 @@
1
1
  module ClassyPlivo
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: classy_plivo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Faraz Yashar