ecoportal-api-v2 0.8.20 → 0.8.21

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: dcd685a294969e210f94f8b8728fec32a94372d349064e14f9a59e24429b7753
4
- data.tar.gz: d1c8b4ddf1bcd9b3ac2203c6f1bb293aafcfc6de1d58dde79c7b425c87fe444b
3
+ metadata.gz: dfc9e699414df7fd4298148668b5b0a95759dc114758614d29da2ba7bc6472de
4
+ data.tar.gz: d589c4f84d7f0d55912d6542129bdebc74d599730a8980c1ec83b8317b7dd942
5
5
  SHA512:
6
- metadata.gz: 145593ad0fe8adf038c9565bafdeee1497e13ed165c45f8a40572463ff9fffb2bcb3eec8834595eab7b89efc6274ca9c1352ff7dd043ec6c632bdff8a01a2793
7
- data.tar.gz: 7b8bbb9a4ef83eb033005f5898254f4d67d1fd5e095453f111a4fe350e9ff30236bf0effc4a79c36edf72519a305f1f9596a5ac61dc99a0bdc06a2b5f74b7e1b
6
+ metadata.gz: 901028e62fb4e10920918815635a7b99b54fb058ab0c79514a338373aa3b9e6b200757f26912876c2b7bf97201e3958353795dea870e7dbc3154e4e1ad578954
7
+ data.tar.gz: 85951a26535f34d0cbbc66d35410c8059b83df436359fea19e478196db2b93496f8a17ac0fe048ef231309f2684546fac4cc037076ffb0603b54d03ccb0de22c
data/CHANGELOG.md CHANGED
@@ -1,14 +1,27 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [0.8.20] - 2021-10-xx
4
+ ## [0.8.21] - 2021-12-15
5
5
 
6
6
  ### Added
7
+ - To children of `Ecoportal::API::V2::Page::Component` added method `#to_s` (for exporting)
8
+ - `Ecoportal::API::V2::Page::Component::ReferenceField`
9
+ - added `#references` (the lookup results)
10
+ - added `#reference_ids` (the `ids` of the referenced oozes)
11
+
12
+ ### Changed
13
+ - Re-exposed `Ecoportal::API::V2::Stages#ordered`
14
+
15
+ ### Fixed
16
+ - `Ecoportal::API::V2::Page::Component::ImagesField#images` typo in `klass`
17
+
18
+ ## [0.8.20] - 2021-12-09
19
+
7
20
  ### Changed
8
21
  - `Ecoportal::API::V2::Pages::PageStage#permits` removed
9
22
  - The reason is that it should be changed using the `Stage#permits` instead
10
23
  - Upgraded `ecoportal-api` gem dependency
11
-
24
+
12
25
  ### Fixed
13
26
  - `Ecoportal::API::V2::Page::Stage#sections` typo
14
27
 
@@ -55,6 +55,10 @@ module Ecoportal
55
55
  doc.tap {|d| d.uniq! if uniq?}
56
56
  end
57
57
 
58
+ def to_s(delimiter: "|")
59
+ map(&:to_s).join(delimiter)
60
+ end
61
+
58
62
  # @see #_items
59
63
  # @return [Array] a **copy** of the `Array` elements
60
64
  def to_a
@@ -29,6 +29,19 @@ module Ecoportal
29
29
  passthrough :duration_in_days, read_only: true
30
30
  passarray :file_container_ids
31
31
 
32
+ def to_s
33
+ stat = case
34
+ when overdue
35
+ "Overdue"
36
+ when complete
37
+ "Complete"
38
+ else
39
+ "Pending"
40
+ end
41
+ assignee = assigned_person_member["name"] || assigned_person_member["email"]
42
+ "#{name}, #{created_at.to_s}, #{stat}, #{assignee}"
43
+ end
44
+
32
45
  end
33
46
  end
34
47
  end
@@ -30,6 +30,10 @@ module Ecoportal
30
30
  end
31
31
  end
32
32
 
33
+ def to_s(delimiter: "\n")
34
+ ordered_tasks.map(&:to_s).join(delimiter)
35
+ end
36
+
33
37
  # Quick config helper
34
38
  # @param conf [Symbol, Array<Symbol>]
35
39
  # - `:requires` required number of completed actions
@@ -24,6 +24,10 @@ module Ecoportal
24
24
  end
25
25
  end
26
26
 
27
+ def to_s(delimiter: "\n")
28
+ ordered_items.map(&:to_s).compact.join(delimiter)
29
+ end
30
+
27
31
  private
28
32
 
29
33
  def fix_item_weights!
@@ -19,6 +19,10 @@ module Ecoportal
19
19
  passthrough :label
20
20
  passthrough :weight
21
21
  passboolean :checked
22
+
23
+ def to_s
24
+ checked ? label : nil
25
+ end
22
26
  end
23
27
  end
24
28
  end
@@ -34,6 +34,10 @@ module Ecoportal
34
34
  doc["create_event"] = !!value
35
35
  end
36
36
 
37
+ def to_s
38
+ value.to_s
39
+ end
40
+
37
41
  # Quick config helper
38
42
  # @param conf [Symbol, Array<Symbol>]
39
43
  # - `:time` to show time
@@ -19,6 +19,10 @@ module Ecoportal
19
19
  passthrough :file_size, :content_type, :token, read_only: true
20
20
  passthrough :file_container_id
21
21
  passdate :file_update_at, read_only: true
22
+
23
+ def to_s
24
+ file_container_id
25
+ end
22
26
  end
23
27
  end
24
28
  end
@@ -24,6 +24,10 @@ module Ecoportal
24
24
  end
25
25
  end
26
26
 
27
+ def to_s(delimiter: "\n")
28
+ ordered_files.map(&:to_s).join(delimiter)
29
+ end
30
+
27
31
  private
