ecoportal-api-v2 0.8.4 → 0.8.8

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: 63d37cfa2d9b609207eb06ce65d9b2c5184296ce33b4fab2b9a38ca91fa94a90
4
- data.tar.gz: 8e5db3051d415f7e70a27a5f4c93bf87c03febb6660c7da7a323e84dfb539b83
3
+ metadata.gz: 2d7fd0373344854c22b4397e7e2d2645dd799695424f3fa30d006fca2081676d
4
+ data.tar.gz: 2d839f8ecb67512c2c5d00a2bd6832e53d304334f2c5a6bbc291958661e21130
5
5
  SHA512:
6
- metadata.gz: de42e53ed858e09838f63e8dad3735b276bcea93d076530f7b899779d36293568c26f1e1ce7e236d5d182f7c548ac887d209161bd8ee959bebd652b5519c16a0
7
- data.tar.gz: 8991b881e1cbeec44def7408184c8cd6e8170d2bbaaa8ef0f1483497338b80461f14a7a34b281186a976f7116579def4a70ebf7a2b4bedf5fdde95765bd7c5b2
6
+ metadata.gz: 27425f592041428b0d07f9593c78f2a80095311e4890a3569ce212e37f067a3b36f2a3b147459e7dca368f7a737671ac9325df6ed40cec3d4a18f75d0ea18d28
7
+ data.tar.gz: c4cee01feb2c89179da4eda1d3699e5900812b52fb7d198a1447935ac4e89c347bee56ba69c5f6d1a407f968da21112cf0a490855811ddfd5048caace430c422
data/CHANGELOG.md CHANGED
@@ -1,17 +1,44 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [0.8.4] - 2021-02-xx
4
+ ## [0.8.8] - 2021-06-xx
5
5
 
6
6
  ### Added
7
+ - `Ecoportal::API::V2::Page::Component::ChartField::Benchmark`
8
+ - Support to convert selection options between numeric and text type.
9
+ - Add `Permit` object to `Page` and `Stage`
10
+
7
11
  ### Changed
8
- - roll back `ecoportal-api` dependency
12
+ - Removed `Stages.ordered_stages`: detected bug with Enumerable iteration
9
13
 
10
14
  ### Fixed
11
15
 
12
- ## [0.8.3] - 2021-02-22
16
+ ## [0.8.7] - 2021-05-25
17
+
18
+ ### Changed
19
+ - Upgrade `ecoportal-api` gem
20
+
21
+ ### Fixed
22
+ - Requiring `api/common` from 2 different ends
23
+
24
+ ## [0.8.6] - 2021-02-23
13
25
 
14
26
  ### Added
27
+ - `Ecoportal::API::V2::Page::Component::SelectionField` added methods `#numeric!` `#text!`
28
+
29
+ ## [0.8.5] - 2021-02-22
30
+
31
+ ### Changed
32
+ - upgrade
33
+
34
+
35
+ ## [0.8.4] - 2021-02-22
36
+
37
+ ### Changed
38
+ - roll back `ecoportal-api` dependency
39
+
40
+ ## [0.8.3] - 2021-02-22
41
+
15
42
  ### Changed
16
43
  - updated `rspec` for expected patch data on `delete` operation.
17
44
 
@@ -20,23 +47,16 @@ All notable changes to this project will be documented in this file.
20
47
 
21
48
  ## [0.8.2] - 2021-02-21
22
49
 
23
- ### Added
24
50
  ### Changed
25
51
  - some necessary changes for the new gem to be active
26
52
 
27
- ### Fixed
28
-
29
53
  ## [0.8.1] - 2021-02-21
30
54
 
31
- ### Added
32
55
  ### Changed
33
56
  - renamed parameters (backwards incompatible change):
34
57
  - `Ecoportal::API::V2::Pages::Stages` methods `#get` and `#update`
35
58
  - updated `Ecoportal::API::V2::Pages#` accordingly
36
59
 
37
- ### Fixed
38
-
39
-
40
60
  ## MOVED TO GEM `ecoportal-api-v2` ##
41
61
 
42
62
  ## [0.7.5] - 2021-02-21
@@ -130,42 +150,29 @@ All notable changes to this project will be documented in this file.
130
150
  - automatic key builder
