ecoportal-api-v2 0.8.10 → 0.8.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +80 -1
- data/lib/ecoportal/api/common/content/array_model.rb +10 -17
- data/lib/ecoportal/api/common/content/collection_model.rb +23 -6
- data/lib/ecoportal/api/common/content/doc_helpers.rb +2 -2
- data/lib/ecoportal/api/common/content/double_model.rb +15 -5
- data/lib/ecoportal/api/common/content/hash_diff_patch.rb +1 -1
- data/lib/ecoportal/api/v2/page/component/action.rb +1 -1
- data/lib/ecoportal/api/v2/page/component/action_field.rb +3 -3
- data/lib/ecoportal/api/v2/page/component/checklist_field.rb +3 -3
- data/lib/ecoportal/api/v2/page/component/file.rb +1 -1
- data/lib/ecoportal/api/v2/page/component/files_field.rb +3 -3
- data/lib/ecoportal/api/v2/page/component/gauge_field.rb +3 -3
- data/lib/ecoportal/api/v2/page/component/selection_field.rb +3 -3
- data/lib/ecoportal/api/v2/page/component.rb +17 -0
- data/lib/ecoportal/api/v2/page/components.rb +24 -0
- data/lib/ecoportal/api/v2/page/force/binding.rb +54 -0
- data/lib/ecoportal/api/v2/page/force/bindings.rb +126 -0
- data/lib/ecoportal/api/v2/page/force.rb +34 -0
- data/lib/ecoportal/api/v2/page/forces.rb +103 -0
- data/lib/ecoportal/api/v2/page/permission_flags.rb +0 -2
- data/lib/ecoportal/api/v2/page/section.rb +77 -17
- data/lib/ecoportal/api/v2/page/sections.rb +36 -6
- data/lib/ecoportal/api/v2/page/stage.rb +39 -3
- data/lib/ecoportal/api/v2/page/stages.rb +9 -3
- data/lib/ecoportal/api/v2/page.rb +46 -1
- data/lib/ecoportal/api/v2/pages/page_stage.rb +51 -0
- data/lib/ecoportal/api/v2/pages.rb +3 -0
- data/lib/ecoportal/api/v2/registers/search_results.rb +13 -0
- data/lib/ecoportal/api/v2/registers.rb +15 -2
- data/lib/ecoportal/api/v2_version.rb +1 -1
- metadata +7 -2
@@ -9,6 +9,7 @@ module Ecoportal
|
|
9
9
|
|
10
10
|
class_resolver :register_class, "Ecoportal::API::V2::Registers::Register"
|
11
11
|
class_resolver :register_search_result_class, "Ecoportal::API::V2::Registers::PageResult"
|
12
|
+
class_resolver :register_search_results, "Ecoportal::API::V2::Registers::SearchResults"
|
12
13
|
|
13
14
|
attr_reader :client
|
14
15
|
|
@@ -35,7 +36,12 @@ module Ecoportal
|
|
35
36
|
# @param options [Hash] the search options
|
36
37
|
# @option options [Hash<Symbol, String>] :query plain search (like the search box in register).
|
37
38
|
# @option options [Hash<Symbol, Array<Object>>] :filters the set of filters.
|
39
|
+
# @option options [Boolean] if `true`, it only performs the first search and results `Ecoportal::API::V2::Registers::SearchResults`.
|
40
|
+
# @yield [result] something to do with search page-result.
|
41
|
+
# @yieldparam result [Ecoportal::V2::Registers::PageResult] a page result.
|
42
|
+
# @return [Ecoportal::API::V2::Registers, Ecoportal::API::V2::Registers::SearchResults]
|
38
43
|
def search(register_id, options = {})
|
44
|
+
only_first = options.delete(:only_first)
|
39
45
|
# supply a query string
|
40
46
|
# or a filter array (copy/paste from dev tools in the browser)
|
41
47
|
options = {query: nil, filters: []}.update(options)
|
@@ -49,6 +55,12 @@ module Ecoportal
|
|
49
55
|
end
|
50
56
|
end
|
51
57
|
|
58
|
+
if only_first
|
59
|
+
response = client.get("/registers/#{register_id}/search", params: options)
|
60
|
+
raise "Request failed - Status #{response.status}: #{response.body}" unless response.success?
|
61
|
+
return register_search_results.new(response.body["data"])
|
62
|
+
end
|
63
|
+
|
52
64
|
cursor_id = nil
|
53
65
|
results = 0
|
54
66
|
loop do
|
@@ -70,8 +82,8 @@ module Ecoportal
|
|
70
82
|
yield object
|
71
83
|
end
|
72
84
|
|
73
|
-
|
74
|
-
break
|
85
|
+
break if total <= results
|
86
|
+
break unless (cursor_id = data["cursor_id"])
|
75
87
|
end
|
76
88
|
self
|
77
89
|
end
|
@@ -87,3 +99,4 @@ require 'ecoportal/api/v2/registers/register'
|
|
87
99
|
require 'ecoportal/api/v2/registers/stage_result'
|
88
100
|
require 'ecoportal/api/v2/registers/stages_result'
|
89
101
|
require 'ecoportal/api/v2/registers/page_result'
|
102
|
+
require 'ecoportal/api/v2/registers/search_results'
|
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
|
+
version: 0.8.14
|
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-
|
11
|
+
date: 2021-09-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -218,6 +218,10 @@ files:
|
|
218
218
|
- lib/ecoportal/api/v2/page/component/signature_field.rb
|
219
219
|
- lib/ecoportal/api/v2/page/component/tag_field.rb
|
220
220
|
- lib/ecoportal/api/v2/page/components.rb
|
221
|
+
- lib/ecoportal/api/v2/page/force.rb
|
222
|
+
- lib/ecoportal/api/v2/page/force/binding.rb
|
223
|
+
- lib/ecoportal/api/v2/page/force/bindings.rb
|
224
|
+
- lib/ecoportal/api/v2/page/forces.rb
|
221
225
|
- lib/ecoportal/api/v2/page/permission_flags.rb
|
222
226
|
- lib/ecoportal/api/v2/page/permit.rb
|
223
227
|
- lib/ecoportal/api/v2/page/section.rb
|
@@ -231,6 +235,7 @@ files:
|
|
231
235
|
- lib/ecoportal/api/v2/registers.rb
|
232
236
|
- lib/ecoportal/api/v2/registers/page_result.rb
|
233
237
|
- lib/ecoportal/api/v2/registers/register.rb
|
238
|
+
- lib/ecoportal/api/v2/registers/search_results.rb
|
234
239
|
- lib/ecoportal/api/v2/registers/stage_result.rb
|
235
240
|
- lib/ecoportal/api/v2/registers/stages_result.rb
|
236
241
|
- lib/ecoportal/api/v2/registers/template.rb
|