ecoportal-api 0.5.8 → 0.6.0

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: 168542de09c5a87edcd4952acdf84cdf01944c03339238a27c310e29b71e9c14
4
- data.tar.gz: 2f43b32d289f6232eccff32516717ab82cd86cbe0144d6f8f2eac74f30637cd8
3
+ metadata.gz: f58ff9e368c2607a55aed0c5e62d45e7c51f37baac25d5da83c4ce6dd4224733
4
+ data.tar.gz: c8bcd11749dfcd0a57650ba25a3d826e209b871c472c2cabbb9e61c01bbaa563
5
5
  SHA512:
6
- metadata.gz: 1c539315189039d7baed7c48db646969525a47d51cdd88b63a2ac53b651f089aa6e219fa91624943700c1c73144525d9482f4cff8b9e1ca5cbbc9862c0a138e4
7
- data.tar.gz: 3c145a2fcea2c476fb39ad914b6b3ec2ff390ffe5378ab9795ddd466238f0af55fbbae59a5e87cadb415a49165cf0e05d6697e45dc74bd6235581c30268d1e45
6
+ metadata.gz: 0e730eff886dd4f908e1bdd52b468b513c4e0309b7be47e3461bd7ef7f81c91d6d9dd4e61c8bdc681132bb310dd423bc62c3379510701d9c71e3f4847688fd3e
7
+ data.tar.gz: dba899cde0099074a44549cd05fedcd3a72e57ca81403a9399411f67c6575db40fe170f63fda7ded3e6d4fa626db2dd0dd33df1eaf3b7058d3cb9aec83e53792
@@ -1,13 +1,32 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.6.0] - 2020-07-xx
5
+
6
+ ### Added
7
+ - `Ecoportal::API::Common::BaseModel#initial_doc`: `#consolidate!` modifies `original_doc`
8
+ - this helper allows to know what was the initial document the object was created with
9
+ - `Ecoportal::API::Common::BaseModel#as_update`: added parameter (default: `:last` => compare with `original_doc`)
10
+ - calling it with `:total` will compare the current `doc` with the `initial_doc`
11
+ ### Changed
12
+ - `Ecoportal::API::Internal::Permissions`: **update for new abilities of ecoPortal release `1.5.0`**
13
+ - added abilities: `person_core`, `person_account`, `person_details`
14
+ - removed ability: `people`
15
+ - renamed `print` to `pretty_print` to avoid overriding `$stdout.print`, on:
16
+ - `Ecoportal::API::Common::BaseModel`
17
+ - `Ecoportal::API::Common::BatchReponse`
18
+ - `Ecoportal::API::Common::Response`
19
+ - `Ecoportal::API::Common::WrappedResponse`
20
+ ### Fixed
21
+ - `Ecoportal::API::Internal::Preferences`: **kiosk** settings should default to `false` (`nil`)
22
+
4
23
  ## [0.5.8] - 2020-06-23
5
24
 
6
25
  ### Added
7
26
  ### Changed
8
27
  ### Fixed
9
- - `Ecoportal::API::V1::Person#filter_tags=`: `original_doc["filter_tags"]` is `nil` when creating a person
10
- - `Ecoportal::API::Internal::Account#policy_group_ids=`: `original_doc["account"]` is `nil` when creating a person
28
+ - `Ecoportal::API::V1::Person#filter_tags=`: `original_doc["filter_tags"]` is `nil` when creating a person
29
+ - `Ecoportal::API::Internal::Account#policy_group_ids=`: `original_doc["account"]` is `nil` when creating a person
11
30
 
12
31
 
13
32
  ## [0.5.7] - 2020-06-22
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "rspec", "~> 3", ">= 3.9"
26
26
  spec.add_development_dependency "yard", "~> 0.9", ">= 0.9.18"
27
27
  spec.add_development_dependency "redcarpet", "~> 3.5", ">= 3.5.0"
28
- spec.add_development_dependency "pry"
28
+ spec.add_development_dependency "pry" , "~> 0.13"
29
29
 
30
30
  spec.add_dependency 'http', '~> 3'
31
31
  spec.add_dependency 'hash-polyfill', '~> 0'
@@ -48,6 +48,7 @@ module Ecoportal
48
48
  if !_parent || !_key
49
49
  @doc = doc
50
50
  @original_doc = JSON.parse(@doc.to_json)
51
+ @initial_doc = JSON.parse(@doc.to_json)
51
52
  end
52
53
  end
53
54
 
@@ -63,6 +64,12 @@ module Ecoportal
63
64
  _parent.original_doc.dig(*[_key].flatten)
64
65
  end
65
66
 
67
+ def initial_doc
68
+ raise UnlinkedModel.new unless linked?
69
+ return @initial_doc if is_root?
70
+ _parent.initial_doc.dig(*[_key].flatten)
71
+ end
72
+
66
73
  def as_json
67
74
  doc
68
75
  end
@@ -71,9 +78,10 @@ module Ecoportal
71
78
  doc.to_json(*args)
72
79
  end
73
80
 
74
- def as_update
81
+ def as_update(ref = :last)
75
82
  new_doc = as_json
76
- Common::HashDiff.diff(new_doc, original_doc)
83
+ ref_doc = ref == :total ? initial_doc : original_doc
84
+ Common::HashDiff.diff(new_doc, ref_doc)
77
85
  end
78
86
 
79
87
  def dirty?
@@ -100,7 +108,7 @@ module Ecoportal
100
108
  end
101
109
  end
102
110
 
103
- def print
111
+ def pretty_print
104
112
  puts JSON.pretty_generate(as_json)
105
113
  self
106
114
  end
@@ -20,10 +20,10 @@ module Ecoportal
20
20
  yield doc
21
21
  end
22
22
  end
23
-
24
- def print
23
+
24
+ def pretty_print
25
25
  if success?
26
- each(&:print)
26
+ each(&:pretty_print)
27
27
  else
28
28
  puts "Request failed."
29
29
  end
@@ -19,8 +19,8 @@ module Ecoportal
19
19
  def success?
20
20
  @status.success?
21
21
  end
22
-
23
- def print
22
+
23
+ def pretty_print
24
24
  puts "Status: #{@status.code}"
25
25
  puts "Body:"
26
26
  puts JSON.pretty_generate(@body)
@@ -40,14 +40,14 @@ module Ecoportal
40
40
  response.success?
41
41
  end
42
42
 
43
- def print
43
+ def pretty_print
44
44
  if success?
45
- each(&:print)
45
+ each(&:pretty_print)
46
46
  else
47
47
  puts "Request failed."
48
48
  end
49
49
  end
50
-
50
+
51
51
  end
52
52
  end
53
53
  end
@@ -2,7 +2,9 @@ module Ecoportal
2
2
  module API
3
3
  class Internal
4
4
  class Permissions < Common::BaseModel
5
- passthrough :files, :data, :reports, :organization, :people, :pages, :page_editor, :registers
5
+ passthrough :files, :data, :reports
6
+ passthrough :organization, :person_core, :person_account, :person_details
7
+ passthrough :pages, :page_editor, :registers
6
8
  end
7
9
  end
8
10
  end
@@ -2,21 +2,17 @@ module Ecoportal
2
2
  module API
3
3
  class Internal
4
4
  class Preferences < Common::BaseModel
5
+ passthrough :kiosk_enabled, :kiosk_workflow_message, :kiosk_create_button_label,
6
+ :kiosk_create_button_help, :kiosk_return_button_label, :kiosk_return_button_help,
7
+ :kiosk_dashboard_button_label, :kiosk_dashboard_button_help
8
+
5
9
  [
6
10
  :show_sidebar,
7
11
  :show_shortcuts,
8
12
  :show_coming_soon,
9
13
  :show_recently_visited_forms,
10
14
  :show_tasks,
11
- :show_task_bubbles,
12
- :kiosk_enabled,
13
- :kiosk_workflow_message,
14
- :kiosk_create_button_label,
15
- :kiosk_create_button_help,
16
- :kiosk_return_button_label,
17
- :kiosk_return_button_help,
18
- :kiosk_dashboard_button_label,
19
- :kiosk_dashboard_button_help
15
+ :show_task_bubbles
20
16
  ].map(&:to_s).each do |field|
21
17
  define_method(field) do
22
18
  if doc.key?(field)
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- VERSION = "0.5.8"
3
+ VERSION = "0.6.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecoportal-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.8
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tapio Saarinen
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-06-23 00:00:00.000000000 Z
11
+ date: 2020-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -108,16 +108,16 @@ dependencies:
108
108
  name: pry
109
109
  requirement: !ruby/object:Gem::Requirement
110
110
  requirements:
111
- - - ">="
111
+ - - "~>"
112
112
  - !ruby/object:Gem::Version
113
- version: '0'
113
+ version: '0.13'
114
114
  type: :development
115
115
  prerelease: false
116
116
  version_requirements: !ruby/object:Gem::Requirement
117
117
  requirements:
118
- - - ">="
118
+ - - "~>"
119
119
  - !ruby/object:Gem::Version
120
- version: '0'
120
+ version: '0.13'
121
121
  - !ruby/object:Gem::Dependency
122
122
  name: http
123
123
  requirement: !ruby/object:Gem::Requirement
@@ -163,7 +163,6 @@ files:
163
163
  - ".yardopts"
164
164
  - CHANGELOG.md
165
165
  - Gemfile
166
- - Gemfile.lock
167
166
  - LICENSE
168
167
  - README.md
169
168
  - Rakefile