eco-helpers 1.0.14 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8187e0511f185e36a43a0e123938b1062045b812d747800b34e098a2c0b1bf62
4
- data.tar.gz: a6f591af8ab1998a9476903e056a0f97c0ecaaaabbfdea87ceb31ef2a165570e
3
+ metadata.gz: 95da9d9333887803067673474e450666533d5c94379048ccf9a15e43b41d4ff2
4
+ data.tar.gz: b5beff497b2e1ade6d47471381908d318f18b61b16c7a379289f3965c23f32d6
5
5
  SHA512:
6
- metadata.gz: d8b11d2f308202c4b122445ea348e7219dfe7a156f5e5d5fca7b3605c38215a1b8216a5447dce43626afa41cf28973459436594b520b4d4a491a776dc1a3e298
7
- data.tar.gz: ee27de5eb9c71d394d6bc28e1e3966f8d3c88b4aeb0603c56e724b4865070bddef79175ed3b16c4aaafeb6d1474bb0fc2b768c4814039c61ba277d4b211cbf5e
6
+ metadata.gz: 28cd8fb38da900ed0917313c662a51e98e9cb2e1847b4a1b49308a452cc4814c2b7077cddfbc1fe9a0c94f1aedafc22da7fc4344c874b14d102bd06d3459c8da
7
+ data.tar.gz: 9a1ade2d02d8ab9460fc88bc0c56d36ba13cea56e9d31873db0c135c4340bd81bf701d3e59b8dab147d15d2692cd7568fda487ab56bfda7ac766b485bc29eab9
@@ -43,6 +43,13 @@ module Eco
43
43
  end.compact
44
44
  end
45
45
 
46
+ def path_to_link(path)
47
+ unless path.is_a?(Enumerable)
48
+ return "https://s3.console.aws.amazon.com/s3/object/#{path.sub("s3://","")}?region=#{fetch_region}&tab=overview"
49
+ end
50
+ path.map {|pth| path_to_link(pth)}
51
+ end
52
+
46
53
  private
47
54
 
48
55
  def full_path(obj)
@@ -214,6 +214,7 @@ module Eco
214
214
  # @param content [String] content to be uploaded (requires `file`)
215
215
  # @param file [String] name of the file to be uploaded
216
216
  # @param directory [String] name of source directory to be uploaded
217
+ # @return [String, Array<String>] paths to S3
217
218
  def s3upload(content: nil, file: nil, directory: nil)
218
219
  if content && file
219
220
  s3uploader.upload(file, content)
@@ -2,6 +2,10 @@ module Eco
2
2
  module API
3
3
  class Session
4
4
  class Batch
5
+ # The `Batch::Status` class aims to offer support to keep memory on:
6
+ # 1. what has happened during the execution of a `Session::Batch` (i.e. errors)
7
+ # 2. be able to build a summary of what happened
8
+ # 3. gather the people that was returned as a result of the `batch` (for `get` batch type)
5
9
  # @attr_reader source_queue [Array<Hash>, Array<Ecoportal::API::V1::Person>, Array<Ecoportal::API::Internal::Person>]
6
10
  # The queue as it was originally made (it could contain duplicates)
7
11
  # @attr_reader queue [Array<Hash>, Array<Ecoportal::API::V1::Person>, Array<Ecoportal::API::Internal::Person>]
@@ -12,6 +12,14 @@ module Eco
12
12
  self["cache"]
13
13
  end
14
14
 
15
+ def partial_cache
16
+ if file = self.cache
17
+ File.join(File.dirname(file),
18
+ File.basename(file, File.extname(file)) + "_partial" + File.extname(file)
19
+ )
20
+ end
21
+ end
22
+
15
23
  # specifies if people search should be strict or not
16
24
  def strict_search=(value)
17
25
  self["strict_search"] = !!value
@@ -1,6 +1,7 @@
1
1
  module Eco
2
2
  module API
3
3
  class Session
4
+ # Set of helpers to do most common tasks
4
5
  class Task < API::Common::Session::BaseSession
5
6
  NEWEST_FILE_MODE = [:newest, :last_file, :previous]
6
7
  LOAD_FILE_MODE = [:file]
@@ -24,8 +24,8 @@ ASSETS.cli.config do |config|
24
24
  # save partial entries -> should be native to session.workflow
25
25
  partial_update = io.options.dig(:people, :get, :type) == :partial
26
26
  if !io.options[:dry_run] && partial_update
27
- #enviro.config.people.cache
28
- io.session.file_manager.save_json(io.people, "cache/people_partial.json", :timestamp)
27
+ partial_file = io.session.config.people.partial_cache
28
+ io.session.file_manager.save_json(io.people, partial_file, :timestamp)
29
29
  end
30
30
  io
31
31
  end
data/lib/eco/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Eco
2
- VERSION = "1.0.14"
2
+ VERSION = "1.1.1"
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: 1.0.14
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura