eco-helpers 2.0.68 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -1
- data/eco-helpers.gemspec +2 -2
- data/lib/eco/api/session/config/api.rb +7 -5
- data/lib/eco/api/session/config/apis.rb +16 -3
- data/lib/eco/api/session/config.rb +1 -0
- data/lib/eco/api/usecases/default_cases/tagtree_case.rb +44 -0
- data/lib/eco/api/usecases/default_cases.rb +1 -0
- data/lib/eco/cli/config/default/usecases.rb +8 -0
- data/lib/eco/version.rb +1 -1
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b298bca88b1ee202218bf3e0ab5727db52d8893a4ea969deda1179198b02ddf
|
4
|
+
data.tar.gz: dd183eb58a6481851fde1fe257217541a175b4524f61ed1c61c9dff131d484b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d73a73a2dba773d09b83d0713e71f333f44e83acb51c5e6fbde83fbff60350c468ae5a79d60eaf4a9fd446b7416e5bd38ed181769e221df893b20b1a84afc50
|
7
|
+
data.tar.gz: 7a157045ebf97b9d0b10dadc5f1951a4eed311cd03335ac9f9b85288ef4fe3aa71bb7939e2266f124a9ee6687076bc5fc0afbaecff213ed2af45f11988b6543f
|
data/CHANGELOG.md
CHANGED
@@ -1,12 +1,22 @@
|
|
1
1
|
# Change Log
|
2
2
|
All notable changes to this project will be documented in this file.
|
3
3
|
|
4
|
-
## [2.
|
4
|
+
## [2.1.2] - 2022-09-xx
|
5
5
|
|
6
6
|
### Added
|
7
7
|
### Changed
|
8
8
|
### Fixed
|
9
9
|
|
10
|
+
## [2.1.1] - 2022-09-xx
|
11
|
+
|
12
|
+
### Added
|
13
|
+
- `Eco::API::Session::Config::Api#version_available?` to know if a version is available for use
|
14
|
+
- `Eco::API::Session::Config::Apis`, added `#default_pass` and `#default_email` to use the `GraphQL` api.
|
15
|
+
|
16
|
+
### Changed
|
17
|
+
- upgraded **dependency** to `ecoportal-api-graphql` **gem**
|
18
|
+
- upgraded **dependency** to `ecoportal-api-v2` **gem**
|
19
|
+
|
10
20
|
## [2.0.68] - 2022-09-19
|
11
21
|
|
12
22
|
### Added
|
data/eco-helpers.gemspec
CHANGED
@@ -31,8 +31,8 @@ Gem::Specification.new do |spec|
|
|
31
31
|
spec.add_development_dependency "redcarpet", ">= 3.5.1", "< 3.6"
|
32
32
|
|
33
33
|
spec.add_dependency 'ecoportal-api', '>= 0.8.5', '< 0.9'
|
34
|
-
spec.add_dependency 'ecoportal-api-v2', '>= 0.
|
35
|
-
spec.add_dependency 'ecoportal-api-graphql', '>= 0.1.
|
34
|
+
spec.add_dependency 'ecoportal-api-v2', '>= 0.9.1', '< 0.10'
|
35
|
+
spec.add_dependency 'ecoportal-api-graphql', '>= 0.1.9', '< 0.2'
|
36
36
|
spec.add_dependency 'aws-sdk-s3', '>= 1.83.0', '< 2'
|
37
37
|
spec.add_dependency 'aws-sdk-ses', '>= 1.36.0', '< 2'
|
38
38
|
spec.add_dependency 'dotenv', '>= 2.7.6', '< 2.8'
|
@@ -3,9 +3,7 @@ module Eco
|
|
3
3
|
class Session
|
4
4
|
class Config
|
5
5
|
class Api < Hash
|
6
|
-
|
7
6
|
class << self
|
8
|
-
|
9
7
|
def to_version(str)
|
10
8
|
case str.to_sym
|
11
9
|
when :external, :v1
|
@@ -32,7 +30,6 @@ module Eco
|
|
32
30
|
else
|
33
31
|
end
|
34
32
|
end
|
35
|
-
|
36
33
|
end
|
37
34
|
|
38
35
|
def initialize(name, root:, key:, host:, version:,
|
@@ -117,11 +114,11 @@ module Eco
|
|
117
114
|
end
|
118
115
|
|
119
116
|
def email
|
120
|
-
self["email"]
|
117
|
+
self["email"] || @root.default_email
|
121
118
|
end
|
122
119
|
|
123
120
|
def pass
|
124
|
-
self["pass"]
|
121
|
+
self["pass"] || @root.default_pass
|
125
122
|
end
|
126
123
|
|
127
124
|
def host
|
@@ -146,6 +143,11 @@ module Eco
|
|
146
143
|
!local?
|
147
144
|
end
|
148
145
|
|
146
|
+
# @return [Boolean] whether or not `version` is available
|
147
|
+
def version_available?(version)
|
148
|
+
api_paramms?(version)
|
149
|
+
end
|
150
|
+
|
149
151
|
def version(value = nil)
|
150
152
|
self.class.to_version(value || self["version"])
|
151
153
|
end
|
@@ -3,7 +3,6 @@ module Eco
|
|
3
3
|
class Session
|
4
4
|
class Config
|
5
5
|
class Apis < BaseConfig
|
6
|
-
|
7
6
|
def apis
|
8
7
|
self["apis"] ||= {}
|
9
8
|
end
|
@@ -87,6 +86,22 @@ module Eco
|
|
87
86
|
self["user_key"]
|
88
87
|
end
|
89
88
|
|
89
|
+
def default_email=(email)
|
90
|
+
self["default_email"] = email
|
91
|
+
end
|
92
|
+
|
93
|
+
def default_email
|
94
|
+
self["default_email"] || ENV['USER_EMAIL']
|
95
|
+
end
|
96
|
+
|
97
|
+
def default_pass=(pass)
|
98
|
+
self["default_pass"] = pass
|
99
|
+
end
|
100
|
+
|
101
|
+
def default_pass
|
102
|
+
self["default_pass"] || ENV['USER_PASS']
|
103
|
+
end
|
104
|
+
|
90
105
|
# Method to support CLI one-off API requests
|
91
106
|
def one_off
|
92
107
|
if one_off?
|
@@ -165,8 +180,6 @@ module Eco
|
|
165
180
|
end
|
166
181
|
return true
|
167
182
|
end
|
168
|
-
|
169
|
-
|
170
183
|
end
|
171
184
|
end
|
172
185
|
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
class Eco::API::UseCases::DefaultCases::TagTree < Eco::API::Common::Loaders::UseCase
|
2
|
+
name "tagtree"
|
3
|
+
type :other
|
4
|
+
|
5
|
+
attr_reader :session, :options
|
6
|
+
def main(session, options, usecase)
|
7
|
+
puts "Use case still in development"
|
8
|
+
exit
|
9
|
+
options[:end_get] = false
|
10
|
+
@session = session; @options = options
|
11
|
+
operations.keys.each do |key|
|
12
|
+
process(key)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def process(key)
|
17
|
+
case key
|
18
|
+
when :diff
|
19
|
+
require_graphql_auth!
|
20
|
+
|
21
|
+
when :show_backend
|
22
|
+
require_graphql_auth!
|
23
|
+
|
24
|
+
else
|
25
|
+
logger.warn("Operation #{key} not supported")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
|
31
|
+
def require_graphql_auth!
|
32
|
+
unless session.config.api.version_available?(:graphql)
|
33
|
+
logger.error("Missing parameters for to configure a GraphQL connexion.")
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
def operations
|
38
|
+
(options.dig(:tagtree, :operations) || {})
|
39
|
+
end
|
40
|
+
|
41
|
+
def graphql
|
42
|
+
@graphql ||= session.api(version: :graphql)
|
43
|
+
end
|
44
|
+
end
|
@@ -42,6 +42,7 @@ require_relative 'default_cases/set_supervisor_case'
|
|
42
42
|
require_relative 'default_cases/supers_hierarchy_case'
|
43
43
|
require_relative 'default_cases/supers_cyclic_identify_case'
|
44
44
|
require_relative 'default_cases/switch_supervisor_case'
|
45
|
+
require_relative 'default_cases/tagtree_case'
|
45
46
|
require_relative 'default_cases/to_csv_case'
|
46
47
|
require_relative 'default_cases/to_csv_detailed_case'
|
47
48
|
require_relative 'default_cases/transfer_account_case'
|
@@ -87,6 +87,14 @@ ASSETS.cli.config do |cnf|
|
|
87
87
|
options.deep_merge!(other: {file: {codes_column: col_codes}})
|
88
88
|
end
|
89
89
|
|
90
|
+
desc = "Allows to perform some checks on tagtree structure (requires GraphQL)"
|
91
|
+
cases.add("-tagtree", :other, desc, case_name: "tagtree")
|
92
|
+
.add_option("-show-backend", "Displays the tagtree as per back-end") do |options|
|
93
|
+
options.deep_merge!(tagtree: {operation: {show_backend: true}})
|
94
|
+
end.add_option("-diff", "Compares the tagtree.json file with the back-end") do |options|
|
95
|
+
options.deep_merge!(tagtree: {operation: {diff: true}})
|
96
|
+
end
|
97
|
+
|
90
98
|
desc = "Creates a CSV with the paths to each tag"
|
91
99
|
cases.add("-create-tag-paths", :other, desc, case_name: "create-tag-paths")
|
92
100
|
|
data/lib/eco/version.rb
CHANGED
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.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
@@ -136,27 +136,27 @@ dependencies:
|
|
136
136
|
requirements:
|
137
137
|
- - ">="
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.
|
139
|
+
version: 0.9.1
|
140
140
|
- - "<"
|
141
141
|
- !ruby/object:Gem::Version
|
142
|
-
version: '0.
|
142
|
+
version: '0.10'
|
143
143
|
type: :runtime
|
144
144
|
prerelease: false
|
145
145
|
version_requirements: !ruby/object:Gem::Requirement
|
146
146
|
requirements:
|
147
147
|
- - ">="
|
148
148
|
- !ruby/object:Gem::Version
|
149
|
-
version: 0.
|
149
|
+
version: 0.9.1
|
150
150
|
- - "<"
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '0.
|
152
|
+
version: '0.10'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: ecoportal-api-graphql
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - ">="
|
158
158
|
- !ruby/object:Gem::Version
|
159
|
-
version: 0.1.
|
159
|
+
version: 0.1.9
|
160
160
|
- - "<"
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '0.2'
|
@@ -166,7 +166,7 @@ dependencies:
|
|
166
166
|
requirements:
|
167
167
|
- - ">="
|
168
168
|
- !ruby/object:Gem::Version
|
169
|
-
version: 0.1.
|
169
|
+
version: 0.1.9
|
170
170
|
- - "<"
|
171
171
|
- !ruby/object:Gem::Version
|
172
172
|
version: '0.2'
|
@@ -579,6 +579,7 @@ files:
|
|
579
579
|
- lib/eco/api/usecases/default_cases/supers_cyclic_identify_case.rb
|
580
580
|
- lib/eco/api/usecases/default_cases/supers_hierarchy_case.rb
|
581
581
|
- lib/eco/api/usecases/default_cases/switch_supervisor_case.rb
|
582
|
+
- lib/eco/api/usecases/default_cases/tagtree_case.rb
|
582
583
|
- lib/eco/api/usecases/default_cases/to_csv_case.rb
|
583
584
|
- lib/eco/api/usecases/default_cases/to_csv_detailed_case.rb
|
584
585
|
- lib/eco/api/usecases/default_cases/transfer_account_case.rb
|