api_recipes 2.10.0 → 2.10.2

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: c808d9077305dc07cd888f517b57f1522490866a548dc769a3c96c083d24ce27
4
- data.tar.gz: 205b4aaaa135b8682f7d7f0d44f471263852e997f2b1791fe60eea4efc0a2ee3
3
+ metadata.gz: 901f6a4dff9765f9942e3da126a3f26329421514ae47ae13ed5c5e2849f24ade
4
+ data.tar.gz: 0c1fa41443789ca366f27424b862aa46028648b2d914255d8454c159697ba7d7
5
5
  SHA512:
6
- metadata.gz: 89acbd66ece24f8cd88100eb447c45e3b73c30c9f894b51a5995aa7697f6a76b92bae0b41c117dbc0b38f993876ca8b4efd17f64eaf7ca1ae31e0d04b5544120
7
- data.tar.gz: a831d53f7a337cc65ec28d09eb74ca8efa69123cf34ae835776c5414dd58725cc0223e7ee7aa70d0c1dbbebfff924f8d3d8340227ade47f42d7be4e3ffd877dd
6
+ metadata.gz: 353664249eab70f9ab15835a0ae4d460363f92fbfe53b11dc2371a96aedd04483b81c68d0b5a6b3dc52b954c3bff3410ed92b18a04f752958c7317772116d9d6
7
+ data.tar.gz: 78630e64218cfc64f9e2217ad1e846f378e39c323553f04c8029c97ad6e19404574d2a3854bad619b2aece4d7d70087351e5968ccba954bb80c5fc1d137d0213
@@ -1,5 +1,6 @@
1
1
  require 'yaml'
2
2
  require 'erb'
3
+ require 'logger'
3
4
 
4
5
  module ApiRecipes
5
6
  class Configuration
@@ -33,7 +34,7 @@ module ApiRecipes
33
34
  # Merge file contents into apis_configs
34
35
  data.each do |api, params|
35
36
  if apis_configs[api]
36
- logger.warn "File at #{file_path} overrides config for '#{api}' API"
37
+ logger.debug "File at #{file_path} overrides config for '#{api}' API"
37
38
  end
38
39
  apis_configs[api] = params
39
40
  end
@@ -53,7 +54,7 @@ module ApiRecipes
53
54
 
54
55
  def logger
55
56
  unless @logger
56
- log = ::Logger.new(log_to)
57
+ log = ::Logger.new(log_to || STDOUT)
57
58
  log.level = normalize_log_level
58
59
  log.progname = 'ApiRecipes'
59
60
  @logger = log
@@ -77,7 +78,7 @@ module ApiRecipes
77
78
  when :error, ::Logger::ERROR, 'error' then ::Logger::ERROR
78
79
  when :fatal, ::Logger::FATAL, 'fatal' then ::Logger::FATAL
79
80
  else
80
- Logger::ERROR
81
+ ENV['LOG_LEVEL'] || Logger::DEBUG
81
82
  end
82
83
  end
83
84
  end
@@ -32,7 +32,12 @@ module ApiRecipes
32
32
  end
33
33
 
34
34
  def url
35
- @route.url
35
+ if @route
36
+ @route.url
37
+ else
38
+ ApiRecipes.logger.debug "No route configured for '#{api.name}#{absolute_path}': Is option 'route: no' present?"
39
+ nil
40
+ end
36
41
  end
37
42
 
38
43
  private
@@ -48,7 +48,7 @@ module ApiRecipes
48
48
  @expected_code = expected_code
49
49
  @response = response
50
50
  unless message
51
- message = "response code for request on route '#{@path}' has returned '#{@response.code}', but '#{@expected_code}' was expected\n\nResponse body:\n #{@response.body}"
51
+ message = "response code for request on route '#{@path}' has returned '#{@response.code}', but '#{@expected_code}' was expected"
52
52
  end
53
53
  super(message)
54
54
  end
@@ -1,3 +1,3 @@
1
1
  module ApiRecipes
2
- VERSION = '2.10.0'.freeze
2
+ VERSION = '2.10.2'.freeze
3
3
  end
data/lib/api_recipes.rb CHANGED
@@ -146,6 +146,10 @@ module ApiRecipes
146
146
  global_api_configs
147
147
  end
148
148
  end
149
+
150
+ def self.logger
151
+ configuration.logger
152
+ end
149
153
  end
150
154
 
151
155
  # Monkey-patch URI so it can accept dashed hostnames like "web-service-1"
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.10.0
4
+ version: 2.10.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alessandro Verlato
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-24 00:00:00.000000000 Z
11
+ date: 2024-06-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  requirements: []
71
- rubygems_version: 3.3.7
71
+ rubygems_version: 3.5.4
72
72
  signing_key:
73
73
  specification_version: 4
74
74
  summary: Consume HTTP APIs with style