soaspec 0.0.82 → 0.0.83

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: b665f8fd5cc430c65a0c58f55d089357300b02fe9317c8d81f266682ac9d6e7f
4
- data.tar.gz: 965778e5a1208f0f2eb66d89f3f2100e6c2ce086a3a44ff56baa4df5ee3245c4
3
+ metadata.gz: 746ec3677b28a1890e266a9abaadaf2f0d8db1c107157d5900f5e18a48dd043a
4
+ data.tar.gz: 79da33750c1c8228d61ab012c00c0134e26b1dec6a84f0dcb0dafa101951132f
5
5
  SHA512:
6
- metadata.gz: 82c53305ca2d84fa2267f72406ba381bad05693bf2dcc1c6154b5ebebdd780ac66146db91b2a57f0f773511b29dd8d55688bec1eabe9e4a7e77a57c21b1c9517
7
- data.tar.gz: d23504d491f992156cf434a368139cf762e83b6cd46d2108e1ddf0ff093fc75be38078168e84e1ee3c6264af36071e595e1df17e5cd302dd9f2c200797132071
6
+ metadata.gz: 90f61a58d94675f509b3e200c3f82194249d71289692d9677afd65e083beb923804562305ca3947a08a7700af5660490972649e6f091ada6462d530720bd28fe
7
+ data.tar.gz: 907e7e378ee388825ba91d7fd7ccb905d2650e83bfb0de046867fcfb604757e9f80b0b70bc07dc7c06f9bc9d14c01c62d379f85fe3939de637c57dd608e5dfe6
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ Version 0.0.83
2
+ * Enhancements
3
+ * Handle BOM or other characters that could be at start of xml of json response string
4
+
1
5
  Version 0.0.82
2
6
  * Enhancements
3
7
  * Fixed namespace handling for REST
@@ -2,24 +2,34 @@
2
2
  # Help interpret the general type of a particular object
3
3
  class Interpreter
4
4
 
5
- # @param [Object] response API response
6
- # @return [Symbol] Type of provided response
7
- def self.response_type_for(response)
8
- if response.is_a? String
9
- case response.strip.body[0]
10
- when '<'
5
+ class << self
6
+ # @param [Object] response API response
7
+ # @return [Symbol] Type of provided response
8
+ def response_type_for(response)
9
+ @response = response
10
+ if @response.is_a? String
11
+ if xml?
12
+ :xml
13
+ elsif json?
14
+ :json
15
+ else
16
+ :unknown
17
+ end
18
+ elsif response.is_a? Hash
19
+ :hash
20
+ elsif response.is_a? Nokogiri::XML::NodeSet
11
21
  :xml
12
- when '{', '['
13
- :json
14
22
  else
15
23
  :unknown
16
24
  end
17
- elsif response.is_a? Hash
18
- :hash
19
- elsif response.is_a? Nokogiri::XML::NodeSet
20
- :xml
21
- else
22
- :unknown
25
+ end
26
+
27
+ def xml?
28
+ @response.include?('<') && @response.include?('>')
29
+ end
30
+
31
+ def json?
32
+ @response.include?('{') && @response.include?('}')
23
33
  end
24
34
  end
25
35
 
@@ -1,3 +1,3 @@
1
1
  module Soaspec
2
- VERSION = '0.0.82'.freeze
2
+ VERSION = '0.0.83'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: soaspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.82
4
+ version: 0.0.83
5
5
  platform: ruby
6
6
  authors:
7
7
  - SamuelGarrattIQA