28
32
 
29
33
  def fix_file_positions!
@@ -26,6 +26,9 @@ module Ecoportal
26
26
  end
27
27
  end
28
28
 
29
+ def to_s
30
+ value.to_s
31
+ end
29
32
  end
30
33
  end
31
34
  end
@@ -5,6 +5,10 @@ module Ecoportal
5
5
  class Component
6
6
  class GeoCoordinates < Common::Content::DoubleModel
7
7
  passthrough :lat, :lon
8
+
9
+ def to_s
10
+ "#{lat},#{lon}" if lat & lon
11
+ end
8
12
  end
9
13
  end
10
14
  end
@@ -6,6 +6,10 @@ module Ecoportal
6
6
  class GeoField < Page::Component
7
7
  passthrough :address
8
8
  embeds_one :coordinates, klass: "Ecoportal::API::V2::Page::Component::GeoCoordinates"
9
+
10
+ def to_s
11
+ coordinates.to_s
12
+ end
9
13
  end
10
14
  end
11
15
  end
@@ -15,7 +15,11 @@ module Ecoportal
15
15
 
16
16
  passthrough :layout
17
17
  passboolean :strech, :no_popup, :hide_options
18
- embeds_many :images, klass: "Ecoportal::API::V2::Page::Image", order_key: :weight
18
+ embeds_many :images, klass: "Ecoportal::API::V2::Page::Component::Image", order_key: :weight
19
+
20
+ def to_s
21
+ images.count
22
+ end
19
23
 
20
24
  # Quick config helper
21
25
  # @param conf [Symbol, Array<Symbol>]
@@ -40,6 +40,10 @@ module Ecoportal
40
40
  viewable_fields.delete!(field_id)
41
41
  end
42
42
 
43
+ def to_s(delimiter: "\n")
44
+ people_ids.join(delimiter)
45
+ end
46
+
43
47
  # Quick config helper
44
48
  # @param conf [Symbol, Array<Symbol>]
45
49
  # - `:snapshot` to set mode to `snapshot`
@@ -9,6 +9,10 @@ module Ecoportal
9
9
  passthrough :max_length
10
10
  passboolean :exact_index
11
11
 
12
+ def to_s
13
+ value
14
+ end
15
+
12
16
  # Quick config helper
13
17
  # @param conf [Symbol, Array<Symbol>]
14
18
  # - `:multiline` multi line mode
@@ -5,10 +5,21 @@ module Ecoportal
5
5
  class Component
6
6
  class ReferenceField < Page::Component
7
7
  passthrough :register_id
8
+ passarray :references
8
9
  passboolean :hide_create, :hide_attach
9
10
  passboolean :hide_metadata, :hide_dashboards
10
11
  passboolean :display_fields, :display_fields_in_lookup
11
12
 
13
+ def reference_ids
14
+ references.map do |ref|
15
+ ref["id"]
16
+ end
17
+ end
18
+
19
+ def to_s(delimiter: "\n")
20
+ reference_ids.to_a.join(delimiter)
21
+ end
22
+
12
23
  # Quick config helper
13
24
  # @param conf [Symbol, Array<Symbol>]
14
25
  # - `:show_fields` specify if the public register fields should be shown (requires `register_id`)
@@ -5,6 +5,23 @@ module Ecoportal
5
5
  class Component
6
6
  class RichTextField < Page::Component
7
7
  passthrough :content
8
+
9
+ HTML_TAGS_REX = /<("[^"]*"|'[^']*'|[^'">])*>/
10
+
11
+ def to_s
12
+ remove_html_tags(content)
13
+ end
14
+
15
+ private
16
+
17
+ def remove_html_tags(str)
18
+ str = str.gsub(HTML_TAGS_REX, ' ') if str
19
+ str = str.gsub(/[^[:print:]]/, '') if str
20
+ str = str.gsub(":&nbsp;", ' ') if str
21
+ str = str.gsub("&#34;", '"') if str
22
+ str = str.gsub("&amp;", '&') if str
23
+ str
24
+ end
8
25
  end
9
26
  end
10
27
  end
@@ -63,6 +63,12 @@ module Ecoportal
63
63
  end
64
64
  end
65
65
 
66
+ def to_s(name: true, delimiter: "\n")
67
+ [selected].flatten.compact.map do |opt|
68
+ name ? opt.name : opt.value
69
+ end.join(delimiter)
70
+ end
71
+
66
72
  # Quick config helper
67
73
  # @param conf [Symbol, Array<Symbol>]
68
74
  # - `:flat` to display in flat mode
@@ -7,6 +7,10 @@ module Ecoportal
7
7
  passboolean :single_select, :use_defaults
8
8
  passthrough :tag_tree_id, :button_text
9
9
 
10
+ def to_s(delimiter: "\n")
11
+ root.tags.to_s(delimiter: delimiter)
12
+ end
13
+
10
14
  # Quick config helper
11
15
  # @param conf [Symbol, Array<Symbol>]
12
16
  # - `:multiple` to allow multiple selection
@@ -19,11 +19,11 @@ module Ecoportal
19
19
  end
20
20
  end
21
21
 
22
- #def ordered
23
- # self.sort_by.with_index do |stage, index|
24
- # [stage.ordering, index]
25
- # end
26
- #end
22
+ def ordered
23
+ self.sort_by.with_index do |stage, index|
24
+ [stage.ordering, index]
25
+ end
26
+ end
27
27
 
28
28
  end
29
29
  end
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- GEM2_VERSION = "0.8.20"
3
+ GEM2_VERSION = "0.8.21"
4
4
  end
5
5
  end
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: 0.8.20
4
+ version: 0.8.21
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-08 00:00:00.000000000 Z
11
+ date: 2021-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler