api_recipes 2.5.0 → 2.6.0
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/configuration.rb +1 -1
- data/lib/api_recipes/endpoint.rb +4 -0
- data/lib/api_recipes/route.rb +6 -8
- data/lib/api_recipes/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: 977a895fe8c06312c73575391e759f6bd23c91fbdad1d26dfb5bb66dfc494b09
|
4
|
+
data.tar.gz: 507c600f1ab08ea1bcec035d8a5e60178da5d08c4e5f49beb84fba64829f39b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4bdfe19e5994165e5d2ab7256b66887c54951f2df93cd44417b4c019f10979532188ff21f581fbfb5ff8528c9d04063eda93326cefeda396a26a4d397c5d5dd
|
7
|
+
data.tar.gz: b67d63a82f8199e9c38bf043a0d3ba192d7613b34a3955d7aef0ef6df0d5a20017fce3be9083be8e0a697a6e96d7fcdfecb37b0aed3f43742f3600c7deb429cc
|
data/lib/api_recipes/endpoint.rb
CHANGED
data/lib/api_recipes/route.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module ApiRecipes
|
2
2
|
class Route
|
3
3
|
|
4
|
-
attr_reader :request, :response
|
4
|
+
attr_reader :request, :response, :url
|
5
5
|
attr_accessor :request_params, :attributes, :path
|
6
6
|
|
7
7
|
def initialize(api: nil, endpoint: nil, path: nil, attributes: {}, req_pars: {})
|
@@ -10,7 +10,7 @@ module ApiRecipes
|
|
10
10
|
@path = path.to_s
|
11
11
|
@attributes = attributes
|
12
12
|
self.request_params = req_pars
|
13
|
-
@
|
13
|
+
@url = nil
|
14
14
|
|
15
15
|
prepare_request
|
16
16
|
end
|
@@ -28,7 +28,7 @@ module ApiRecipes
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def start_request(&block)
|
31
|
-
original_response = @request.send http_verb, @
|
31
|
+
original_response = @request.send http_verb, @url, request_params
|
32
32
|
@response = Response.new original_response, attributes
|
33
33
|
check_response_code
|
34
34
|
|
@@ -41,7 +41,7 @@ module ApiRecipes
|
|
41
41
|
|
42
42
|
private
|
43
43
|
|
44
|
-
def
|
44
|
+
def build_url_from_path
|
45
45
|
attrs = {
|
46
46
|
scheme: settings[:protocol],
|
47
47
|
host: settings[:host],
|
@@ -68,8 +68,6 @@ module ApiRecipes
|
|
68
68
|
when 'ignore'
|
69
69
|
when 'raise'
|
70
70
|
raise ResponseCodeNotAsExpected.new(path, expected_code, code, @response.body)
|
71
|
-
when 'return_false'
|
72
|
-
return false
|
73
71
|
end
|
74
72
|
end
|
75
73
|
end
|
@@ -92,8 +90,8 @@ module ApiRecipes
|
|
92
90
|
end
|
93
91
|
|
94
92
|
def prepare_request
|
95
|
-
@
|
96
|
-
puts @
|
93
|
+
@url = build_url_from_path
|
94
|
+
puts @url if ApiRecipes.configuration.print_urls
|
97
95
|
|
98
96
|
@request = request_with_auth
|
99
97
|
end
|
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: 2.
|
4
|
+
version: 2.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Verlato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-10-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -62,8 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
62
62
|
- !ruby/object:Gem::Version
|
63
63
|
version: '0'
|
64
64
|
requirements: []
|
65
|
-
|
66
|
-
rubygems_version: 2.7.7
|
65
|
+
rubygems_version: 3.1.4
|
67
66
|
signing_key:
|
68
67
|
specification_version: 4
|
69
68
|
summary: Consume HTTP APIs with style
|