ecoportal-api-v2 1.1.4 → 1.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -6
- data/README.md +5 -0
- data/ecoportal-api-v2.gemspec +5 -5
- data/lib/ecoportal/api/common/content/collection_model.rb +20 -1
- data/lib/ecoportal/api/common/content/double_model.rb +6 -1
- data/lib/ecoportal/api/v2/registers/page_result/membrane_droplet.rb +15 -0
- data/lib/ecoportal/api/v2/registers/page_result.rb +6 -2
- data/lib/ecoportal/api/v2_version.rb +1 -1
- metadata +13 -13
- data/.travis.yml +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6294103b68ebdbf099d1137865856b10baec21683bd648727976f245cf197ad
|
4
|
+
data.tar.gz: e0500e2c784a46c7a82ca3aa29e44f96d116bd6898e5b35f9174162457208165
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb18fb2a167afeaea5eac0db4e13ee58d64fc348ff1ebd33942ad1bb7120cbb828ad2652ed2d6b165d7a1b53eea097338032690e26ee97f5765fd87ba2f97862
|
7
|
+
data.tar.gz: 7a61a35335247d39a0e97574f5b2816a92238d93a9f5b23c62b909a92ae03817057752ffc576ae1414c5e6744a6381b473be4cd2cfc2a0fd4e7582cffd97bdd4
|
data/CHANGELOG.md
CHANGED
@@ -1,17 +1,33 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [1.1.
|
4
|
+
## [1.1.7] - 2024-02-xx
|
5
5
|
|
6
6
|
### Added
|
7
|
-
- Support for new fields
|
8
|
-
- `Ecoportal::API::V2::Page::Component::ActionsField`
|
9
|
-
- `Ecoportal::API::V2::Page::Component::MailboxField`
|
10
|
-
|
11
7
|
### Changed
|
12
|
-
|
8
|
+
### Fixed
|
9
|
+
|
10
|
+
## [1.1.6] - 2024-02-29
|
11
|
+
|
12
|
+
### Added
|
13
|
+
- A bit of **specs** on object retrieval for `Ecoportal::API::Common::Conent::CollectionModel`
|
14
|
+
- `Ecoportal::API::Registers::PageResult` exposed `membranes`
|
15
|
+
- with new object `Ecoportal::API::Registers::PageResult::MembraneDroplet`
|
13
16
|
|
14
17
|
### Fixed
|
18
|
+
- `Ecoportal::API::Common::Conent::CollectionModel`
|
19
|
+
|
20
|
+
## [1.1.5] - 2024-02-03
|
21
|
+
|
22
|
+
### Changed
|
23
|
+
- Upgrade gem dependencies
|
24
|
+
|
25
|
+
## [1.1.4] - 2024-02-01
|
26
|
+
|
27
|
+
### Added
|
28
|
+
- Support for new fields
|
29
|
+
- `Ecoportal::API::V2::Page::Component::ActionsField`
|
30
|
+
- `Ecoportal::API::V2::Page::Component::MailboxField`
|
15
31
|
|
16
32
|
## [1.1.3] - 2023-06-28
|
17
33
|
|
data/README.md
CHANGED
data/ecoportal-api-v2.gemspec
CHANGED
@@ -22,12 +22,12 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
-
spec.add_development_dependency "bundler", ">= 2.4.
|
26
|
-
spec.add_development_dependency "rspec", ">= 3.
|
25
|
+
spec.add_development_dependency "bundler", ">= 2.4.12", "< 3"
|
26
|
+
spec.add_development_dependency "rspec", ">= 3.12.0", "< 4"
|
27
27
|
spec.add_development_dependency "rake", ">= 13.0.3", "< 14"
|
28
|
-
spec.add_development_dependency "yard", ">= 0.9.
|
29
|
-
spec.add_development_dependency "redcarpet", ">= 3.
|
28
|
+
spec.add_development_dependency "yard", ">= 0.9.34", "< 1"
|
29
|
+
spec.add_development_dependency "redcarpet", ">= 3.6.0", "< 4"
|
30
30
|
spec.add_development_dependency "pry" , ">= 0.14"
|
31
31
|
|
32
|
-
spec.add_dependency 'ecoportal-api', '>= 0.9.
|
32
|
+
spec.add_dependency 'ecoportal-api', '>= 0.9.6', '< 0.10'
|
33
33
|
end
|
@@ -11,6 +11,8 @@ module Ecoportal
|
|
11
11
|
attr_writer :klass
|
12
12
|
attr_accessor :order_matters, :order_key
|
13
13
|
|
14
|
+
# The attr that has been defined as `passkey`
|
15
|
+
# in the item class
|
14
16
|
def items_key
|
15
17
|
@items_key ||= "id"
|
16
18
|
end
|
@@ -22,6 +24,8 @@ module Ecoportal
|
|
22
24
|
# Resolves to the nuclear `Class` of the elements
|
23
25
|
# @note
|
24
26
|
# - use block to define `klass` callback
|
27
|
+
# @note When `klass` is resolved, if the items are of type
|
28
|
+
# `DoubleModel`, it sets on the collection class the `items_key`
|
25
29
|
# @param value [Hash] base `doc` (raw object) to create the object with
|
26
30
|
# @yield [doc] identifies the target `class` of the raw object
|
27
31
|
# @yieldparam doc [Hash]
|
@@ -31,6 +35,7 @@ module Ecoportal
|
|
31
35
|
if block
|
32
36
|
@klass = block
|
33
37
|
block.call(value) if value != NOT_USED
|
38
|
+
@klass
|
34
39
|
elsif used_param?(value)
|
35
40
|
if @klass.is_a?(Proc)
|
36
41
|
@klass.call(value)
|
@@ -39,6 +44,10 @@ module Ecoportal
|
|
39
44
|
end
|
40
45
|
else
|
41
46
|
resolve_class(@klass, exception: false)
|
47
|
+
end.tap do |result|
|
48
|
+
next unless result.is_a?(Class)
|
49
|
+
next unless result < Ecoportal::API::Common::Content::DoubleModel
|
50
|
+
self.items_key = result.key
|
42
51
|
end
|
43
52
|
end
|
44
53
|
|
@@ -127,7 +136,17 @@ module Ecoportal
|
|
127
136
|
#print "{{#{p}}}"
|
128
137
|
end
|
129
138
|
else
|
130
|
-
|
139
|
+
show_str = \
|
140
|
+
case value
|
141
|
+
when Hash
|
142
|
+
value.pretty_inspect
|
143
|
+
when Content::DoubleModel
|
144
|
+
"#{value} with key: #{value.class.key} (items_key: #{self.class.items_key})"
|
145
|
+
else
|
146
|
+
value
|
147
|
+
end
|
148
|
+
|
149
|
+
raise UnlinkedModel, "Can't find child: #{show_str}"
|
131
150
|
end
|
132
151
|
end
|
133
152
|
|
@@ -28,6 +28,8 @@ module Ecoportal
|
|
28
28
|
!!key
|
29
29
|
end
|
30
30
|
|
31
|
+
# key property (and method) of this model
|
32
|
+
# @note this is auto-set when `passkey` is used
|
31
33
|
def key=(value)
|
32
34
|
@key = value.to_s.freeze
|
33
35
|
end
|
@@ -72,7 +74,7 @@ module Ecoportal
|
|
72
74
|
# This method is essential to give stability to the model
|
73
75
|
# @note `Content::CollectionModel` needs to find elements in the doc `Array`.
|
74
76
|
# The only way to do it is via the access key (i.e. `id`). However, there is
|
75
|
-
# no chance you can avoid
|
77
|
+
# no chance you can avoid infinite loop for `get_key` without setting an
|
76
78
|
# instance variable key at the moment of the object creation, when the
|
77
79
|
# `doc` is firstly received
|
78
80
|
# @param method [Symbol] the method that exposes the value
|
@@ -263,6 +265,7 @@ module Ecoportal
|
|
263
265
|
|
264
266
|
inheritable_class_vars :forced_model_keys, :key
|
265
267
|
|
268
|
+
# `_key` refers to the parent's property that links to this model
|
266
269
|
attr_reader :_parent, :_key, :_read_only
|
267
270
|
|
268
271
|
def initialize(doc = {}, parent: self, key: nil, read_only: false)
|
@@ -321,6 +324,8 @@ module Ecoportal
|
|
321
324
|
if is_root?
|
322
325
|
@doc
|
323
326
|
else
|
327
|
+
# transform parent's `_key` to this object into a
|
328
|
+
# path key that can rerieve from the parents's doc
|
324
329
|
_parent.doc.dig(*[_doc_key(_key)].flatten)
|
325
330
|
end
|
326
331
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class V2
|
4
|
+
class Registers
|
5
|
+
class PageResult
|
6
|
+
class MembraneDroplet < Common::Content::DoubleModel
|
7
|
+
passkey :ref
|
8
|
+
passthrough :label, :type, :value
|
9
|
+
passthrough :field_configuration_id
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -12,10 +12,14 @@ module Ecoportal
|
|
12
12
|
passthrough :mould_counter
|
13
13
|
|
14
14
|
class_resolver :stages_class, "Ecoportal::API::V2::Registers::StagesResult"
|
15
|
-
embeds_many :stages, enum_class: :stages_class
|
16
|
-
end
|
15
|
+
embeds_many :stages, enum_class: :stages_class, read_only: true
|
17
16
|
|
17
|
+
class_resolver :mem_droplet, "Ecoportal::API::V2::Registers::PageResult::MembraneDroplet"
|
18
|
+
embeds_many :membranes, klass: :mem_droplet, read_only: true
|
19
|
+
end
|
18
20
|
end
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
24
|
+
|
25
|
+
require_relative 'page_result/membrane_droplet'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecoportal-api-v2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-02-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 2.4.
|
19
|
+
version: 2.4.12
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '3'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: 2.4.
|
29
|
+
version: 2.4.12
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '3'
|
@@ -36,7 +36,7 @@ dependencies:
|
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: 3.
|
39
|
+
version: 3.12.0
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
42
|
version: '4'
|
@@ -46,7 +46,7 @@ dependencies:
|
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: 3.
|
49
|
+
version: 3.12.0
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '4'
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
requirements:
|
77
77
|
- - ">="
|
78
78
|
- !ruby/object:Gem::Version
|
79
|
-
version: 0.9.
|
79
|
+
version: 0.9.34
|
80
80
|
- - "<"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1'
|
@@ -86,7 +86,7 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.9.
|
89
|
+
version: 0.9.34
|
90
90
|
- - "<"
|
91
91
|
- !ruby/object:Gem::Version
|
92
92
|
version: '1'
|
@@ -96,7 +96,7 @@ dependencies:
|
|
96
96
|
requirements:
|
97
97
|
- - ">="
|
98
98
|
- !ruby/object:Gem::Version
|
99
|
-
version: 3.
|
99
|
+
version: 3.6.0
|
100
100
|
- - "<"
|
101
101
|
- !ruby/object:Gem::Version
|
102
102
|
version: '4'
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ">="
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 3.
|
109
|
+
version: 3.6.0
|
110
110
|
- - "<"
|
111
111
|
- !ruby/object:Gem::Version
|
112
112
|
version: '4'
|
@@ -130,7 +130,7 @@ dependencies:
|
|
130
130
|
requirements:
|
131
131
|
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: 0.9.
|
133
|
+
version: 0.9.6
|
134
134
|
- - "<"
|
135
135
|
- !ruby/object:Gem::Version
|
136
136
|
version: '0.10'
|
@@ -140,7 +140,7 @@ dependencies:
|
|
140
140
|
requirements:
|
141
141
|
- - ">="
|
142
142
|
- !ruby/object:Gem::Version
|
143
|
-
version: 0.9.
|
143
|
+
version: 0.9.6
|
144
144
|
- - "<"
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0.10'
|
@@ -156,7 +156,6 @@ files:
|
|
156
156
|
- ".gitignore"
|
157
157
|
- ".rspec"
|
158
158
|
- ".rubocop.yml"
|
159
|
-
- ".travis.yml"
|
160
159
|
- ".yardopts"
|
161
160
|
- CHANGELOG.md
|
162
161
|
- Gemfile
|
@@ -242,6 +241,7 @@ files:
|
|
242
241
|
- lib/ecoportal/api/v2/people.rb
|
243
242
|
- lib/ecoportal/api/v2/registers.rb
|
244
243
|
- lib/ecoportal/api/v2/registers/page_result.rb
|
244
|
+
- lib/ecoportal/api/v2/registers/page_result/membrane_droplet.rb
|
245
245
|
- lib/ecoportal/api/v2/registers/register.rb
|
246
246
|
- lib/ecoportal/api/v2/registers/search_results.rb
|
247
247
|
- lib/ecoportal/api/v2/registers/stage_result.rb
|