ecoportal-api 0.5.5 → 0.7.0
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 +62 -0
- data/ecoportal-api.gemspec +5 -5
- data/lib/ecoportal/api/common/base_model.rb +11 -3
- data/lib/ecoportal/api/common/batch_response.rb +3 -3
- data/lib/ecoportal/api/common/response.rb +2 -2
- data/lib/ecoportal/api/common/wrapped_response.rb +3 -3
- data/lib/ecoportal/api/internal/account.rb +11 -0
- data/lib/ecoportal/api/internal/permissions.rb +4 -1
- data/lib/ecoportal/api/internal/preferences.rb +5 -1
- data/lib/ecoportal/api/v1/people.rb +1 -1
- data/lib/ecoportal/api/v1/person.rb +6 -2
- data/lib/ecoportal/api/v1/person_schema.rb +1 -0
- data/lib/ecoportal/api/version.rb +1 -1
- metadata +30 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f796fceb53db69721014b596e1ffae27838e14cebb57e203603db97d04434996
|
4
|
+
data.tar.gz: 508db6f77b5a30e9ca9c67b5e938535b1fdc0dfcb0a2f65ad4a05e789560ab2b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65ebf6dca8615e88ac80b4b363e279aaa01ea7c96114d22eaa4faa12a227a5ac5299a581d09ff632d7a02472eeada2b6047c483511366a5cf6eddda1db16fa65
|
7
|
+
data.tar.gz: cd31897593cadd5b729d42ae5f339d052d0f1198847c38ffddba293e00aa4cdca583e83693d35f25d71caea7b8cf93c649140497f1a0f6ab923aaccd0b4523f8
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
# Change Log
|
2
|
+
All notable changes to this project will be documented in this file.
|
3
|
+
|
4
|
+
## [0.7.0] - 2020-09-11
|
5
|
+
|
6
|
+
### Added
|
7
|
+
### Changed
|
8
|
+
- `Ecoportal::API::Internal::Permissions`: **update for new abilities of ecoPortal release `1.5.2`**
|
9
|
+
- decoupled abilities: `person_core` into `person_core_create`, `person_core_edit`
|
10
|
+
### Fixed
|
11
|
+
|
12
|
+
|
13
|
+
## [0.6.0] - 2020-07-14
|
14
|
+
|
15
|
+
### Added
|
16
|
+
- `Ecoportal::API::Common::BaseModel#initial_doc`: `#consolidate!` modifies `original_doc`
|
17
|
+
- this helper allows to know what was the initial document the object was created with
|
18
|
+
- `Ecoportal::API::Common::BaseModel#as_update`: added parameter (default: `:last` => compare with `original_doc`)
|
19
|
+
- calling it with `:total` will compare the current `doc` with the `initial_doc`
|
20
|
+
### Changed
|
21
|
+
- `Ecoportal::API::Internal::Permissions`: **update for new abilities of ecoPortal release `1.5.0`**
|
22
|
+
- added abilities: `person_core`, `person_account`, `person_details`
|
23
|
+
- removed ability: `people`
|
24
|
+
- renamed `print` to `pretty_print` to avoid overriding `$stdout.print`, on:
|
25
|
+
- `Ecoportal::API::Common::BaseModel`
|
26
|
+
- `Ecoportal::API::Common::BatchReponse`
|
27
|
+
- `Ecoportal::API::Common::Response`
|
28
|
+
- `Ecoportal::API::Common::WrappedResponse`
|
29
|
+
### Fixed
|
30
|
+
- `Ecoportal::API::Internal::Preferences`: **kiosk** settings should default to `false` (`nil`)
|
31
|
+
|
32
|
+
## [0.5.8] - 2020-06-23
|
33
|
+
|
34
|
+
### Added
|
35
|
+
### Changed
|
36
|
+
### Fixed
|
37
|
+
- `Ecoportal::API::V1::Person#filter_tags=`: `original_doc["filter_tags"]` is `nil` when creating a person
|
38
|
+
- `Ecoportal::API::Internal::Account#policy_group_ids=`: `original_doc["account"]` is `nil` when creating a person
|
39
|
+
|
40
|
+
|
41
|
+
## [0.5.7] - 2020-06-22
|
42
|
+
|
43
|
+
### Added
|
44
|
+
- `Ecoportal::API::V1::PersonSchema`: added `enable_tags` & `tags` properties
|
45
|
+
- `Ecoportal::API::Internal::Preferences`: added missing fields for **kiosk**
|
46
|
+
### Changed
|
47
|
+
- `Ecoportal::API::V1::People::JOB_TIMEOUT`: from 1 minute to 3 minutes
|
48
|
+
- `Ecoportal::API::V1::Person#filter_tags=`: will preserve the original order of the matching tags
|
49
|
+
* this change is to prevent `as_update` to generate false update positives
|
50
|
+
- `Ecoportal::API::Internal::Account#policy_group_ids=`: will preserve the original order of the matching ids
|
51
|
+
* this change is to prevent `as_update` to generate false update positives
|
52
|
+
### Fixed
|
53
|
+
- `Ecoportal::API::Internal::Preferences`: access `doc` using string keys (not with `symbol` keys)
|
54
|
+
|
55
|
+
|
56
|
+
## [0.5.6] - 2020-06-08
|
57
|
+
|
58
|
+
### Added
|
59
|
+
- this `CHANGELOG.md` file
|
60
|
+
- person model: `freemium` core property
|
61
|
+
### Changed
|
62
|
+
### Fixed
|
data/ecoportal-api.gemspec
CHANGED
@@ -20,12 +20,12 @@ Gem::Specification.new do |spec|
|
|
20
20
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
21
21
|
spec.require_paths = ["lib"]
|
22
22
|
|
23
|
-
spec.add_development_dependency "bundler", "~> 1.
|
24
|
-
spec.add_development_dependency "rake", "~>
|
25
|
-
spec.add_development_dependency "rspec", "~> 3.
|
23
|
+
spec.add_development_dependency "bundler", "~> 2.1", ">= 2.1.3"
|
24
|
+
spec.add_development_dependency "rake", "~> 12.0"
|
25
|
+
spec.add_development_dependency "rspec", "~> 3", ">= 3.9"
|
26
26
|
spec.add_development_dependency "yard", "~> 0.9", ">= 0.9.18"
|
27
|
-
spec.add_development_dependency "redcarpet", "~> 3.
|
28
|
-
spec.add_development_dependency "pry"
|
27
|
+
spec.add_development_dependency "redcarpet", "~> 3.5", ">= 3.5.0"
|
28
|
+
spec.add_development_dependency "pry" , "~> 0.13"
|
29
29
|
|
30
30
|
spec.add_dependency 'http', '~> 3'
|
31
31
|
spec.add_dependency 'hash-polyfill', '~> 0'
|
@@ -48,6 +48,7 @@ module Ecoportal
|
|
48
48
|
if !_parent || !_key
|
49
49
|
@doc = doc
|
50
50
|
@original_doc = JSON.parse(@doc.to_json)
|
51
|
+
@initial_doc = JSON.parse(@doc.to_json)
|
51
52
|
end
|
52
53
|
end
|
53
54
|
|
@@ -63,6 +64,12 @@ module Ecoportal
|
|
63
64
|
_parent.original_doc.dig(*[_key].flatten)
|
64
65
|
end
|
65
66
|
|
67
|
+
def initial_doc
|
68
|
+
raise UnlinkedModel.new unless linked?
|
69
|
+
return @initial_doc if is_root?
|
70
|
+
_parent.initial_doc.dig(*[_key].flatten)
|
71
|
+
end
|
72
|
+
|
66
73
|
def as_json
|
67
74
|
doc
|
68
75
|
end
|
@@ -71,9 +78,10 @@ module Ecoportal
|
|
71
78
|
doc.to_json(*args)
|
72
79
|
end
|
73
80
|
|
74
|
-
def as_update
|
81
|
+
def as_update(ref = :last)
|
75
82
|
new_doc = as_json
|
76
|
-
|
83
|
+
ref_doc = ref == :total ? initial_doc : original_doc
|
84
|
+
Common::HashDiff.diff(new_doc, ref_doc)
|
77
85
|
end
|
78
86
|
|
79
87
|
def dirty?
|
@@ -100,7 +108,7 @@ module Ecoportal
|
|
100
108
|
end
|
101
109
|
end
|
102
110
|
|
103
|
-
def
|
111
|
+
def pretty_print
|
104
112
|
puts JSON.pretty_generate(as_json)
|
105
113
|
self
|
106
114
|
end
|
@@ -12,6 +12,17 @@ module Ecoportal
|
|
12
12
|
embeds_one :permissions, key: "permissions_custom", klass: :permissions_class
|
13
13
|
embeds_one :preferences, klass: :preferences_class
|
14
14
|
|
15
|
+
# Sets the `policy_group_ids`
|
16
|
+
def policy_group_ids=(value)
|
17
|
+
unless value.is_a?(Array)
|
18
|
+
raise "policy_group_ids= needs to be passed an Array, got #{value.class}"
|
19
|
+
end
|
20
|
+
|
21
|
+
ini_ids = (original_doc && original_doc["policy_group_ids"]) || []
|
22
|
+
# preserve original order to avoid false updates
|
23
|
+
doc["policy_group_ids"] = (ini_ids & value) + (value - ini_ids)
|
24
|
+
end
|
25
|
+
|
15
26
|
# Sets the `permissions_preset`.
|
16
27
|
# @note basically the same as `permissions_preset=` but when `"custom"`, it's changed to `nil`
|
17
28
|
# @param value [nil, String] preset name.
|
@@ -2,7 +2,10 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class Internal
|
4
4
|
class Permissions < Common::BaseModel
|
5
|
-
passthrough :files, :data, :reports
|
5
|
+
passthrough :files, :data, :reports
|
6
|
+
passthrough :organization, :person_core, :person_core_create, :person_core_edit
|
7
|
+
passthrough :person_account, :person_details
|
8
|
+
passthrough :pages, :page_editor, :registers
|
6
9
|
end
|
7
10
|
end
|
8
11
|
end
|
@@ -2,6 +2,10 @@ module Ecoportal
|
|
2
2
|
module API
|
3
3
|
class Internal
|
4
4
|
class Preferences < Common::BaseModel
|
5
|
+
passthrough :kiosk_enabled, :kiosk_workflow_message, :kiosk_create_button_label,
|
6
|
+
:kiosk_create_button_help, :kiosk_return_button_label, :kiosk_return_button_help,
|
7
|
+
:kiosk_dashboard_button_label, :kiosk_dashboard_button_help
|
8
|
+
|
5
9
|
[
|
6
10
|
:show_sidebar,
|
7
11
|
:show_shortcuts,
|
@@ -9,7 +13,7 @@ module Ecoportal
|
|
9
13
|
:show_recently_visited_forms,
|
10
14
|
:show_tasks,
|
11
15
|
:show_task_bubbles
|
12
|
-
].each do |field|
|
16
|
+
].map(&:to_s).each do |field|
|
13
17
|
define_method(field) do
|
14
18
|
if doc.key?(field)
|
15
19
|
doc[field]
|
@@ -8,7 +8,7 @@ module Ecoportal
|
|
8
8
|
# @attr_reader subordinates [Integer] the number of people this person is supervisor of.
|
9
9
|
# @attr details [PersonDetails, nil] the details of the person or `nil` if missing.
|
10
10
|
class Person < Common::BaseModel
|
11
|
-
passthrough :id, :external_id, :name, :email, :supervisor_id, :subordinates, :filter_tags
|
11
|
+
passthrough :id, :external_id, :name, :email, :supervisor_id, :subordinates, :filter_tags, :freemium
|
12
12
|
|
13
13
|
class_resolver :person_schema_class, "Ecoportal::API::V1::PersonSchema"
|
14
14
|
class_resolver :person_details_class, "Ecoportal::API::V1::PersonDetails"
|
@@ -49,12 +49,16 @@ module Ecoportal
|
|
49
49
|
unless value.is_a?(Array)
|
50
50
|
raise "filter_tags= needs to be passed an Array, got #{value.class}"
|
51
51
|
end
|
52
|
-
|
52
|
+
end_tags = value.map do |tag|
|
53
53
|
unless tag.match(VALID_TAG_REGEX)
|
54
54
|
raise "Invalid filter tag #{tag.inspect}"
|
55
55
|
end
|
56
56
|
tag.upcase
|
57
57
|
end
|
58
|
+
|
59
|
+
ini_tags = (original_doc && original_doc["filter_tags"]) || []
|
60
|
+
# preserve original order to avoid false updates
|
61
|
+
doc["filter_tags"] = (ini_tags & end_tags) + (end_tags - ini_tags)
|
58
62
|
end
|
59
63
|
|
60
64
|
def as_json
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecoportal-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tapio Saarinen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,42 +16,54 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '1
|
19
|
+
version: '2.1'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 2.1.3
|
20
23
|
type: :development
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
26
|
-
version: '1
|
29
|
+
version: '2.1'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 2.1.3
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rake
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
37
|
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
39
|
+
version: '12.0'
|
34
40
|
type: :development
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
44
|
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
46
|
+
version: '12.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: rspec
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3
|
53
|
+
version: '3'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '3.9'
|
48
57
|
type: :development
|
49
58
|
prerelease: false
|
50
59
|
version_requirements: !ruby/object:Gem::Requirement
|
51
60
|
requirements:
|
52
61
|
- - "~>"
|
53
62
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3
|
63
|
+
version: '3'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '3.9'
|
55
67
|
- !ruby/object:Gem::Dependency
|
56
68
|
name: yard
|
57
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -78,34 +90,34 @@ dependencies:
|
|
78
90
|
requirements:
|
79
91
|
- - ">="
|
80
92
|
- !ruby/object:Gem::Version
|
81
|
-
version: 3.
|
93
|
+
version: 3.5.0
|
82
94
|
- - "~>"
|
83
95
|
- !ruby/object:Gem::Version
|
84
|
-
version: '3.
|
96
|
+
version: '3.5'
|
85
97
|
type: :development
|
86
98
|
prerelease: false
|
87
99
|
version_requirements: !ruby/object:Gem::Requirement
|
88
100
|
requirements:
|
89
101
|
- - ">="
|
90
102
|
- !ruby/object:Gem::Version
|
91
|
-
version: 3.
|
103
|
+
version: 3.5.0
|
92
104
|
- - "~>"
|
93
105
|
- !ruby/object:Gem::Version
|
94
|
-
version: '3.
|
106
|
+
version: '3.5'
|
95
107
|
- !ruby/object:Gem::Dependency
|
96
108
|
name: pry
|
97
109
|
requirement: !ruby/object:Gem::Requirement
|
98
110
|
requirements:
|
99
|
-
- - "
|
111
|
+
- - "~>"
|
100
112
|
- !ruby/object:Gem::Version
|
101
|
-
version: '0'
|
113
|
+
version: '0.13'
|
102
114
|
type: :development
|
103
115
|
prerelease: false
|
104
116
|
version_requirements: !ruby/object:Gem::Requirement
|
105
117
|
requirements:
|
106
|
-
- - "
|
118
|
+
- - "~>"
|
107
119
|
- !ruby/object:Gem::Version
|
108
|
-
version: '0'
|
120
|
+
version: '0.13'
|
109
121
|
- !ruby/object:Gem::Dependency
|
110
122
|
name: http
|
111
123
|
requirement: !ruby/object:Gem::Requirement
|
@@ -149,8 +161,8 @@ files:
|
|
149
161
|
- ".rubocop.yml"
|
150
162
|
- ".travis.yml"
|
151
163
|
- ".yardopts"
|
164
|
+
- CHANGELOG.md
|
152
165
|
- Gemfile
|
153
|
-
- Gemfile.lock
|
154
166
|
- LICENSE
|
155
167
|
- README.md
|
156
168
|
- Rakefile
|
@@ -215,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
215
227
|
- !ruby/object:Gem::Version
|
216
228
|
version: '0'
|
217
229
|
requirements: []
|
218
|
-
rubygems_version: 3.0.
|
230
|
+
rubygems_version: 3.0.3
|
219
231
|
signing_key:
|
220
232
|
specification_version: 4
|
221
233
|
summary: A collection of helpers for interacting with the ecoPortal MS's various APIs
|