131
151
  - helper: `Ecoportal::API::V2::v2key` method
132
152
  - `user_key:` and `org_key:` as constructor methods for `Ecoportal::API::V2`
133
- ### Changed
134
- ### Fixed
135
153
 
136
154
  ## [0.7.1] - 2020-10-07
137
155
 
138
- ### Added
139
156
  ### Changed
140
157
  - updated dependencies
141
- ### Fixed
142
-
143
158
 
144
159
  ## [0.7.0] - 2020-09-10
145
160
 
146
- ### Added
147
161
  ### Changed
148
162
  - updated dependencies
149
- ### Fixed
150
163
 
151
164
  ## [0.6.1] - 2020-07-11
152
165
 
153
166
  ### Added
154
167
  - `Ecoportal::API::Common::Content::DoubleModel#pretty_print`
155
- ### Changed
156
- ### Fixed
157
168
 
158
169
  ## [0.6.0] - 2020-07-11
159
170
 
160
- ### Added
161
171
  ### Changed
162
172
  - upgraded `ecoportal-api` gem
163
- ### Fixed
164
173
 
165
174
  ## [0.5.9] - 2020-07-02
166
175
 
167
176
  ### Added
168
177
  - helper `Ecoportal::API::Common::Content::StringDigest#indexable_label`: to see the part of a label that gets indexed
169
178
  - this `CHANGELOG.md` file
170
- ### Changed
171
- ### Fixed
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require "bundler/setup"
4
- require "ecoportal/api"
4
+ require "ecoportal/api-v2"
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -1,11 +1,11 @@
1
1
 
2
2
  lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require "ecoportal/api/v2/version"
4
+ require "ecoportal/api/v2_version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "ecoportal-api-v2"
8
- spec.version = Ecoportal::API::V2::GEM_VERSION
8
+ spec.version = Ecoportal::API::GEM2_VERSION
9
9
  spec.authors = ["Oscar Segura"]
10
10
  spec.email = ["rien@ecoportal.co.nz", "oscar@ecoportal.co.nz", "bozydar@ecoportal.co.nz"]
11
11
 
@@ -22,13 +22,12 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
- spec.add_development_dependency "bundler", ">= 2.2.11", "< 2.3"
25
+ spec.add_development_dependency "bundler", ">= 2.2.17", "< 2.3"
26
26
  spec.add_development_dependency "rspec", ">= 3.10.0", "< 3.11"
27
27
  spec.add_development_dependency "rake", ">= 13.0.3", "< 13.1"
28
28
  spec.add_development_dependency "yard", ">= 0.9.26", "< 0.10"
29
29
  spec.add_development_dependency "redcarpet", ">= 3.5.1", "< 3.6"
30
- spec.add_development_dependency "pry" , "~> 0.14"
30
+ spec.add_development_dependency "pry" , ">= 0.14"
31
31
 
32
- #spec.add_dependency 'ecoportal-api', '>= 0.8.1', '< 0.9'
33
- spec.add_dependency 'ecoportal-api', '>= 0.7.5', '< 0.8'
32
+ spec.add_dependency 'ecoportal-api', '>= 0.8.3', '< 0.9'
34
33
  end
@@ -1,10 +1,10 @@
1
1
  require "ecoportal/api"
2
- require "ecoportal/api/v2/version"
2
+ require "ecoportal/api/v2_version"
3
3
 
4
4
  module Ecoportal
5
5
  module API
6
6
  end
7
7
  end
8
8
 
9
- require_relative "api/common"
9
+ require_relative "api/common.v2"
10
10
  require_relative "api/v2"
@@ -0,0 +1,8 @@
1
+ module Ecoportal
2
+ module API
3
+ module Common
4
+ end
5
+ end
6
+ end
7
+
8
+ require 'ecoportal/api/common/content'
@@ -151,7 +151,7 @@ module Ecoportal
151
151
  else
152
152
  raise "You should either specify the 'klass' of the elements or the 'enum_class'"
153
153
  end
154
- embed(method, key: key, multiple: true, klass: eclass)
154
+ embed(method, key: key, multiple: true, klass: eclass)
155
155
  end
156
156
 
157
157
  private
@@ -258,10 +258,10 @@ module Ecoportal
258
258
 
259
259
  def reset!(key = nil)
260
260
  if key
261
- keys = [].push(key).compact
261
+ keys = [key].flatten.compact
262
262
  odoc = original_doc.dig(*keys)
263
- dig_set(doc, key, odoc && JSON.parse(odoc.to_json))
264
-
263
+ odoc = odoc && JSON.parse(odoc.to_json)
264
+ dig_set(doc, keys, odoc)
265
265
  else
266
266
  replace_doc(JSON.parse(original_doc.to_json))
267
267
  end
@@ -34,6 +34,7 @@ module Ecoportal
34
34
  end
35
35
  end
36
36
 
37
+ require 'ecoportal/api/v2/page/permit'
37
38
  require 'ecoportal/api/v2/page/component'
38
39
  require 'ecoportal/api/v2/page/components'
39
40
  require 'ecoportal/api/v2/page/section'
@@ -16,6 +16,7 @@ module Ecoportal
16
16
  embeds_one :sankey_config, klass: "Ecoportal::API::V2::Page::Component::ChartField::Sankey"
17
17
  embeds_one :indicator_config, klass: "Ecoportal::API::V2::Page::Component::ChartField::Indicator"
18
18
  embeds_one :faceted_series_config, klass: "Ecoportal::API::V2::Page::Component::ChartField::Multiseries"
19
+ embeds_one :benchmark_config, klass: "Ecoportal::API::V2::Page::Component::ChartField::Benchmark"
19
20
 
20
21
  embeds_many :series, klass: "Ecoportal::API::V2::Page::Component::ChartField::Serie"
21
22
 
@@ -35,6 +36,8 @@ module Ecoportal
35
36
  indicator_config
36
37
  when "faceted_series"
37
38
  faceted_series_config
39
+ when "benchmark"
40
+ benchmark_config
38
41
  end
39
42
  end
40
43
 
@@ -52,3 +55,4 @@ require 'ecoportal/api/v2/page/component/chart_field/heatmap'
52
55
  require 'ecoportal/api/v2/page/component/chart_field/sankey'
53
56
  require 'ecoportal/api/v2/page/component/chart_field/indicator'
54
57
  require 'ecoportal/api/v2/page/component/chart_field/multiseries'
58
+ require 'ecoportal/api/v2/page/component/chart_field/benchmark'
@@ -0,0 +1,28 @@
1
+ module Ecoportal
2
+ module API
3
+ class V2
4
+ class Page
5
+ class Component
6
+ class ChartField
7
+ class Benchmark < Common::Content::DoubleModel
8
+ passkey :id
9
+ passthrough :patch_ver
10
+
11
+ passthrough :register_id
12
+ passthrough :source_type
13
+ passthrough :benchmark_field, :benchmark_label
14
+ passthrough :across, :across_field
15
+ passthrough :against_field, :against_label
16
+ passthrough :grouped, :group_field
17
+
18
+ passthrough :calculation_mode
19
+ passthrough :min, :max
20
+
21
+ passthrough :filters
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -13,8 +13,8 @@ module Ecoportal
13
13
  passthrough :attached_people_permissions_enabled, :apply_attached_people_permissions_to
14
14
  passthrough :attached_people_permissions_editable, :attached_people_permissions_flags
15
15
 
16
- def add(id)
17
- people_ids << id
16
+ def add(*ids)
17
+ people_ids << ids
18
18
  end
19
19
 
20
20
  end
@@ -6,9 +6,20 @@ module Ecoportal
6
6
  class SelectionField < Page::Component
7
7
  passthrough :multiple, :flat
8
8
  passthrough :other, :other_desc
9
+ passthrough :data_type
9
10
 
10
11
  embeds_many :options, klass: "Ecoportal::API::V2::Page::Component::SelectionOption", order_key: :weight
11
12
 
13
+ def numeric!(&block)
14
+ ordered_options.each {|opt| opt.numeric!(&block)}
15
+ self.data_type = "num"
16
+ end
17
+
18
+ def text!(&block)
19
+ ordered_options.each {|opt| opt.text!(&block)}
20
+ self.data_type = "str"
21
+ end
22
+
12
23
  def select(value)
