ecoportal-api-v2 1.1.2 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +13 -1
- data/ecoportal-api-v2.gemspec +1 -1
- data/lib/ecoportal/api/v2/page/component/actions_field.rb +37 -0
- data/lib/ecoportal/api/v2/page/component/contractor_entities_field.rb +125 -0
- data/lib/ecoportal/api/v2/page/component/mailbox_field.rb +18 -0
- data/lib/ecoportal/api/v2/page/component.rb +12 -0
- data/lib/ecoportal/api/v2_version.rb +1 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e7774c15da9ae5d6ff253f7a3d3035d6943e6d4de9b68dbd648ea16b6b815b9e
|
4
|
+
data.tar.gz: b87045d030a5648294c0d9ed186cb2324d4df008e19fdb97d6ae2d8a4cc3fe38
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c4586c46e7921caa02d561e9a4b13ff2f2c1cc41d64f4501fff54edb6edb733a43b9adb8d38e93a95c1fbd475f6e837ef6a5ce4a003c338e81dd1d729201f223
|
7
|
+
data.tar.gz: b388223450b1324e3a6e46051b07e2266e275c561ffdc2506354714f259a81e825e5772c22a9608d13c6d90b3e76b2b4a2ce372fc231108f78532a7068335c3b
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,24 @@
|
|
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] - 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
|
+
|
7
11
|
### Changed
|
12
|
+
- core gem **upgrade**
|
13
|
+
|
8
14
|
### Fixed
|
9
15
|
|
16
|
+
## [1.1.3] - 2023-06-28
|
17
|
+
|
18
|
+
### Added
|
19
|
+
- `Ecoportal::API::V2::Page::Component::ContractorEntitiesField`
|
20
|
+
- Added support for contractor entities fields.
|
21
|
+
|
10
22
|
## [1.1.2] - 2023-04-17
|
11
23
|
|
12
24
|
### Changed
|
data/ecoportal-api-v2.gemspec
CHANGED
@@ -29,5 +29,5 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "redcarpet", ">= 3.5.1", "< 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.5', '< 0.10'
|
33
33
|
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class V2
|
4
|
+
class Page
|
5
|
+
class Component
|
6
|
+
class ActionsField < Page::Component
|
7
|
+
passboolean :create_actions
|
8
|
+
passthrough :required_completed
|
9
|
+
passboolean :filled_in?
|
10
|
+
passarray :permitted_person_schema_ids, order_matters: false
|
11
|
+
|
12
|
+
passboolean :enable_attaching_actions
|
13
|
+
passarray :action_ids, :all_actions, order_matters: false
|
14
|
+
passarray :open_actions, :closed_actions, :overdue_actions, order_matters: false
|
15
|
+
passthrough :actions_hash
|
16
|
+
passarray :action_recurrence_ids, order_matters: false
|
17
|
+
|
18
|
+
def empty?
|
19
|
+
action_ids.to_a.empty?
|
20
|
+
end
|
21
|
+
|
22
|
+
# Adds a task with `name` short description
|
23
|
+
# @return [Ecoportal::API::V2::Page::Component::Action]
|
24
|
+
def attach_action (*ids, force: false)
|
25
|
+
raise "Can't attach actions" unless enable_attaching_actions && force
|
26
|
+
action_ids << ids
|
27
|
+
end
|
28
|
+
|
29
|
+
def to_s(delimiter: "\n")
|
30
|
+
action_ids.join(delimiter)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,125 @@
|
|
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
|
+
passthrough :requires_number
|
12
|
+
|
13
|
+
passarray :contractor_entities_ids
|
14
|
+
passboolean :show_approval_status
|
15
|
+
|
16
|
+
passboolean :grant_permissions_enabled
|
17
|
+
passthrough :apply_attached_contractors_permissions_to
|
18
|
+
passthrough :admin_access, :regular_access
|
19
|
+
embeds_one :attached_contractors_permissions_flags, klass: "Ecoportal::API::V2::Page::PermissionFlags"
|
20
|
+
embeds_one :attached_contractors_admin_permissions_flags, klass: "Ecoportal::API::V2::Page::PermissionFlags"
|
21
|
+
|
22
|
+
def empty?
|
23
|
+
contractor_entities_ids.empty?
|
24
|
+
end
|
25
|
+
|
26
|
+
# Attaches people
|
27
|
+
def add(*ids)
|
28
|
+
contractor_entities_ids << ids
|
29
|
+
end
|
30
|
+
|
31
|
+
# Deletes people
|
32
|
+
def delete(*ids)
|
33
|
+
contractor_entities_ids.reject! {|id| ids.include?(id)}
|
34
|
+
end
|
35
|
+
|
36
|
+
def to_s(delimiter: "\n")
|
37
|
+
contractor_entities_ids.to_a.join(delimiter)
|
38
|
+
end
|
39
|
+
|
40
|
+
# Quick config helper
|
41
|
+
# @param conf [Symbol, Array<Symbol>]
|
42
|
+
# - `:snapshot` to set mode to `snapshot`
|
43
|
+
# - `:live` to set mode to `live`
|
44
|
+
# - `:me_button` to display `ME` button
|
45
|
+
# - `:permits` to define the permissions
|
46
|
+
# - `:all` for _entire page/all stages_
|
47
|
+
# - `:stages` for _all stages containing this field_
|
48
|
+
# - `:page` for _page only_
|
49
|
+
# - `:stage` for _only the stage containing this field when attached_
|
50
|
+
# - `:restructure`
|
51
|
+
# - `:configure`
|
52
|
+
# - `:can_permission`
|
53
|
+
# - `:create_actions`
|
54
|
+
# - `:admin_actions`
|
55
|
+
# - `:subscribed`
|
56
|
+
# - `:subscribed_to_tasks`
|
57
|
+
# - `requires: number` to fine the number of required people to be attached
|
58
|
+
def configure(*conf)
|
59
|
+
conf.each_with_object([]) do |cnf, unused|
|
60
|
+
case cnf
|
61
|
+
when :me_button
|
62
|
+
self.is_me_button = true
|
63
|
+
when :singular
|
64
|
+
self.singular = true
|
65
|
+
when Hash
|
66
|
+
supported = [:singular, :permits]
|
67
|
+
unless (rest = hash_except(cnf.dup, *supported)).empty?
|
68
|
+
unused.push(rest)
|
69
|
+
end
|
70
|
+
|
71
|
+
if cnf.key?(:singular) then self.singular = !!cnf[:singular] end
|
72
|
+
if cnf.key?(:permits)
|
73
|
+
if permits = cnf[:permits]
|
74
|
+
self.regular_access = true
|
75
|
+
configure_permits(*[permits].flatten.compact)
|
76
|
+
else
|
77
|
+
self.regular_access = false
|
78
|
+
end
|
79
|
+
end
|
80
|
+
if cnf.key?(:admin_permits)
|
81
|
+
if permits = cnf[:permits]
|
82
|
+
self.admin_access = true
|
83
|
+
configure_permits(*[permits].flatten.compact)
|
84
|
+
else
|
85
|
+
self.admin_access = false
|
86
|
+
end
|
87
|
+
end
|
88
|
+
else
|
89
|
+
unused.push(cnf)
|
90
|
+
end
|
91
|
+
end.yield_self do |unused|
|
92
|
+
super(*unused)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
def configure_permits(*conf, to: :regular)
|
99
|
+
conf.each_with_object([]) do |cnf, flags|
|
100
|
+
permits_scope = :apply_attached_contractors_permissions_to=
|
101
|
+
case cnf
|
102
|
+
when :all
|
103
|
+
send(permits_scope, "page")
|
104
|
+
when :stages
|
105
|
+
send(permits_scope, "all_stages")
|
106
|
+
when :page
|
107
|
+
send(permits_scope, "page_only")
|
108
|
+
when :stage
|
109
|
+
send(permits_scope, "current_stage")
|
110
|
+
else
|
111
|
+
flags.push(cnf)
|
112
|
+
end
|
113
|
+
end.yield_self do |flags|
|
114
|
+
target_flags = :attached_contractors_admin_permissions_flags if to == :admin
|
115
|
+
target_flags ||= :attached_contractors_permissions_flags
|
116
|
+
self.send(target_flags).configure *flags
|
117
|
+
end
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class V2
|
4
|
+
class Page
|
5
|
+
class Component
|
6
|
+
class MailboxField < Page::Component
|
7
|
+
passarray :email_ids
|
8
|
+
passthrough :address_id
|
9
|
+
|
10
|
+
def to_s(delimiter: "\n")
|
11
|
+
email_ids.to_a.join(delimiter)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -14,13 +14,16 @@ 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"
|
20
|
+
class_resolver :actions_field_class, "Ecoportal::API::V2::Page::Component::ActionsField"
|
19
21
|
class_resolver :files_field_class, "Ecoportal::API::V2::Page::Component::FilesField"
|
20
22
|
class_resolver :images_field_class, "Ecoportal::API::V2::Page::Component::ImagesField"
|
21
23
|
class_resolver :signature_field_class, "Ecoportal::API::V2::Page::Component::SignatureField"
|
22
24
|
class_resolver :reference_field_class, "Ecoportal::API::V2::Page::Component::ReferenceField"
|
23
25
|
class_resolver :law_field_class, "Ecoportal::API::V2::Page::Component::LawField"
|
26
|
+
class_resolver :mailbox_field_class, "Ecoportal::API::V2::Page::Component::MailboxField"
|
24
27
|
class_resolver :chart_field_class, "Ecoportal::API::V2::Page::Component::ChartField"
|
25
28
|
class_resolver :chart_fr_field_class, "Ecoportal::API::V2::Page::Component::ChartFrField"
|
26
29
|
|
@@ -59,10 +62,14 @@ module Ecoportal
|
|
59
62
|
rich_text_field_class
|
60
63
|
when "people"
|
61
64
|
people_field_class
|
65
|
+
when "contractor_entities"
|
66
|
+
contractor_entities_field_class
|
62
67
|
when "checklist"
|
63
68
|
checklist_field_class
|
64
69
|
when "page_action","checklist_task"
|
65
70
|
action_field_class
|
71
|
+
when "actions_list"
|
72
|
+
actions_field_class
|
66
73
|
when "file"
|
67
74
|
files_field_class
|
68
75
|
when "image_gallery"
|
@@ -73,6 +80,8 @@ module Ecoportal
|
|
73
80
|
reference_field_class
|
74
81
|
when "law"
|
75
82
|
law_field_class
|
83
|
+
when "mailbox"
|
84
|
+
mailbox_field_class
|
76
85
|
when "chart"
|
77
86
|
chart_field_class
|
78
87
|
when "frequency_rate_chart"
|
@@ -229,12 +238,15 @@ require 'ecoportal/api/v2/page/component/gauge_field'
|
|
229
238
|
require 'ecoportal/api/v2/page/component/plain_text_field'
|
230
239
|
require 'ecoportal/api/v2/page/component/rich_text_field'
|
231
240
|
require 'ecoportal/api/v2/page/component/people_field'
|
241
|
+
require 'ecoportal/api/v2/page/component/contractor_entities_field'
|
232
242
|
require 'ecoportal/api/v2/page/component/checklist_field'
|
233
243
|
require 'ecoportal/api/v2/page/component/action_field'
|
244
|
+
require 'ecoportal/api/v2/page/component/actions_field'
|
234
245
|
require 'ecoportal/api/v2/page/component/files_field'
|
235
246
|
require 'ecoportal/api/v2/page/component/images_field'
|
236
247
|
require 'ecoportal/api/v2/page/component/signature_field'
|
237
248
|
require 'ecoportal/api/v2/page/component/reference_field'
|
238
249
|
require 'ecoportal/api/v2/page/component/law_field'
|
250
|
+
require 'ecoportal/api/v2/page/component/mailbox_field'
|
239
251
|
require 'ecoportal/api/v2/page/component/chart_field'
|
240
252
|
require 'ecoportal/api/v2/page/component/chart_fr_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.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -130,7 +130,7 @@ dependencies:
|
|
130
130
|
requirements:
|
131
131
|
- - ">="
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: 0.9.
|
133
|
+
version: 0.9.5
|
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.5
|
144
144
|
- - "<"
|
145
145
|
- !ruby/object:Gem::Version
|
146
146
|
version: '0.10'
|
@@ -184,6 +184,7 @@ files:
|
|
184
184
|
- lib/ecoportal/api/v2/page/component.rb
|
185
185
|
- lib/ecoportal/api/v2/page/component/action.rb
|
186
186
|
- lib/ecoportal/api/v2/page/component/action_field.rb
|
187
|
+
- lib/ecoportal/api/v2/page/component/actions_field.rb
|
187
188
|
- lib/ecoportal/api/v2/page/component/chart_field.rb
|
188
189
|
- lib/ecoportal/api/v2/page/component/chart_field/benchmark.rb
|
189
190
|
- lib/ecoportal/api/v2/page/component/chart_field/config.rb
|
@@ -197,6 +198,7 @@ files:
|
|
197
198
|
- lib/ecoportal/api/v2/page/component/chart_fr_field.rb
|
198
199
|
- lib/ecoportal/api/v2/page/component/checklist_field.rb
|
199
200
|
- lib/ecoportal/api/v2/page/component/checklist_item.rb
|
201
|
+
- lib/ecoportal/api/v2/page/component/contractor_entities_field.rb
|
200
202
|
- lib/ecoportal/api/v2/page/component/date_field.rb
|
201
203
|
- lib/ecoportal/api/v2/page/component/file.rb
|
202
204
|
- lib/ecoportal/api/v2/page/component/files_field.rb
|
@@ -208,6 +210,7 @@ files:
|
|
208
210
|
- lib/ecoportal/api/v2/page/component/images_field.rb
|
209
211
|
- lib/ecoportal/api/v2/page/component/law.rb
|
210
212
|
- lib/ecoportal/api/v2/page/component/law_field.rb
|
213
|
+
- lib/ecoportal/api/v2/page/component/mailbox_field.rb
|
211
214
|
- lib/ecoportal/api/v2/page/component/number_field.rb
|
212
215
|
- lib/ecoportal/api/v2/page/component/people_field.rb
|
213
216
|
- lib/ecoportal/api/v2/page/component/people_viewable_field.rb
|
@@ -264,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
264
267
|
- !ruby/object:Gem::Version
|
265
268
|
version: '0'
|
266
269
|
requirements: []
|
267
|
-
rubygems_version: 3.
|
270
|
+
rubygems_version: 3.4.12
|
268
271
|
signing_key:
|
269
272
|
specification_version: 4
|
270
273
|
summary: A collection of helpers for interacting with the ecoPortal MS's V2 API
|