ecoportal-api-v2 3.3.1 → 3.3.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: 3bec4b516ab8e7355727c70598185b370f0165e944bae0cde0e852d94d80be95
4
- data.tar.gz: eb74199d7ea533a76b03b0db49f2260d6627c2c123538b5198ab504c2eec5a29
3
+ metadata.gz: fcf0d1bcb9682c389d37e23c34f5e8b358fec8867dcc42da783279e9d7b3de85
4
+ data.tar.gz: 62f6710a5f91ad24960ccd6cd03b83703de067e6cbcd7f49f2814ed792e5b287
5
5
  SHA512:
6
- metadata.gz: d787c2dab1e01fa783f1612193e1ae4c07a6c2fb131208de512cd48f8f30080c1c9c9816eba0738a14627d5af6b7c592e8dc606af5a809df2318f398fef37238
7
- data.tar.gz: aaa1fa2d08bde158aae7142673c497f7c0347fac765cc0cf397a209a8b7d6492cfdb1312767228f1b4ca83fb5c0db024099a1e2ba69b8b68ec92764e7e470c55
6
+ metadata.gz: f398d701389d9a3f705385a86ed7f14bf055b77e244fef3f735fe5d63d85974d305520a77bb142506c8ede0d7ab2436fe520098c859fba950f7c18ed65594c8e
7
+ data.tar.gz: b01280b46c5168ab31d510680ee8d46b650c0c25dc4540784fff591a2160fe848f7e6d7a365259ddaea53199f4e1381eca6aa8d0a391d89e134bddf2206bb9d0
data/.rubocop.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  AllCops:
2
- TargetRubyVersion: 3.2.2
2
+ TargetRubyVersion: 3.2
3
3
  Exclude:
4
4
  - 'config/routes.rb'
5
5
  NewCops: enable
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
- ## [3.3.2] - 2025-06-xx
5
+ ## [3.3.3] - 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
+ ## [3.3.2] - 2026-06-05
14
+
15
+ ### Added
16
+
17
+ - **AI**: instructions
18
+
19
+ ### Changed
20
+
21
+ - upgraded `ecoportal-api` gem.
22
+
13
23
  ## [3.3.1] - 2025-06-11
14
24
 
15
25
  ### Changed