13
24
  opt = options.find {|opt| opt.value == value}
14
25
  sel = selected
@@ -34,7 +45,7 @@ module Ecoportal
34
45
  end
35
46
 
36
47
  def add_option(name:, value:, pos: NOT_USED, before: NOT_USED, after: NOT_USED)
37
- opt_doc = options.items_class.new_doc
48
+ opt_doc = options.items_class.new_doc
38
49
  options.upsert!(opt_doc, pos: pos, before: before, after: after) do |option|
39
50
  option.name = name
40
51
  option.value = value
@@ -4,7 +4,7 @@ module Ecoportal
4
4
  class Page
5
5
  class Component
6
6
  class SelectionOption < Common::Content::DoubleModel
7
-
7
+
8
8
  class << self
9
9
  def new_doc
10
10
  {
@@ -17,6 +17,15 @@ module Ecoportal
17
17
  passkey :id
18
18
  passthrough :patch_ver, :name, :value
19
19
  passthrough :weight, :selected
20
+
21
+ def numeric!
22
+ self.value = block_given?? yield(value) : value.to_i
23
+ end
24
+
25
+ def text!
26
+ self.value = block_given?? yield(value) : value.to_s
27
+ end
28
+
20
29
  end
21
30
  end
22
31
  end
@@ -0,0 +1,14 @@
1
+ module Ecoportal
2
+ module API
3
+ class V2
4
+ class Page
5
+ class Permit < Common::Content::DoubleModel
6
+ passkey :id
7
+ passthrough :patch_ver
8
+ passthrough :user_id, :user_name
9
+ passthrough :editable, :flags
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -5,9 +5,13 @@ module Ecoportal
5
5
  class Stage < Common::Content::DoubleModel
6
6
  passkey :id
7
7
  passthrough :patch_ver
8
- passthrough :name
8
+ passthrough :namem, :ordering
9
9
  passarray :subtags, order_matters: false
10
10
  passarray :section_ids
11
+ passthrough :complete, :status, :lock_after_completion
12
+ embeds_many :permits, klass: "Ecoportal::API::V2::Page::Permit"
13
+ passthrough :disable_direct_permissions
14
+ passthrough :creator_enabled, :creator_editable, :creator_flags
11
15
  passthrough :can
12
16
 
13
17
  def sections
@@ -13,11 +13,11 @@ module Ecoportal
13
13
  end
14
14
  end
15
15
 
16
- def ordered_stages
17
- stages.each_with_index.sort_by do |stage, index|
18
- (stage.ordering >= 9999) ? [index, index] : [stage.ordering, index]
19
- end.map(&:first)
20
- end
16
+ #def ordered
17
+ # self.each_with_index.sort_by do |stage, index|
18
+ # (stage.ordering >= 9999) ? [index, index] : [stage.ordering, index]
19
+ # end.map(&:first)
20
+ #end
21
21
 
22
22
  end
23
23
  end
@@ -4,11 +4,12 @@ module Ecoportal
4
4
  class Pages
5
5
  class PageStage < V2::Page
6
6
  passthrough :mould_counter, :archive
7
- passthrough :task_priority, :state
7
+ passthrough :task_priority, :state, :status
8
8
  passthrough :votes_enabled, :upvotes, :downvotes
9
9
 
10
- passarray :force_errors, :subtags, :permits, order_matters: false
11
- passthrough :evolution
10
+ embeds_many :permits, klass: "Ecoportal::API::V2::Page::Permit"
11
+ passarray :force_errors, :subtags, order_matters: false
12
+ #passthrough :evolution
12
13
  end
13
14
  end
14
15
  end
@@ -0,0 +1,5 @@
1
+ module Ecoportal
2
+ module API
3
+ GEM2_VERSION = "0.8.8"
4
+ end
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.4
4
+ version: 0.8.8
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-02-21 00:00:00.000000000 Z
11
+ date: 2021-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 2.2.11
19
+ version: 2.2.17
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: '2.3'
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 2.2.11
29
+ version: 2.2.17
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: '2.3'
@@ -114,14 +114,14 @@ dependencies:
114
114
  name: pry
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - "~>"
117
+ - - ">="
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0.14'
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - "~>"
124
+ - - ">="
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0.14'
127
127
  - !ruby/object:Gem::Dependency
@@ -130,20 +130,20 @@ dependencies:
130
130
  requirements:
131
131
  - - ">="
132
132
  - !ruby/object:Gem::Version
133
- version: 0.7.5
133
+ version: 0.8.3
134
134
  - - "<"
135
135
  - !ruby/object:Gem::Version
136
- version: '0.8'
136
+ version: '0.9'
137
137
  type: :runtime
138
138
  prerelease: false
139
139
  version_requirements: !ruby/object:Gem::Requirement
140
140
  requirements:
141
141
  - - ">="
142
142
  - !ruby/object:Gem::Version
143
- version: 0.7.5
143
+ version: 0.8.3
144
144
  - - "<"
145
145
  - !ruby/object:Gem::Version
146
- version: '0.8'
146
+ version: '0.9'
147
147
  description:
148
148
  email:
149
149
  - rien@ecoportal.co.nz
@@ -167,7 +167,7 @@ files:
167
167
  - bin/setup
168
168
  - ecoportal-api-v2.gemspec
169
169
  - lib/ecoportal/api-v2.rb
170
- - lib/ecoportal/api/common.rb
170
+ - lib/ecoportal/api/common.v2.rb
171
171
  - lib/ecoportal/api/common/content.rb
172
172
  - lib/ecoportal/api/common/content/array_model.rb
173
173
  - lib/ecoportal/api/common/content/class_helpers.rb
@@ -184,6 +184,7 @@ files:
184
184
  - lib/ecoportal/api/v2/page/component/action.rb
185
185
  - lib/ecoportal/api/v2/page/component/action_field.rb
186
186
  - lib/ecoportal/api/v2/page/component/chart_field.rb
187
+ - lib/ecoportal/api/v2/page/component/chart_field/benchmark.rb
187
188
  - lib/ecoportal/api/v2/page/component/chart_field/frequency.rb
188
189
  - lib/ecoportal/api/v2/page/component/chart_field/heatmap.rb
189
190
  - lib/ecoportal/api/v2/page/component/chart_field/indicator.rb
@@ -213,6 +214,7 @@ files:
213
214
  - lib/ecoportal/api/v2/page/component/signature_field.rb
214
215
  - lib/ecoportal/api/v2/page/component/tag_field.rb
215
216
  - lib/ecoportal/api/v2/page/components.rb
217
+ - lib/ecoportal/api/v2/page/permit.rb
216
218
  - lib/ecoportal/api/v2/page/section.rb
217
219
  - lib/ecoportal/api/v2/page/sections.rb
218
220
  - lib/ecoportal/api/v2/page/stage.rb
@@ -227,7 +229,7 @@ files:
227
229
  - lib/ecoportal/api/v2/registers/stage_result.rb
228
230
  - lib/ecoportal/api/v2/registers/stages_result.rb
229
231
  - lib/ecoportal/api/v2/registers/template.rb
230
- - lib/ecoportal/api/v2/version.rb
232
+ - lib/ecoportal/api/v2_version.rb
231
233
  homepage: https://www.ecoportal.com
232
234
  licenses:
233
235
  - MIT
@@ -1,18 +0,0 @@
1
- module Ecoportal
2
- module API
3
- module Common
4
- end
5
- end
6
- end
7
-
8
- require 'ecoportal/api/common/base_class'
9
- require 'ecoportal/api/common/hash_diff'
10
- require 'ecoportal/api/common/base_model'
11
- require 'ecoportal/api/common/doc_helpers'
12
- require 'ecoportal/api/common/logging'
13
- require 'ecoportal/api/common/client'
14
- require 'ecoportal/api/common/response'
15
- require 'ecoportal/api/common/wrapped_response'
16
- require 'ecoportal/api/common/batch_response'
17
- require 'ecoportal/api/common/batch_operation'
18
- require 'ecoportal/api/common/content'
@@ -1,7 +0,0 @@
1
- module Ecoportal
2
- module API
3
- class V2
4
- GEM_VERSION = "0.8.4"
5
- end
6
- end
7
- end