api_recipes 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/api_recipes/resource.rb +13 -13
- data/lib/api_recipes/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 41b256b43696edaa5735f827046946ee0ee438ec69fc90387cfc3c9a841828b8
|
4
|
+
data.tar.gz: dcab748e71d294af415263f5e1c6a5c2c55374f782d34ec3e389069aaa132431
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 42963a27d5644ea0e1b6afc22f393cfe5f9db95a8d2bfa83beffaeca7ee8bd59995c227c124b1ab0df059b950d175a74175fa05bde1c8a88f01b294c514bc4ba
|
7
|
+
data.tar.gz: 0b5ea14d92e44fc67ea5b8af1d1debd654b43974c5b98c88c8ba45555567fb2980387a6fa5e2ed3dd9ff964b7981cd976c40005c65b3f51f6c181a60ac6f0607
|
data/lib/api_recipes/resource.rb
CHANGED
@@ -27,12 +27,8 @@ module ApiRecipes
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def build_request
|
30
|
-
|
31
|
-
|
32
|
-
.timeout :global,
|
33
|
-
write: per_kind_timeout,
|
34
|
-
connect: per_kind_timeout,
|
35
|
-
read: per_kind_timeout
|
30
|
+
|
31
|
+
|
36
32
|
end
|
37
33
|
|
38
34
|
def build_uri_from(path)
|
@@ -112,12 +108,16 @@ module ApiRecipes
|
|
112
108
|
end
|
113
109
|
end
|
114
110
|
|
115
|
-
def request
|
116
|
-
HTTP
|
117
|
-
end
|
118
|
-
|
119
111
|
def request_with_auth
|
120
|
-
req =
|
112
|
+
req = HTTP
|
113
|
+
req = req.headers(extract_headers)
|
114
|
+
.timeout(
|
115
|
+
:global,
|
116
|
+
write: per_kind_timeout,
|
117
|
+
connect: per_kind_timeout,
|
118
|
+
read: per_kind_timeout
|
119
|
+
)
|
120
|
+
|
121
121
|
if basic_auth
|
122
122
|
req = req.basic_auth basic_auth
|
123
123
|
elsif ba = @endpoint.basic_auth
|
@@ -151,11 +151,11 @@ module ApiRecipes
|
|
151
151
|
residual_params = nil unless residual_params.any?
|
152
152
|
uri = build_uri_from path
|
153
153
|
|
154
|
-
response =
|
154
|
+
response = request_with_auth.send(route_attributes[:method], uri, encode_residual_params(route_attributes, residual_params))
|
155
155
|
check_response_code route, route_attributes, response
|
156
156
|
|
157
157
|
if block_given?
|
158
|
-
body = Oj.load
|
158
|
+
body = Oj.load(response.body.to_s)
|
159
159
|
yield body, response.code, response.reason
|
160
160
|
else
|
161
161
|
response
|
data/lib/api_recipes/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_recipes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Verlato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: oj
|
@@ -95,7 +95,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
95
|
version: '0'
|
96
96
|
requirements: []
|
97
97
|
rubyforge_project:
|
98
|
-
rubygems_version: 2.7.
|
98
|
+
rubygems_version: 2.7.9
|
99
99
|
signing_key:
|
100
100
|
specification_version: 4
|
101
101
|
summary: Consume HTTP APIs with style
|