data/CLAUDE.md ADDED
@@ -0,0 +1,82 @@
1
+ # CLAUDE.md — ecoportal-api-v2
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-v2` is the **REST API v2 gem**, extending `ecoportal-api` with a rich content model layer (pages, registers, people, S3 file handling). It provides the `Ecoportal::API::V2` and `Ecoportal::API::Common::Content` namespaces.
12
+
13
+ **Position in chain:**
14
+ ```
15
+ ecoportal-api
16
+
17
+ ecoportal-api-v2 ← THIS REPO
18
+
19
+ ecoportal-api-graphql
20
+
21
+ eco-helpers
22
+ ```
23
+
24
+ **Remote:** https://gitlab.ecoportal.co.nz/oscar/ecoportal-api-v2.git
25
+
26
+ ---
27
+
28
+ ## Key Folder Layout
29
+
30
+ ```
31
+ lib/ecoportal/api/
32
+ common/
33
+ concerns/ Benchmarkable, Threadable mixins
34
+ content/ Core model infrastructure (see below)
35
+ v2/
36
+ page/ Page model — sections, stages, components, forces, permissions
37
+ page/component/ All field types (text, number, date, selection, files, geo, etc.)
38
+ pages/ Pages collection, stage results, tasks
39
+ registers/ Register models — search results, stage/page results
40
+ people/ V2 people endpoint
41
+ s3/ S3 file upload/download infrastructure
42
+ ```
43
+
44
+ ### `Common::Content` — the model engine
45
+
46
+ The most complex part of this gem. Key classes:
47
+
48
+ - `DoubleModel` — two-layer model (a "live" doc and a "patch" doc) with attribute DSL, diffing, nesting, and change tracking. Almost all V2 models inherit from this.
49
+ - `CollectionModel` — ordered collection with upsert/delete/mutation support.
50
+ - `ClassHelpers` — `class_resolver` macro for injectable class references (pattern shared with `ecoportal-api-graphql`).
51
+ - `DocHelpers`, `ModelHelpers`, `IncluderHelpers` — utility mixins for model construction.
52
+
53
+ ---
54
+
55
+ ## Namespace
56
+
57
+ - `Ecoportal::API::V2` — v2 REST resources
58
+ - `Ecoportal::API::Common::Content` — shared model infrastructure (consumed downstream)
59
+ - `Ecoportal::API::Common::Concerns` — threading and benchmarking mixins
60
+
61
+ ---
62
+
63
+ ## Key Concerns
64
+
65
+ - `DoubleModel` is the foundational abstraction — understand it before modifying any V2 model.
66
+ - `Common::Content::ClassHelpers` mirrors the `ClassHelpers` in `ecoportal-api-graphql` — changes to one may need mirroring in the other.
67
+ - S3 upload is async with polling (`s3/files/poll.rb`) — timing-sensitive code.
68
+
69
+ ---
70
+
71
+ ## Backwards Compatibility
72
+
73
+ `eco-helpers` and `ecoportal-api-graphql` both depend on this gem. Changes to `Common::Content::*` or `V2::Page::*` interfaces must be checked against usage in both downstream gems before committing.
74
+
75
+ ---
76
+
77
+ ## Running Tests
78
+
79
+ ```bash
80
+ bundle install
81
+ bundle exec rspec
82
+ ```
@@ -33,7 +33,7 @@ Gem::Specification.new do |spec|
33
33
  spec.add_development_dependency 'rubocop-rake', '~> 0'
34
34
  spec.add_development_dependency 'yard', '~> 0.9'
35
35
 
36
- spec.add_dependency 'ecoportal-api', '~> 0.10', '>= 0.10.12'
36
+ spec.add_dependency 'ecoportal-api', '~> 0.10', '>= 0.10.16'
37
37
  spec.add_dependency 'mime-types', '~> 3.5', '>= 3.5.2'
38
38
  end
39
39
 
@@ -16,6 +16,7 @@ module Ecoportal
16
16
 
17
17
  def benchmarking(ref = nil, units: 1, print: false, &block)
18
18
  return yield unless benchmark_enabled?
19
+
19
20
  benchmark_mem(ref, units: units, print: false) do
20
21
  benchmark_time(ref, units: units, print: false, &block)
21
22
  end.tap do
@@ -35,6 +35,7 @@ module Ecoportal
35
35
  def as_json
36
36
  doc
37
37
  end
38
+ alias_method :to_h, :as_json
38
39
 
39
40
  def print_pretty
40
41
  puts JSON.pretty_generate(as_json)
@@ -3,7 +3,9 @@ module Ecoportal
3
3
  class V2
4
4
  class S3
5
5
  class Files
6
- # Class service to upload multiple files in one go
6
+ # Class service to upload multiple files in one go.
7
+ # Full cycle: from local files to the org file manager.
8
+ # @note it uploads to S3, and converts it into a file container as well.
7
9
  class BatchUpload
8
10
  include Ecoportal::API::Common::Concerns::Benchmarkable
9
11
  include Ecoportal::API::Common::Concerns::Threadable
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- GEM2_VERSION = '3.3.1'.freeze
3
+ GEM2_VERSION = '3.3.2'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecoportal-api-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.1
4
+ version: 3.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-06-11 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: pry
@@ -135,7 +134,7 @@ dependencies:
135
134
  version: '0.10'
136
135
  - - ">="
137
136
  - !ruby/object:Gem::Version
138
- version: 0.10.12
137
+ version: 0.10.16
139
138
  type: :runtime
140
139
  prerelease: false
141
140
  version_requirements: !ruby/object:Gem::Requirement
@@ -145,7 +144,7 @@ dependencies:
145
144
  version: '0.10'
146
145
  - - ">="
147
146
  - !ruby/object:Gem::Version
148
- version: 0.10.12
147
+ version: 0.10.16
149
148
  - !ruby/object:Gem::Dependency
150
149
  name: mime-types
151
150
  requirement: !ruby/object:Gem::Requirement
@@ -166,7 +165,6 @@ dependencies:
166
165
  - - ">="
167
166
  - !ruby/object:Gem::Version
168
167
  version: 3.5.2
169
- description:
170
168
  email:
171
169
  - oscar@ecoportal.co.nz
172
170
  executables: []
@@ -180,6 +178,7 @@ files:
180
178
  - ".ruby-version"
181
179
  - ".yardopts"
182
180
  - CHANGELOG.md
181
+ - CLAUDE.md
183
182
  - Gemfile
184
183
  - LICENSE
185
184
  - README.md
@@ -334,7 +333,6 @@ licenses:
334
333
  - MIT
335
334
  metadata:
336
335
  rubygems_mfa_required: 'true'
337
- post_install_message:
338
336
  rdoc_options: []
339
337
  require_paths:
340
338
  - lib
@@ -349,8 +347,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
349
347
  - !ruby/object:Gem::Version
350
348
  version: '0'
351
349
  requirements: []
352
- rubygems_version: 3.5.23
353
- signing_key:
350
+ rubygems_version: 4.0.8
354
351
  specification_version: 4
355
352
  summary: A collection of helpers for interacting with the ecoPortal MS's V2 API
356
353
  test_files: []