api_recipes 2.5.0 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: febe7d307961dd407eae97ef0519280abf463e896f8a83471d3242b6f8a7b8a1
4
- data.tar.gz: 15df723f847728e9c433223eef128069204aa15344856a4388847860c45304f2
3
+ metadata.gz: 977a895fe8c06312c73575391e759f6bd23c91fbdad1d26dfb5bb66dfc494b09
4
+ data.tar.gz: 507c600f1ab08ea1bcec035d8a5e60178da5d08c4e5f49beb84fba64829f39b5
5
5
  SHA512:
6
- metadata.gz: 94627389adf247362789b3213f6ec2f45c4443e43c4212ec1fffa96f4796c4de9c097288ef0d328d657c98eb8590fa6908e89f77f080c09be1b0cb0b9c7f44d9
7
- data.tar.gz: a887790e2ac8c3ec7853d2a24735f6c79a7761287e76265854963e80f18320b63bb598365ba75fb316064ebf9c424569e09160f4dc3eb79ce4c09e6326e1972f
6
+ metadata.gz: a4bdfe19e5994165e5d2ab7256b66887c54951f2df93cd44417b4c019f10979532188ff21f581fbfb5ff8528c9d04063eda93326cefeda396a26a4d397c5d5dd
7
+ data.tar.gz: b67d63a82f8199e9c38bf043a0d3ba192d7613b34a3955d7aef0ef6df0d5a20017fce3be9083be8e0a697a6e96d7fcdfecb37b0aed3f43742f3600c7deb429cc
@@ -1,7 +1,7 @@
1
1
  module ApiRecipes
2
2
  class Configuration
3
3
 
4
- attr_accessor :log_to, :log_level
4
+ attr_accessor :log_to, :log_level, :print_urls
5
5
 
6
6
  def apis_configs=(configs = {})
7
7
  raise ArgumentError, 'apis_configs must be an Hash' unless configs.is_a? Hash
@@ -29,6 +29,10 @@ module ApiRecipes
29
29
  end
30
30
  end
31
31
 
32
+ def url
33
+ @route.url
34
+ end
35
+
32
36
  private
33
37
 
34
38
  def generate_route
@@ -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
- @uri = nil
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, @uri, request_params
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 build_uri_from_path
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
- @uri = build_uri_from_path
96
- puts @uri if ApiRecipes.print_urls
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
@@ -1,3 +1,3 @@
1
1
  module ApiRecipes
2
- VERSION = '2.5.0'.freeze
2
+ VERSION = '2.6.0'.freeze
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: 2.5.0
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-09-30 00:00:00.000000000 Z
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
- rubyforge_project:
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