ecoportal-api 0.10.15 → 0.10.19

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: b9f1140595821ac9fa4c456761eead0dcfa575c2fe638ed54c0d42cd3b24c7c7
4
- data.tar.gz: 62c241b84ab6552812a8e6b386aff188fd126201dbe6f5243f58882ccaa9572f
3
+ metadata.gz: fc93a32fe44f4a745aa6142c5963c3f6f80bd740bc2439728161f3287ea068b5
4
+ data.tar.gz: bd9a21e9631556d9eb0213d1460c6c3b088b4423568b9405c4a357e75b350d6c
5
5
  SHA512:
6
- metadata.gz: e82ade621496ffefce230aae2b95c5a0a5a54808b5c604ffdc7b3329c5221051f1780e0084c8ab4a7f8179c17b7fd4f5afba5da10510d9fa2b6eb985984ed529
7
- data.tar.gz: bc52feca422916fc79dcd4b5424c4fa6c04af03dea5496db8c9c1869926646ad0bbaffa3397ff7a560c51de47eee1d21853ca30b9e0692a73c7f1b801cbb18a1
6
+ metadata.gz: 881aa1ca8bb2dd35236f8da1f1b5a9a9a7b398c1e49eff09b3271d4ae89e72ea585177c1e03334adfc82b52b297b03f2f40cceb6c68085988448ecdd7e9146e3
7
+ data.tar.gz: 7b0cc3dd4730fe3b9177271a364b704c3b5b940e7a1202e8b89b94bcd24f6b9b8aa5662a83f31a40d173b9f1d1d048ffc57b38829727cd7582829090c0bd6e92
data/CHANGELOG.md CHANGED
@@ -2,7 +2,34 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [0.10.16] - 2026-01-xx
5
+ ## [Unreleased]
6
+
7
+ ## [0.10.19] - 2026-09-30
8
+
9
+ Security republish of 0.10.18 -- backwards-compatible, no code change: removes customer and
10
+ internal identifiers from shipped comments and this changelog; includes the full-path
11
+ packaging allowlist.
12
+
13
+ ### Fixed
14
+
15
+ - **`spec.files` is now allowlisted by full path, not by root directory.** The `0.10.18`
16
+ fix replaced the old denylist with `f.start_with?('lib/', 'exe/')`, which still ships
17
+ anything dropped into `lib/` regardless of what it is -- a directory prefix asserts
18
+ nothing about extension. This repo has not leaked under that rule, but a sibling gem's
19
+ identically-shaped root allowlist shipped five `CLAUDE.md` files out of its `lib/` in a
20
+ later release. `spec.files` now also requires `.rb` for anything under `lib/`, closing
21
+ the same hole here pre-emptively, with `spec/packaging_spec.rb` added to pin the rule.
22
+
23
+ ## [0.10.18] - 2026-08-13
24
+
25
+ ### Fixed
26
+
27
+ - Packaging-only republish with the allowlisted gemspec. `0.10.17` shipped internal repository
28
+ content (the repo's internal docs, `docs/self-docs/`, `docs/worklog.md`, `CLAUDE.md`,
29
+ `.claude/settings.json`) to rubygems.org via the old denylist `spec.files`. `0.10.18` is the
30
+ identical `lib/` code packaged clean; `0.10.17` will be yanked.
31
+
32
+ ## [0.10.17] - 2026-08-08
6
33
 
7
34
  ### Added
8
35
 
@@ -10,6 +37,19 @@ All notable changes to this project will be documented in this file.
10
37
 
11
38
  ### Fixed
12
39
 
40
+ - `WithRetry` never retried timeouts: `HTTP::TimeoutError` (and so `HTTP::ConnectTimeoutError`)
41
+ is a sibling of `HTTP::ConnectionError` in the `http` gem hierarchy, not a subclass — a
42
+ transient connect/read/write timeout propagated immediately and killed whole batches mid-loop
43
+ (live-confirmed on a customer integration, 2026-07-30). Added `HTTP::TimeoutError` to
44
+ `HANDLED_CONNECTION_ERRORS`; applies to all downstream gems that inherit this retry layer
45
+ (`ecoportal-api-v2`, `ecoportal-api-graphql`, `eco-helpers`).
46
+
47
+ ## [0.10.16] - 2026-06-05
48
+
49
+ ### Fixed
50
+
51
+ - Non-applicable _Missing API key!_ message.
52
+
13
53
  ## [0.10.15] - 2026-05-26
14
54
 
15
55
  ### Changed
@@ -5,8 +5,14 @@ module Ecoportal
5
5
  module WithRetry
6
6
  DELAY_REQUEST_RETRY = 5
7
7
  RETRY_ATTEMPTS = 5
8
+ # HTTP::TimeoutError is a SIBLING of HTTP::ConnectionError in the http gem's
9
+ # hierarchy (ConnectTimeoutError < TimeoutError < Error), so it must be listed
10
+ # explicitly: without it a transient connect/read/write timeout is never retried
11
+ # and kills a whole batch mid-loop (live-confirmed on a customer integration,
12
+ # 2026-07-30 — see internal script repos' migration notes).
8
13
  HANDLED_CONNECTION_ERRORS = [
9
14
  HTTP::ConnectionError,
15
+ HTTP::TimeoutError,
10
16
  IOError
11
17
  ].freeze
12
18
 
@@ -62,6 +62,8 @@ module Ecoportal
62
62
 
63
63
  return unless api_key.nil? || api_key.match(/\A\W*\z/)
64
64
  return unless self.version
65
+ return if self.version == 'graphql'
66
+ return if self.version == 'http'
65
67
 
66
68
  log(:error) { 'Api-key missing!' }
67
69
  end
@@ -69,11 +71,11 @@ module Ecoportal
69
71
  # Sends an http `GET` request against the api version using `path` to complete the base url,
70
72
  # and adding the key_value pairs of `params` in the http _header_.
71
73
  # @param path [String] the tail that completes the url of the request.
72
- # @param params [Hash] the header paramters of the http request (not including the api key).
74
+ # @param params [Hash] the header parameters of the http request (not including the api key).
73
75
  # @option params [String] :page the current page we are requesting with given the `:per_page` offset.
74
76
  # @option params [String] :per_page the offset or the number of entries you get per request.
75
77
  # @option params [String] :q some text to search. Omit this parameter to target all the entries.
76
- # @return [Common::Reponse] the basic custom response object.
78
+ # @return [Common::Response] the basic custom response object.
77
79
  def get(path, params: {})
78
80
  instrument('GET', path, params) do
79
81
  request do |http|
@@ -87,9 +89,9 @@ module Ecoportal
87
89
  # @note it automatically adds the http header param `Content-Type` as `application/json`
88
90
  # @param path [String] the tail that completes the url of the request.
89
91
  # @param data [String] the body of the query in json format.
90
- # @param params [Hash] the header paramters of the http request (not including the api key).
92
+ # @param params [Hash] the header parameters of the http request (not including the api key).
91
93
  # @option params [String] URL params; will depend on he API being used.
92
- # @return [Common::Reponse] the basic custom response object.
94
+ # @return [Common::Response] the basic custom response object.
93
95
  def post(path, data:, params: {})
94
96
  instrument('POST', path, params) do
95
97
  request do |http|
@@ -107,7 +109,7 @@ module Ecoportal
107
109
  # @note it automatically adds the http header param `Content-Type` as `application/json`
108
110
  # @param path [String] the tail that completes the url of the request.
109
111
  # @param data [String] the body of the query in json format.
110
- # @return [Common::Reponse] the basic custom response object.
112
+ # @return [Common::Response] the basic custom response object.
111
113
  def patch(path, data:)
112
114
  instrument('PATCH', path, data) do
113
115
  request do |http|
@@ -118,7 +120,7 @@ module Ecoportal
118
120
 
119
121
  # Sends an http `DELETE` request against the api version using `path` to complete the base url.
120
122
  # @param path [String] the tail that completes the url of the request.
121
- # @return [Common::Reponse] the basic custom response object.
123
+ # @return [Common::Response] the basic custom response object.
122
124
  def delete(path)
123
125
  instrument('DELETE', path) do
124
126
  request do |http|
@@ -132,14 +134,14 @@ module Ecoportal
132
134
  # @yield [http] launch specific http request.
133
135
  # @yieldparam http [HTTP] the http connection.
134
136
  # @yieldreturn [Common::Response] the basic custom response object.
135
- # @return [Common::Reponse] the basic custom response object.
137
+ # @return [Common::Response] the basic custom response object.
136
138
  def request
137
139
  wrap_response yield(base_request)
138
140
  end
139
141
 
140
142
  # Wrap with basic custom object of the gem for responses.
141
143
  # @param response [HTTP::Response]
142
- # @return [Common::Reponse] the basic custom response object.
144
+ # @return [Common::Response] the basic custom response object.
143
145
  def wrap_response(response)
144
146
  Ecoportal::API::Common::Response.new(response)
145
147
  end
@@ -151,7 +153,7 @@ module Ecoportal
151
153
  def base_request
152
154
  @base_request ||=
153
155
  case @version
154
- when 'v2'
156
+ when 'v2', 'v3'
155
157
  HTTP.headers('X-ECOPORTAL-API-KEY' => api_key).accept(:json)
156
158
  else
157
159
  HTTP.headers('X-ApiKey' => api_key).accept(:json)
@@ -205,7 +207,7 @@ module Ecoportal
205
207
  # log(:info) {'General information on what's going on'}
206
208
  # log(:warn) {'This is a warning that something is likely to have gone amiss'}
207
209
  # log(:error) {'Something went wrong'}
208
- # log(:fatal) {'An unrecoverable error has happend'}
210
+ # log(:fatal) {'An unrecoverable error has happened'}
209
211
  # @param level [Symbol] the level that the message should be logged.
210
212
  # @yield [] generates the message.
211
213
  # @yieldreturn [String] the generated message.
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- VERSION = '0.10.15'.freeze
3
+ VERSION = '0.10.19'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecoportal-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.15
4
+ version: 0.10.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tapio Saarinen
@@ -200,20 +200,9 @@ executables: []
200
200
  extensions: []
201
201
  extra_rdoc_files: []
202
202
  files:
203
- - ".gitignore"
204
- - ".markdownlint.json"
205
- - ".rspec"
206
- - ".rubocop.yml"
207
- - ".ruby-version"
208
- - ".yardopts"
209
203
  - CHANGELOG.md
210
- - Gemfile
211
204
  - LICENSE
212
205
  - README.md
213
- - Rakefile
214
- - bin/console
215
- - bin/setup
216
- - ecoportal-api.gemspec
217
206
  - lib/ecoportal/api.rb
218
207
  - lib/ecoportal/api/common.rb
219
208
  - lib/ecoportal/api/common/base_class.rb
