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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 265fba1c89068507ade75fab2ea20832df8ba56f80fe01dab130bba8568316e9
4
- data.tar.gz: e274bda1782776e2eeed051bd55941db566829c96e8534b8c70d162fc85ba0fa
3
+ metadata.gz: 41b256b43696edaa5735f827046946ee0ee438ec69fc90387cfc3c9a841828b8
4
+ data.tar.gz: dcab748e71d294af415263f5e1c6a5c2c55374f782d34ec3e389069aaa132431
5
5
  SHA512:
6
- metadata.gz: 48937113000d9b7b5749fd2d6adba76dbbc62ff9cf7fd4323da8205b8c9bcfc95efbdffefca9e6b32d483f89b221d7f2c74ab57d33817c3c8a98b9cfd9e17fad
7
- data.tar.gz: c1c636d39733bb3d99f3644879164467e87d09db8f2ef013b93110159bcde21ec0d8c65c03a5cc2dbc528ef5cf59b3d9f05d7cb9a128ff69b4945255a738b014
6
+ metadata.gz: 42963a27d5644ea0e1b6afc22f393cfe5f9db95a8d2bfa83beffaeca7ee8bd59995c227c124b1ab0df059b950d175a74175fa05bde1c8a88f01b294c514bc4ba
7
+ data.tar.gz: 0b5ea14d92e44fc67ea5b8af1d1debd654b43974c5b98c88c8ba45555567fb2980387a6fa5e2ed3dd9ff964b7981cd976c40005c65b3f51f6c181a60ac6f0607
@@ -27,12 +27,8 @@ module ApiRecipes
27
27
  end
28
28
 
29
29
  def build_request
30
- request_with_auth
31
- .headers(extract_headers)
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 = request
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 = build_request.send(route_attributes[:method], uri, encode_residual_params(route_attributes, residual_params))
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 response.body.to_s
158
+ body = Oj.load(response.body.to_s)
159
159
  yield body, response.code, response.reason
160
160
  else
161
161
  response
@@ -1,3 +1,3 @@
1
1
  module ApiRecipes
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
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.0
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: 2018-11-20 00:00:00.000000000 Z
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.7
98
+ rubygems_version: 2.7.9
99
99
  signing_key:
100
100
  specification_version: 4
101
101
  summary: Consume HTTP APIs with style