3scale-api 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/3scale/api/http_client.rb +20 -4
- data/lib/3scale/api/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea3ac51993c3762a0a40625807148fdba4dbf390aa032bc97183f660220bf410
|
4
|
+
data.tar.gz: 3f5c198b2fbe44894007990f4f7e6d926400c4f89597acf9533a281c2fb77cd7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a5e4aff97c1716b24cdd5ba27385cf2babe88183dcc4894fcad0ca0df3e03df150e77fb80ff01485cca4bea47c4f6bade61a8c31aebdac8bd312aede6799af29
|
7
|
+
data.tar.gz: 2b86b756c210e5cc8270279d9f8ae258624ae6656594864d63d082b492b91b76e4c62a822ae6654243ba4585565acf6055906327303f71ec6e915b6603f22a16
|
@@ -68,16 +68,22 @@ module ThreeScale
|
|
68
68
|
|
69
69
|
class NotFoundError < ResponseError; end
|
70
70
|
|
71
|
+
class UnknownFormatError < StandardError; end
|
72
|
+
|
71
73
|
def forbidden!(response)
|
72
|
-
raise ForbiddenError.new(response)
|
74
|
+
raise ForbiddenError.new(response, format_response(response))
|
73
75
|
end
|
74
76
|
|
75
77
|
def notfound!(response)
|
76
|
-
raise NotFoundError.new(response)
|
78
|
+
raise NotFoundError.new(response, format_response(response))
|
77
79
|
end
|
78
80
|
|
79
81
|
def unexpected!(response)
|
80
|
-
raise UnexpectedResponseError.new(response, response
|
82
|
+
raise UnexpectedResponseError.new(response, format_response(response))
|
83
|
+
end
|
84
|
+
|
85
|
+
def unknownformat!
|
86
|
+
raise UnknownFormatError, "unknown format #{format}"
|
81
87
|
end
|
82
88
|
|
83
89
|
def serialize(body)
|
@@ -91,7 +97,7 @@ module ThreeScale
|
|
91
97
|
def parser
|
92
98
|
case format
|
93
99
|
when :json then JSONParser
|
94
|
-
else
|
100
|
+
else unknownformat!
|
95
101
|
end
|
96
102
|
end
|
97
103
|
|
@@ -108,6 +114,16 @@ module ThreeScale
|
|
108
114
|
path
|
109
115
|
end
|
110
116
|
|
117
|
+
def format_response(response)
|
118
|
+
body = response.body if text_based?(response)
|
119
|
+
"#{response.inspect} body=#{body}"
|
120
|
+
end
|
121
|
+
|
122
|
+
def text_based?(response)
|
123
|
+
response.content_type =~ /^text/ ||
|
124
|
+
response.content_type =~ /^application/ && !['application/octet-stream', 'application/pdf'].include?(response.content_type)
|
125
|
+
end
|
126
|
+
|
111
127
|
module JSONParser
|
112
128
|
module_function
|
113
129
|
|
data/lib/3scale/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: 3scale-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michal Cichra
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-
|
12
|
+
date: 2020-11-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -101,8 +101,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '0'
|
103
103
|
requirements: []
|
104
|
-
|
105
|
-
rubygems_version: 2.7.6
|
104
|
+
rubygems_version: 3.1.2
|
106
105
|
signing_key:
|
107
106
|
specification_version: 4
|
108
107
|
summary: API Client for 3scale APIs
|