ecoportal-api-v2 1.1.2 → 1.1.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99d119cc599b33a68117699108312e7a885ec570cbab5ea43087b1366f79cda2
|
4
|
+
data.tar.gz: a3de4653f9319c0d5a39edc4b7d113666b16241bdfb3cab98e3185ff6bfd153e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8437419e3eda3f7dfccffb48c4ba5b309cb670f1cdd18470e79b38ad2fba19f9c7b1498b19d4f0f241a7ae80fbbffe0a5a168a99314398c0e59bfa2119a9a1d3
|
7
|
+
data.tar.gz: 6fd2348676568bca1b50701b7f142c4e8531f3f735d7db73d00764a65ced988c4054f26dea14004d89225db9b1a6213f3b2c7c47bc1a9021cca098d24e29dacb
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,18 @@
|
|
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.4] - 2023-06-xx
|
5
5
|
|
6
6
|
### Added
|
7
7
|
### Changed
|
8
8
|
### Fixed
|
9
9
|
|
10
|
+
## [1.1.3] - 2023-06-28
|
11
|
+
|
12
|
+
### Added
|
13
|
+
- `Ecoportal::API::V2::Page::Component::ContractorEntitiesField`
|
14
|
+
- Added support for contractor entities fields.
|
15
|
+
|
10
16
|
## [1.1.2] - 2023-04-17
|
11
17
|
|
12
18
|
### Changed
|
@@ -0,0 +1,124 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class V2
|
4
|
+
class Page
|
5
|
+
class Component
|
6
|
+
class ContractorEntitiesField < Page::Component
|
7
|
+
passboolean :is_me_button
|
8
|
+
passboolean :show_approval_status
|
9
|
+
|
10
|
+
passboolean :singular
|
11
|
+
|
12
|
+
passarray :contractor_entities_ids
|
13
|
+
pass_reader :cached_people
|
14
|
+
|
15
|
+
passboolean :grant_permissions_enabled
|
16
|
+
passthrough :apply_attached_contractors_permissions_to
|
17
|
+
passthrough :admin_access, :regular_access
|
18
|
+
embeds_one :attached_contractors_permissions_flags, klass: "Ecoportal::API::V2::Page::PermissionFlags"
|
19
|
+
embeds_one :attached_contractors_admin_permissions_flags, klass: "Ecoportal::API::V2::Page::PermissionFlags"
|
20
|
+
|
21
|
+
def empty?
|
22
|
+
contractor_entities_ids.empty?
|
23
|
+
end
|
24
|
+
|
25
|
+
# Attaches people
|
26
|
+
def add(*ids)
|
27
|
+
contractor_entities_ids << ids
|
28
|
+
end
|
29
|
+
|
30
|
+
# Deletes people
|
31
|
+
def delete(*ids)
|
32
|
+
contractor_entities_ids.reject! {|id| ids.include?(id)}
|
33
|
+
end
|
34
|
+
|
35
|
+
def to_s(delimiter: "\n")
|
36
|
+
contractor_entities_ids.to_a.join(delimiter)
|
37
|
+
end
|
38
|
+
|
39
|
+
# Quick config helper
|
40
|
+
# @param conf [Symbol, Array<Symbol>]
|
41
|
+
# - `:snapshot` to set mode to `snapshot`
|
42
|
+
# - `:live` to set mode to `live`
|
43
|
+
# - `:me_button` to display `ME` button
|
44
|
+
# - `:permits` to define the permissions
|
45
|
+
# - `:all` for _entire page/all stages_
|
46
|
+
# - `:stages` for _all stages containing this field_
|
47
|
+
# - `:page` for _page only_
|
48
|
+
# - `:stage` for _only the stage containing this field when attached_
|
49
|
+
# - `:restructure`
|
50
|
+
# - `:configure`
|
51
|
+
# - `:can_permission`
|
52
|
+
# - `:create_actions`
|
53
|
+
# - `:admin_actions`
|
54
|
+
# - `:subscribed`
|
55
|
+
# - `:subscribed_to_tasks`
|
56
|
+
# - `requires: number` to fine the number of required people to be attached
|
57
|
+
def configure(*conf)
|
58
|
+
conf.each_with_object([]) do |cnf, unused|
|
59
|
+
case cnf
|
60
|
+
when :me_button
|
61
|
+
self.is_me_button = true
|
62
|
+
when :singular
|
63
|
+
self.singular = true
|
64
|
+
when Hash
|
65
|
+
supported = [:singular, :permits]
|
66
|
+
unless (rest = hash_except(cnf.dup, *supported)).empty?
|
67
|
+
unused.push(rest)
|
68
|
+
end
|
69
|
+
|
70
|
+
if cnf.key?(:singular) then self.singular = !!cnf[:singular] end
|
71
|
+
if cnf.key?(:permits)
|
72
|
+
if permits = cnf[:permits]
|
73
|
+
self.regular_access = true
|
74
|
+
configure_permits(*[permits].flatten.compact)
|
75
|
+
else
|
76
|
+
self.regular_access = false
|
77
|
+
end
|
78
|
+
end
|
79
|
+
if cnf.key?(:admin_permits)
|
80
|
+
if permits = cnf[:permits]
|
81
|
+
self.admin_access = true
|
82
|
+
configure_permits(*[permits].flatten.compact)
|
83
|
+
else
|
84
|
+
self.admin_access = false
|
85
|
+
end
|
86
|
+
end
|
87
|
+
else
|
88
|
+
unused.push(cnf)
|
89
|
+
end
|
90
|
+
end.yield_self do |unused|
|
91
|
+
super(*unused)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
def configure_permits(*conf, to: :regular)
|
98
|
+
conf.each_with_object([]) do |cnf, flags|
|
99
|
+
permits_scope = :apply_attached_contractors_permissions_to=
|
100
|
+
case cnf
|
101
|
+
when :all
|
102
|
+
send(permits_scope, "page")
|
103
|
+
when :stages
|
104
|
+
send(permits_scope, "all_stages")
|
105
|
+
when :page
|
106
|
+
send(permits_scope, "page_only")
|
107
|
+
when :stage
|
108
|
+
send(permits_scope, "current_stage")
|
109
|
+
else
|
110
|
+
flags.push(cnf)
|
111
|
+
end
|
112
|
+
end.yield_self do |flags|
|
113
|
+
target_flags = :attached_contractors_admin_permissions_flags if to == :admin
|
114
|
+
target_flags ||= :attached_contractors_permissions_flags
|
115
|
+
self.send(target_flags).configure *flags
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
@@ -14,6 +14,7 @@ module Ecoportal
|
|
14
14
|
class_resolver :plain_text_field_class, "Ecoportal::API::V2::Page::Component::PlainTextField"
|
15
15
|
class_resolver :rich_text_field_class, "Ecoportal::API::V2::Page::Component::RichTextField"
|
16
16
|
class_resolver :people_field_class, "Ecoportal::API::V2::Page::Component::PeopleField"
|
17
|
+
class_resolver :contractor_entities_field_class, "Ecoportal::API::V2::Page::Component::ContractorEntitiesField"
|
17
18
|
class_resolver :checklist_field_class, "Ecoportal::API::V2::Page::Component::ChecklistField"
|
18
19
|
class_resolver :action_field_class, "Ecoportal::API::V2::Page::Component::ActionField"
|
19
20
|
class_resolver :files_field_class, "Ecoportal::API::V2::Page::Component::FilesField"
|
@@ -59,6 +60,8 @@ module Ecoportal
|
|
59
60
|
rich_text_field_class
|
60
61
|
when "people"
|
61
62
|
people_field_class
|
63
|
+
when "contractor_entities"
|
64
|
+
contractor_entities_field_class
|
62
65
|
when "checklist"
|
63
66
|
checklist_field_class
|
64
67
|
when "page_action","checklist_task"
|
@@ -229,6 +232,7 @@ require 'ecoportal/api/v2/page/component/gauge_field'
|
|
229
232
|
require 'ecoportal/api/v2/page/component/plain_text_field'
|
230
233
|
require 'ecoportal/api/v2/page/component/rich_text_field'
|
231
234
|
require 'ecoportal/api/v2/page/component/people_field'
|
235
|
+
require 'ecoportal/api/v2/page/component/contractor_entities_field'
|
232
236
|
require 'ecoportal/api/v2/page/component/checklist_field'
|
233
237
|
require 'ecoportal/api/v2/page/component/action_field'
|
234
238
|
require 'ecoportal/api/v2/page/component/files_field'
|
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.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- lib/ecoportal/api/v2/page/component/chart_fr_field.rb
|
198
198
|
- lib/ecoportal/api/v2/page/component/checklist_field.rb
|
199
199
|
- lib/ecoportal/api/v2/page/component/checklist_item.rb
|
200
|
+
- lib/ecoportal/api/v2/page/component/contractor_entities_field.rb
|
200
201
|
- lib/ecoportal/api/v2/page/component/date_field.rb
|
201
202
|
- lib/ecoportal/api/v2/page/component/file.rb
|
202
203
|
- lib/ecoportal/api/v2/page/component/files_field.rb
|
@@ -264,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
264
265
|
- !ruby/object:Gem::Version
|
265
266
|
version: '0'
|
266
267
|
requirements: []
|
267
|
-
rubygems_version: 3.
|
268
|
+
rubygems_version: 3.4.12
|
268
269
|
signing_key:
|
269
270
|
specification_version: 4
|
270
271
|
summary: A collection of helpers for interacting with the ecoPortal MS's V2 API
|