data/.gitignore DELETED
@@ -1,25 +0,0 @@
1
- # it's a gem, ignore the lockfile
2
- Gemfile.lock
3
-
4
- # build artifacts
5
- *.gem
6
- /.bundle/
7
- /vendor/bundle
8
- /spec/reports/
9
- /tmp/
10
- /pkg/
11
-
12
- # docs
13
- /.yardoc
14
- /_yardoc/
15
- /coverage/
16
- /doc/
17
-
18
- # rspec failure tracking
19
- .rspec_status
20
- scratch.rb
21
-
22
- #byebug
23
- .byebug_history
24
-
25
- .solargraph.yml
data/.markdownlint.json DELETED
@@ -1,4 +0,0 @@
1
- {
2
- "MD013": false,
3
- "MD024": false
4
- }
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.rubocop.yml DELETED
@@ -1,102 +0,0 @@
1
- AllCops:
2
- TargetRubyVersion: 3.2
3
- Exclude:
4
- - 'config/routes.rb'
5
- NewCops: enable
6
-
7
- Metrics/ClassLength:
8
- Max: 500
9
- Metrics/ModuleLength:
10
- Max: 300
11
- Metrics/MethodLength:
12
- Max: 50
13
- Metrics/AbcSize:
14
- Max: 30
15
- Metrics/ParameterLists:
16
- Max: 5
17
- CountKeywordArgs: false
18
- Metrics/BlockLength:
19
- CountAsOne: ['array', 'heredoc', 'method_call']
20
- Max: 50
21
- Metrics/CyclomaticComplexity:
22
- Max: 30
23
- Metrics/PerceivedComplexity:
24
- Max: 30
25
-
26
- Style/AccessorGrouping:
27
- Enabled: false
28
- Style/ConditionalAssignment:
29
- Enabled: false
30
- Style/BlockDelimiters:
31
- BracesRequiredMethods: ['log']
32
- AllowedPatterns: ['proc', 'new']
33
- Style/HashSyntax:
34
- EnforcedShorthandSyntax: either
35
- EnforcedStyle: no_mixed_keys
36
- Style/ArgumentsForwarding:
37
- UseAnonymousForwarding: false
38
- Style/ClassAndModuleChildren:
39
- Enabled: false
40
- Style/FrozenStringLiteralComment:
41
- Enabled: false
42
- Style/StringLiterals:
43
- Enabled: false
44
- Style/StringLiteralsInInterpolation:
45
- Enabled: false
46
- Style/Documentation:
47
- Enabled: false
48
- Style/CommentedKeyword:
49
- Enabled: false
50
- Style/MultilineBlockChain:
51
- Enabled: false
52
- Style/AndOr:
53
- Enabled: false
54
- Style/Alias:
55
- EnforcedStyle: prefer_alias_method
56
- Style/FetchEnvVar:
57
- Enabled: false
58
- Style/RegexpLiteral:
59
- EnforcedStyle: mixed
60
- AllowInnerSlashes: true
61
-
62
- Layout/HashAlignment:
63
- EnforcedColonStyle: table
64
- EnforcedHashRocketStyle: table
65
- Layout/LeadingCommentSpace:
66
- Enabled: false
67
- AllowGemfileRubyComment: true
68
- Layout/ParameterAlignment:
69
- Enabled: false
70
- Layout/MultilineMethodDefinitionBraceLayout:
71
- EnforcedStyle: symmetrical
72
- Layout/LineLength:
73
- Enabled: true
74
- Layout/SpaceInsideHashLiteralBraces:
75
- Enabled: false
76
- Layout/SpaceInsideBlockBraces:
77
- Enabled: false
78
- Layout/SpaceAroundOperators:
79
- Enabled: false
80
- Layout/ExtraSpacing:
81
- AllowForAlignment: true
82
- AllowBeforeTrailingComments: true
83
- Layout/AccessModifierIndentation:
84
- EnforcedStyle: indent
85
- Layout/DotPosition:
86
- EnforcedStyle: trailing
87
- Layout/MultilineMethodCallIndentation:
88
- EnforcedStyle: indented
89
- Layout/FirstHashElementIndentation:
90
- Enabled: false
91
- Layout/EmptyLineAfterGuardClause:
92
- Enabled: false
93
-
94
- Naming/VariableNumber:
95
- EnforcedStyle: snake_case
96
- CheckSymbols: false
97
- Naming/MethodParameterName:
98
- AllowedNames: ['x', 'y', 'i', 'j', 'id', 'io', 'to']
99
- Naming/RescuedExceptionsVariableName:
100
- Enabled: false
101
- Naming/BlockForwarding:
102
- Enabled: false
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 3.2.2
data/.yardopts DELETED
@@ -1,10 +0,0 @@
1
- --readme README.md
2
- --charset utf-8
3
- --markup-provider=redcarpet
4
- --markup=markdown
5
- --no-private
6
- --output-dir ./doc
7
- 'lib/**/*.rb'
8
- -
9
- CHANGELOG.md
10
- LICENSE
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source "https://rubygems.org"
2
-
3
- git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
-
5
- # Specify your gem's dependencies in ecoportal-api.gemspec
6
- gemspec
data/Rakefile DELETED
@@ -1,38 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
- require 'rubocop/rake_task'
4
- require 'yard'
5
- require 'redcarpet'
6
-
7
- desc "run the specs"
8
- RSpec::Core::RakeTask.new(:spec)
9
-
10
- desc "run rspec showing backtrace"
11
- RSpec::Core::RakeTask.new(:spec_trace) do |task|
12
- task.rspec_opts = ['--backtrace']
13
- end
14
- task(rspec_trace: :spec_trace)
15
-
16
- desc "run rspec stopping on first fail, and show backtrace"
17
- RSpec::Core::RakeTask.new(:spec_fast) do |task|
18
- task.rspec_opts = ['--fail-fast', '--backtrace']
19
- end
20
- task(rspec_fast: :spec_fast)
21
-
22
- desc "run rubocop diaplying cop names"
23
- RuboCop::RakeTask.new(:rubocop) do |t|
24
- t.options = ['--display-cop-names']
25
- end
26
-
27
- # default task name is yard
28
- desc "Yard: generate all the documentation"
29
- YARD::Rake::YardocTask.new(:doc) do |t|
30
- #t.files = ['lib/**/*.rb']
31
- end
32
-
33
- desc "default task: runs rubocop and rspec"
34
- task :default do
35
- Rake::Task[:rubocop].invoke
36
- ensure
37
- Rake::Task[:spec].invoke
38
- end
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "ecoportal/api"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "pry"
14
- Pry.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,45 +0,0 @@
1
- # rubocop:disable Gemspec/DevelopmentDependencies
2
- lib = File.expand_path('lib', __dir__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
-
5
- require 'ecoportal/api/version'
6
-
7
- Gem::Specification.new do |spec|
8
- spec.name = "ecoportal-api"
9
- spec.version = Ecoportal::API::VERSION
10
- spec.authors = ['Tapio Saarinen']
11
- spec.email = [
12
- 'tapio@ecoportal.co.nz',
13
- 'oscar@ecoportal.co.nz'
14
- ]
15
-
16
- spec.summary = "A collection of helpers for interacting with the ecoPortal MS's various APIs"
17
- spec.homepage = "https://www.ecoportal.com"
18
- spec.licenses = %w[MIT]
19
-
20
- spec.metadata['rubygems_mfa_required'] = 'true'
21
-
22
- spec.required_ruby_version = '>= 3.2.2'
23
-
24
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
25
- f.match(%r{^(test|spec|features)/})
26
- end
27
- spec.bindir = 'exe'
28
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
- spec.require_paths = ['lib']
30
-
31
- spec.add_development_dependency 'pry', '~> 0.14'
32
- spec.add_development_dependency 'rake', '>= 13.0.3', '< 14'
33
- spec.add_development_dependency 'redcarpet', '>= 3.6.0', '< 4'
34
- spec.add_development_dependency 'rspec', '>= 3.12.0', '< 4'
35
- spec.add_development_dependency 'rubocop', '~> 1'
36
- spec.add_development_dependency 'rubocop-rake', '~> 0'
37
- spec.add_development_dependency 'yard', '~> 0.9'
38
-
39
- spec.add_dependency 'dotenv', '~> 3'
40
- spec.add_dependency 'elastic-apm', '>= 4.7', "< 5"
41
- spec.add_dependency 'http', '~> 5.1', "< 6"
42
- spec.add_dependency 'rate_throttle_client', '~> 0.1'
43
- end
44
-
45
- # rubocop:enable Gemspec/DevelopmentDependencies