eco-helpers 2.0.51 → 2.0.54

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: fb5e3755230835f1a3ad402b7dd2fc9b25902ea2ca3a621c8eae0229de716791
4
- data.tar.gz: c0af346142ec3ff97c32503597ae36d9844273e1c20fb6908a3cfcf5595dff54
3
+ metadata.gz: 6713de6610b0242f2d476fa8f82144b60c218ccede60d025f8f0cfd1e6bbecb7
4
+ data.tar.gz: d13d56411aa7b8a3210b604c95e37c71efba08fe22742bdbb9262681354a56cb
5
5
  SHA512:
6
- metadata.gz: 4a2f508415dac83ffe596e330d56a55eb427788d57d239b62b1523bb6abb8f465d6400c1f0c61135d7eb6e036a595d7aacb158cc464e9840a5af8ac56d3582af
7
- data.tar.gz: b791358e41d4aa2db17b5fcd68e0e2aa97af7b4c31d21d9308132e470f07a67c638b53085846006363e2d9d962dba9b5250a9afe358844b113ac4a7c73a4df53
6
+ metadata.gz: 97b1fb26b7fd5c0f973ce97629138590c2c8f64a6bb2005ff82b95e1c5b353907f75702ebe4d3901a1ba5adb593e6b009b79bc03a87341d4dfce6db26229d36d
7
+ data.tar.gz: e57f689af48070b215ca40f7dfbe5786f6fdf6a1d0013f795883213d02d3b9f0d97e0a26d548239b249c879f72c935e39f3ef684d65947a771da07c47f7fb427
data/CHANGELOG.md CHANGED
@@ -1,15 +1,37 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [2.0.51] - 2022-02-27
4
+ ## [2.0.54] - 2022-04-04
5
5
 
6
6
  ### Added
7
- - `Eco::API::MicroCases#person_update!` launches an update against the Server for one person
8
- - `Eco::API::MicroCases#take_email_from_account` with given an account associated to an `email` that we cannot take, it associates that account to a different email
7
+ - `Eco::API::UseCases::DefaultCases::Samples::Sftp` should tell where the files went in the local.
9
8
 
10
9
  ### Changed
11
10
  ### Fixed
12
11
 
12
+ ## [2.0.53] - 2022-04-04
13
+
14
+ ### Added
15
+ - `Eco::API::MicroCases#set_supervisor` prevent to set someone as supervisor of themselves.
16
+ - `Eco::API::UseCases::DefaultCases::Samples::Sftp` integration to modify the `source_folder`
17
+
18
+ ### Changed
19
+ - upgrade `ecoportal-api` and `ecoportal-api-v2` dependencies
20
+
21
+ ## [2.0.52] - 2022-03-04
22
+
23
+ ### Added
24
+ - `Eco::API::UseCases::DefaultCases::CleanUnknownTags` include `default_tag` refresh
25
+
26
+ ### Fixed
27
+ - `Eco::Data::Files::Directory#dir_files` to be returned in alphabetic order
28
+
29
+ ## [2.0.51] - 2022-02-27
30
+
31
+ ### Added
32
+ - `Eco::API::MicroCases#person_update!` launches an update against the Server for one person
33
+ - `Eco::API::MicroCases#take_email_from_account` with given an account associated to an `email` that we cannot take, it associates that account to a different email
34
+
13
35
  ## [2.0.50] - 2022-02-23
14
36
 
15
37
  ### Added
data/eco-helpers.gemspec CHANGED
@@ -30,8 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.add_development_dependency "yard", ">= 0.9.26", "< 0.10"
31
31
  spec.add_development_dependency "redcarpet", ">= 3.5.1", "< 3.6"
32
32
 
33
- spec.add_dependency 'ecoportal-api', '>= 0.8.4', '< 0.9'
34
- spec.add_dependency 'ecoportal-api-v2', '>= 0.8.25', '< 0.9'
33
+ spec.add_dependency 'ecoportal-api', '>= 0.8.5', '< 0.9'
34
+ spec.add_dependency 'ecoportal-api-v2', '>= 0.8.26', '< 0.9'
35
35
  spec.add_dependency 'aws-sdk-s3', '>= 1.83.0', '< 2'
36
36
  spec.add_dependency 'aws-sdk-ses', '>= 1.36.0', '< 2'
37
37
  spec.add_dependency 'dotenv', '>= 2.7.6', '< 2.8'
@@ -2,6 +2,8 @@ module Eco
2
2
  module API
3
3
  class MicroCases
4
4
  # Unique access point to set the `supervisor_id` value on a person.
5
+ # @note
6
+ # - It prevents the basic cyclic supervisor case (supervisor to be supervisor of hemselves)
5
7
  # @param person [Ecoportal::API::V1::Person] the person we want to update, carrying the changes to be done.
6
8
  # @param sup_id [nil, String] the **supervisor id** we should set on the `person`.
7
9
  # @param people [Eco::API::Organization::People] _People_ involved in the current update.
@@ -10,6 +12,7 @@ module Eco
10
12
  # @yieldparam supervisor_id [String] the **unknown** `supervisor_id`.
11
13
  def set_supervisor(person, sup_id, people, options)
12
14
  unless options.dig(:exclude, :core) || options.dig(:exclude, :supervisor)
15
+ return false if sup_id && ((person.id == sup_id) || (person.external_id == sup_id))
13
16
  cur_id = person.supervisor_id
14
17
  cur_super = cur_id && with_supervisor(cur_id, people)
15
18
  micro.with_supervisor(sup_id, people) do |new_super|
@@ -23,6 +23,12 @@ class Eco::API::UseCases::DefaultCases::CleanUnknownTags < Eco::API::Common::Loa
23
23
  unknown_tags = person.filter_tags.select {|tag| !tag?(tag)}
24
24
  person.filter_tags -= unknown_tags
25
25
  unknown_tag!(*unknown_tags)
26
+ if (account = person.account) && tag = account.default_tag
27
+ unless tag?(tag)
28
+ micro.refresh_default_tag(person.entry, person, options)
29
+ unknown_tag!(tag)
30
+ end
31
+ end
26
32
  update.add(person)
27
33
  end
28
34
  end
@@ -2,10 +2,10 @@ class Eco::API::UseCases::DefaultCases::Samples::Sftp < Eco::API::Common::Loader
2
2
  name "sftp-sample"
3
3
  type :other
4
4
 
5
- attr_reader :session
5
+ attr_reader :session, :options
6
6
 
7
7
  def main(session, options, usecase)
8
- @session = session
8
+ @session = session; @options = options
9
9
  options[:end_get] = false
10
10
  raise "The SFTP is not configured" unless session.sftp?
11
11
  case options.dig(:sftp, :command)
@@ -50,7 +50,7 @@ class Eco::API::UseCases::DefaultCases::Samples::Sftp < Eco::API::Common::Loader
50
50
  with_remote_files.tap do |files|
51
51
  unless files.empty?
52
52
  file_names = files.map {|file| to_remote_path(file.name)}
53
- puts "Getting the following files:"
53
+ puts "Getting the following files into the local folder '#{local_folder}':"
54
54
  puts file_names
55
55
  sftp.download(file_names, local_folder: local_folder)
56
56
  end
@@ -92,7 +92,7 @@ class Eco::API::UseCases::DefaultCases::Samples::Sftp < Eco::API::Common::Loader
92
92
  end
93
93
 
94
94
  def local_folder
95
- "."
95
+ options.dig(:sftp, :local_folder) || "."
96
96
  end
97
97
 
98
98
  def remote_folder
@@ -53,7 +53,7 @@ module Eco
53
53
 
54
54
  def dir_files(file: nil, pattern: dir_pattern)
55
55
  find = !!file ? file_pattern(file) : file_pattern(pattern)
56
- Dir.glob(find)
56
+ Dir.glob(find).sort
57
57
  end
58
58
 
59
59
  def newest_file(files_list = nil, file: nil)
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "2.0.51"
2
+ VERSION = "2.0.54"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eco-helpers
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.51
4
+ version: 2.0.54
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
@@ -116,7 +116,7 @@ dependencies:
116
116
  requirements:
117
117
  - - ">="
118
118
  - !ruby/object:Gem::Version
119
- version: 0.8.4
119
+ version: 0.8.5
120
120
  - - "<"
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0.9'
@@ -126,7 +126,7 @@ dependencies:
126
126
  requirements:
127
127
  - - ">="
128
128
  - !ruby/object:Gem::Version
129
- version: 0.8.4
129
+ version: 0.8.5
130
130
  - - "<"
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0.9'
@@ -136,7 +136,7 @@ dependencies:
136
136
  requirements:
137
137
  - - ">="
138
138
  - !ruby/object:Gem::Version
139
- version: 0.8.25
139
+ version: 0.8.26
140
140
  - - "<"
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0.9'
@@ -146,7 +146,7 @@ dependencies:
146
146
  requirements:
147
147
  - - ">="
148
148
  - !ruby/object:Gem::Version
149
- version: 0.8.25
149
+ version: 0.8.26
150
150
  - - "<"
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0.9'