ecoportal-api 0.10.15 → 0.10.16
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 +4 -4
- data/CHANGELOG.md +11 -1
- data/CLAUDE.md +71 -0
- data/lib/ecoportal/api/common/client.rb +12 -10
- data/lib/ecoportal/api/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f6998cdda6bc8a40de4a368ab81d522cd9828cd8dbbb559a59948976e3f57dcb
|
|
4
|
+
data.tar.gz: ba86db2250fad20b429d1f5afa26a08b064e0eeb14ea90f096dceaf4973d362e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb91f3d928853691c913efbd17f0db1bda9343c44b1449275864fc16e053ef0d3cd1f14fd64e90625fc3ea991a81494c2a7315d318666184c14dd3acd51344f4
|
|
7
|
+
data.tar.gz: 57f8fc55f1d55f1733fe98720477739d72b063bae1f4a16665132e20a5560192275b5815e25d99097400fd2f5de4c7914a35823a8e5168ea34187e4e5d9ae98c
|
data/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
-
## [0.10.
|
|
5
|
+
## [0.10.17] - 2026-06-xx
|
|
6
6
|
|
|
7
7
|
### Added
|
|
8
8
|
|
|
@@ -10,6 +10,16 @@ All notable changes to this project will be documented in this file.
|
|
|
10
10
|
|
|
11
11
|
### Fixed
|
|
12
12
|
|
|
13
|
+
## [0.10.16] - 2026-06-05
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- Non-applicable _Missing API key!_ message.
|
|
22
|
+
|
|
13
23
|
## [0.10.15] - 2026-05-26
|
|
14
24
|
|
|
15
25
|
### Changed
|
data/CLAUDE.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# CLAUDE.md — ecoportal-api
|
|
2
|
+
|
|
3
|
+
AI agent instructions for this repository.
|
|
4
|
+
|
|
5
|
+
**Cross-cutting architecture context lives in `ecoportal-api-graphql` — see its `CLAUDE.md` and `.claude/` folder for the full dependency map, project history, and shared skills.**
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Repository Role
|
|
10
|
+
|
|
11
|
+
`ecoportal-api` is the **foundational REST API gem** in the EcoPortal Ruby stack. It provides authentication, HTTP client infrastructure, org context, and the `Ecoportal::API::Common` namespace that all downstream gems build on.
|
|
12
|
+
|
|
13
|
+
**Position in chain:**
|
|
14
|
+
```
|
|
15
|
+
ecoportal-api ← THIS REPO
|
|
16
|
+
↓
|
|
17
|
+
ecoportal-api-v2
|
|
18
|
+
↓
|
|
19
|
+
ecoportal-api-graphql
|
|
20
|
+
↓
|
|
21
|
+
eco-helpers
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Remote:** https://gitlab.ecoportal.co.nz/ecoportal/ecoportal-api.git
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Key Folder Layout
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
lib/ecoportal/api/
|
|
32
|
+
common/ Shared infrastructure (client, logging, response, batch, hash_diff)
|
|
33
|
+
client/ HTTP client — rate throttling, retries, timeouts, APM, error handling
|
|
34
|
+
errors/ Shared error classes
|
|
35
|
+
internal/ Internal API resources (people, permissions, schema, login providers)
|
|
36
|
+
v1/ REST API v1 resources (people, schema, jobs)
|
|
37
|
+
logger.rb Shared logger
|
|
38
|
+
version.rb Gem version
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Namespace
|
|
44
|
+
|
|
45
|
+
`Ecoportal::API` — specifically:
|
|
46
|
+
- `Ecoportal::API::Common` — shared base classes (consumed by `ecoportal-api-v2` and `ecoportal-api-graphql`)
|
|
47
|
+
- `Ecoportal::API::Internal` — internal API endpoints
|
|
48
|
+
- `Ecoportal::API::V1` — v1 REST endpoints
|
|
49
|
+
|
|
50
|
+
---
|
|
51
|
+
|
|
52
|
+
## Key Concerns
|
|
53
|
+
|
|
54
|
+
- `Common::Client` — base HTTP client with rate throttling, retry logic, timeouts, and APM integration. All downstream clients inherit or wrap this.
|
|
55
|
+
- `Common::BaseModel` / `Common::BaseClass` — base model classes. `ecoportal-api-v2` extends these heavily.
|
|
56
|
+
- Changes to `Common::` affect **all downstream gems** — treat as a public API.
|
|
57
|
+
|
|
58
|
+
---
|
|
59
|
+
|
|
60
|
+
## Backwards Compatibility
|
|
61
|
+
|
|
62
|
+
Changes to `Ecoportal::API::Common::*` propagate to `ecoportal-api-v2`, `ecoportal-api-graphql`, and `eco-helpers`. Any breaking change must be coordinated across the chain.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Running Tests
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
bundle install
|
|
70
|
+
bundle exec rspec
|
|
71
|
+
```
|
|
@@ -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
|
|
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::
|
|
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
|
|
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::
|
|
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::
|
|
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::
|
|
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::
|
|
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::
|
|
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
|
|
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.
|
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.
|
|
4
|
+
version: 0.10.16
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tapio Saarinen
|
|
@@ -207,6 +207,7 @@ files:
|
|
|
207
207
|
- ".ruby-version"
|
|
208
208
|
- ".yardopts"
|
|
209
209
|
- CHANGELOG.md
|
|
210
|
+
- CLAUDE.md
|
|
210
211
|
- Gemfile
|
|
211
212
|
- LICENSE
|
|
212
213
|
- README.md
|