ecoportal-api-v2 0.8.31 → 0.8.32
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 +28 -9
- data/lib/ecoportal/api/v2/pages/page_create_response.rb +13 -0
- data/lib/ecoportal/api/v2/pages.rb +15 -2
- data/lib/ecoportal/api/v2_version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 61f3db1a50844d2f5ca194ff29939ed8daa393a6d3596e50a670ebc0f99e58db
|
4
|
+
data.tar.gz: b39bd03de67e23d12a48e12fdc19de1b33d131a1c4bec1aa193bf35fcbdc1035
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fba38418ad4ed3febd3859f0d4d096d75f079aa1e7abc745ca76a7deb5479de93ab5fecede2954646691e1aa17ee66348e04a8f349d2f8800f06ca36e76efa28
|
7
|
+
data.tar.gz: dcfad6f62286db5b028d3ab1b29b29a0f34c04c4a8d73d2cdc01c060601d92e678d6e51f96a4ce6caa22e10d9f3bb36ec97dc8f9fef4b894c5c52ba5332e388a
|
data/CHANGELOG.md
CHANGED
@@ -1,27 +1,46 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [0.8.
|
4
|
+
## [0.8.33] - 2022-09-xx
|
5
5
|
|
6
6
|
### Added
|
7
|
-
|
7
|
+
### Changed
|
8
|
+
### Fixed
|
9
|
+
|
10
|
+
|
11
|
+
## [0.8.32] - 2022-09-19
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- `Ecoportal::API::V2::Pages::PageCreateResponse` to wrap the response on creation
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
- `Ecoportal::API::V2::Pages#create` to rather return a `PageCreateResponse`
|
18
|
+
|
19
|
+
### Fixed
|
20
|
+
- `Ecoportal::API::V2::Pages#create` to make sure new page with no changes can be created.
|
21
|
+
|
22
|
+
|
23
|
+
## [0.8.31] - 2022-09-15
|
24
|
+
|
25
|
+
### Added
|
26
|
+
- `Ecoportal::API::Common::Content::ClassHelpers.uid` to generate a random uid
|
8
27
|
|
9
28
|
### Changed
|
10
29
|
- added **inheritable attributes** to
|
11
|
-
- `Ecoportal::API
|
12
|
-
- `Ecoportal::API
|
13
|
-
- `Ecoportal::API
|
14
|
-
- moved `SecureRandom` dependency to `Ecoportal::API
|
30
|
+
- `Ecoportal::API::Common::Content::ArrayModel` (:order_matteres, :uniq)
|
31
|
+
- `Ecoportal::API::Common::Content::CollectionModel` (klass, :order_matters, :order_key, :items_key, :new_item)
|
32
|
+
- `Ecoportal::API::Common::Content::DoubleModel` (:key)
|
33
|
+
- moved `SecureRandom` dependency to `Ecoportal::API::Common::Content::ClassHelpers`
|
15
34
|
|
16
35
|
### Fixed
|
17
36
|
- `Ecoportal::API::V2::Page::Component::SelectionOption#numeric!` fix conversion
|
18
|
-
- `Ecoportal::API
|
37
|
+
- `Ecoportal::API::Common::Content::ClassHelpers`, `new_class`
|
19
38
|
- **Added** parameter `namespace` (default: the class `inherits` parameter): it's purpose is to define the namespace where the new class will sit
|
20
39
|
- **Fixed** also the namespace where the new class constant will sit (it was using always the source class `self`)
|
21
40
|
- **Improved** `name` parameter to have a default value that is randomized. This is useful when we just want to do something like `SomeClass.new_class`, where the name of the new class doesn't really matter.
|
22
41
|
- **Fixed** lost reference of class resolvers when using `embeds_many`
|
23
|
-
- `Ecoportal::API
|
24
|
-
- This has been natively wrapped in `Ecoportal::API
|
42
|
+
- `Ecoportal::API::Common::Content::ClassHelpers`, `resolve_class` accepts now a `Hash` with `key` referrer class, and `value` any of the previously accepted ones (i.e. `Symbol` or `String`). To this purpose, `source_class` parameter has been added.
|
43
|
+
- This has been natively wrapped in `Ecoportal::API::Common::Content::DoubleModel.embeds_many`, as it naturally shares the `class_resolver` with a third party class that loses the reference.
|
25
44
|
|
26
45
|
## [0.8.30] - 2022-07-11
|
27
46
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class V2
|
4
|
+
class Pages
|
5
|
+
# @attr_reader page_id [String] the `id` of the new ooze.
|
6
|
+
# @attr_reader active_stage_id [String] the active stage `id` of the new ooze.
|
7
|
+
class PageCreateResponse < Common::Content::DoubleModel
|
8
|
+
passthrough :page_id, :active_stage_id
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -9,6 +9,7 @@ module Ecoportal
|
|
9
9
|
|
10
10
|
class_resolver :stages_class, "Ecoportal::API::V2::Pages::Stages"
|
11
11
|
class_resolver :page_class, "Ecoportal::API::V2::Page"
|
12
|
+
class_resolver :create_page_response_class, "Ecoportal::API::V2::Pages::PageCreateResponse"
|
12
13
|
|
13
14
|
attr_reader :client
|
14
15
|
|
@@ -75,9 +76,20 @@ module Ecoportal
|
|
75
76
|
# @param from [String, Hash, Page] template or `id` of the template
|
76
77
|
# @return [Response] an object with the api response.
|
77
78
|
def create(doc, from:)
|
78
|
-
body = get_body(doc)
|
79
79
|
id = get_id(from)
|
80
|
-
|
80
|
+
body = get_body(doc).tap do |hash|
|
81
|
+
unless hash["page"]
|
82
|
+
hash["page"] = {
|
83
|
+
"id" => "111111111111111111111111",
|
84
|
+
"operation" => "changed",
|
85
|
+
"data" => {"patch_ver" => 0}
|
86
|
+
}
|
87
|
+
end
|
88
|
+
end
|
89
|
+
response = client.post("/pages", data: body, params: {template_id: id})
|
90
|
+
wrapped = Common::Content::WrappedResponse.new(response, create_page_response_class)
|
91
|
+
return wrapped.result if wrapped.success?
|
92
|
+
raise "Could not create page from template #{id} - Error #{response.status}: #{response.body}"
|
81
93
|
end
|
82
94
|
|
83
95
|
private
|
@@ -93,3 +105,4 @@ end
|
|
93
105
|
|
94
106
|
require 'ecoportal/api/v2/page'
|
95
107
|
require 'ecoportal/api/v2/pages/stages'
|
108
|
+
require 'ecoportal/api/v2/pages/page_create_response'
|
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: 0.8.
|
4
|
+
version: 0.8.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-09-
|
11
|
+
date: 2022-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -231,6 +231,7 @@ files:
|
|
231
231
|
- lib/ecoportal/api/v2/page/stage.rb
|
232
232
|
- lib/ecoportal/api/v2/page/stages.rb
|
233
233
|
- lib/ecoportal/api/v2/pages.rb
|
234
|
+
- lib/ecoportal/api/v2/pages/page_create_response.rb
|
234
235
|
- lib/ecoportal/api/v2/pages/page_stage.rb
|
235
236
|
- lib/ecoportal/api/v2/pages/stages.rb
|
236
237
|
- lib/ecoportal/api/v2/people.rb
|