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 +4 -4
- data/ChangeLog +4 -0
- data/lib/soaspec/interpreter.rb +24 -14
- data/lib/soaspec/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 746ec3677b28a1890e266a9abaadaf2f0d8db1c107157d5900f5e18a48dd043a
|
4
|
+
data.tar.gz: 79da33750c1c8228d61ab012c00c0134e26b1dec6a84f0dcb0dafa101951132f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90f61a58d94675f509b3e200c3f82194249d71289692d9677afd65e083beb923804562305ca3947a08a7700af5660490972649e6f091ada6462d530720bd28fe
|
7
|
+
data.tar.gz: 907e7e378ee388825ba91d7fd7ccb905d2650e83bfb0de046867fcfb604757e9f80b0b70bc07dc7c06f9bc9d14c01c62d379f85fe3939de637c57dd608e5dfe6
|
data/ChangeLog
CHANGED
data/lib/soaspec/interpreter.rb
CHANGED
@@ -2,24 +2,34 @@
|
|
2
2
|
# Help interpret the general type of a particular object
|
3
3
|
class Interpreter
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
|
data/lib/soaspec/version.rb
CHANGED