ecoportal-api-v2 0.8.4
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 +7 -0
- data/.gitignore +20 -0
- data/.rspec +3 -0
- data/.rubocop.yml +55 -0
- data/.travis.yml +5 -0
- data/.yardopts +10 -0
- data/CHANGELOG.md +171 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +22 -0
- data/Rakefile +27 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ecoportal-api-v2.gemspec +34 -0
- data/lib/ecoportal/api-v2.rb +10 -0
- data/lib/ecoportal/api/common.rb +18 -0
- data/lib/ecoportal/api/common/content.rb +18 -0
- data/lib/ecoportal/api/common/content/array_model.rb +286 -0
- data/lib/ecoportal/api/common/content/class_helpers.rb +146 -0
- data/lib/ecoportal/api/common/content/client.rb +40 -0
- data/lib/ecoportal/api/common/content/collection_model.rb +279 -0
- data/lib/ecoportal/api/common/content/doc_helpers.rb +67 -0
- data/lib/ecoportal/api/common/content/double_model.rb +356 -0
- data/lib/ecoportal/api/common/content/hash_diff_patch.rb +183 -0
- data/lib/ecoportal/api/common/content/string_digest.rb +27 -0
- data/lib/ecoportal/api/common/content/wrapped_response.rb +42 -0
- data/lib/ecoportal/api/v2.rb +82 -0
- data/lib/ecoportal/api/v2/page.rb +42 -0
- data/lib/ecoportal/api/v2/page/component.rb +133 -0
- data/lib/ecoportal/api/v2/page/component/action.rb +28 -0
- data/lib/ecoportal/api/v2/page/component/action_field.rb +54 -0
- data/lib/ecoportal/api/v2/page/component/chart_field.rb +54 -0
- data/lib/ecoportal/api/v2/page/component/chart_field/frequency.rb +29 -0
- data/lib/ecoportal/api/v2/page/component/chart_field/heatmap.rb +27 -0
- data/lib/ecoportal/api/v2/page/component/chart_field/indicator.rb +26 -0
- data/lib/ecoportal/api/v2/page/component/chart_field/multiseries.rb +31 -0
- data/lib/ecoportal/api/v2/page/component/chart_field/sankey.rb +27 -0
- data/lib/ecoportal/api/v2/page/component/chart_field/serie.rb +26 -0
- data/lib/ecoportal/api/v2/page/component/chart_field/series_config.rb +23 -0
- data/lib/ecoportal/api/v2/page/component/chart_fr_field.rb +32 -0
- data/lib/ecoportal/api/v2/page/component/checklist_field.rb +49 -0
- data/lib/ecoportal/api/v2/page/component/checklist_item.rb +25 -0
- data/lib/ecoportal/api/v2/page/component/date_field.rb +34 -0
- data/lib/ecoportal/api/v2/page/component/file.rb +16 -0
- data/lib/ecoportal/api/v2/page/component/files_field.rb +13 -0
- data/lib/ecoportal/api/v2/page/component/gauge_field.rb +36 -0
- data/lib/ecoportal/api/v2/page/component/gauge_stop.rb +88 -0
- data/lib/ecoportal/api/v2/page/component/geo_field.rb +13 -0
- data/lib/ecoportal/api/v2/page/component/image.rb +16 -0
- data/lib/ecoportal/api/v2/page/component/images_field.rb +23 -0
- data/lib/ecoportal/api/v2/page/component/law_field.rb +12 -0
- data/lib/ecoportal/api/v2/page/component/number_field.rb +12 -0
- data/lib/ecoportal/api/v2/page/component/people_field.rb +25 -0
- data/lib/ecoportal/api/v2/page/component/plain_text_field.rb +15 -0
- data/lib/ecoportal/api/v2/page/component/reference_field.rb +16 -0
- data/lib/ecoportal/api/v2/page/component/rich_text_field.rb +13 -0
- data/lib/ecoportal/api/v2/page/component/selection_field.rb +78 -0
- data/lib/ecoportal/api/v2/page/component/selection_option.rb +25 -0
- data/lib/ecoportal/api/v2/page/component/signature_field.rb +25 -0
- data/lib/ecoportal/api/v2/page/component/tag_field.rb +14 -0
- data/lib/ecoportal/api/v2/page/components.rb +42 -0
- data/lib/ecoportal/api/v2/page/section.rb +59 -0
- data/lib/ecoportal/api/v2/page/sections.rb +47 -0
- data/lib/ecoportal/api/v2/page/stage.rb +29 -0
- data/lib/ecoportal/api/v2/page/stages.rb +26 -0
- data/lib/ecoportal/api/v2/pages.rb +92 -0
- data/lib/ecoportal/api/v2/pages/page_stage.rb +16 -0
- data/lib/ecoportal/api/v2/pages/stages.rb +55 -0
- data/lib/ecoportal/api/v2/people.rb +31 -0
- data/lib/ecoportal/api/v2/registers.rb +89 -0
- data/lib/ecoportal/api/v2/registers/page_result.rb +21 -0
- data/lib/ecoportal/api/v2/registers/register.rb +37 -0
- data/lib/ecoportal/api/v2/registers/stage_result.rb +14 -0
- data/lib/ecoportal/api/v2/registers/stages_result.rb +13 -0
- data/lib/ecoportal/api/v2/registers/template.rb +12 -0
- data/lib/ecoportal/api/v2/version.rb +7 -0
- metadata +254 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class V2
|
|
4
|
+
class Page
|
|
5
|
+
class Component
|
|
6
|
+
class SignatureField < Page::Component
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
def new_doc
|
|
10
|
+
{
|
|
11
|
+
"color" => "#000000"
|
|
12
|
+
}
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
passthrough :signed_by_id, :signed_by_name, :signature_url
|
|
17
|
+
passdate :signature_updated_at
|
|
18
|
+
passthrough :signature_content, :color
|
|
19
|
+
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class V2
|
|
4
|
+
class Page
|
|
5
|
+
class Components < Common::Content::CollectionModel
|
|
6
|
+
class_resolver :component_class, "Ecoportal::API::V2::Page::Component"
|
|
7
|
+
|
|
8
|
+
self.klass do |doc|
|
|
9
|
+
component_class.get_class(doc).tap do |klass|
|
|
10
|
+
klass.key = :id
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
order_matters = true
|
|
15
|
+
|
|
16
|
+
def get_by_type(type)
|
|
17
|
+
self.select do |comp|
|
|
18
|
+
comp.type.downcase == type.to_s.strip.downcase
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def get_by_name(name, type: nil)
|
|
23
|
+
pool = type ? get_by_type(type) : self
|
|
24
|
+
|
|
25
|
+
pool.select do |comp|
|
|
26
|
+
comp.label.to_s.strip.downcase == name.to_s.strip.downcase
|
|
27
|
+
end.first
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def add(label:, type:)
|
|
31
|
+
fld_doc = component_class.new_doc(type: type)
|
|
32
|
+
upsert!(fld_doc) do |fld|
|
|
33
|
+
fld.label = label
|
|
34
|
+
yield(fld) if block_given?
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class V2
|
|
4
|
+
class Page
|
|
5
|
+
class Section < Common::Content::DoubleModel
|
|
6
|
+
class << self
|
|
7
|
+
def new_doc(split: false)
|
|
8
|
+
{
|
|
9
|
+
"id" => new_uuid,
|
|
10
|
+
"type" => split ? "split" : "content",
|
|
11
|
+
"weight" => 9999
|
|
12
|
+
}.tap do |out|
|
|
13
|
+
component_ids = if split
|
|
14
|
+
{
|
|
15
|
+
"left_component_ids" => [],
|
|
16
|
+
"right_component_ids" => []
|
|
17
|
+
}
|
|
18
|
+
else
|
|
19
|
+
{
|
|
20
|
+
"component_ids" => []
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
out.merge!(component_ids)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
passkey :id
|
|
29
|
+
passthrough :patch_ver, :weight, :type
|
|
30
|
+
passthrough :heading, :left_heading, :right_heading
|
|
31
|
+
passarray :component_ids, :left_component_ids, :right_component_ids
|
|
32
|
+
passthrough :minimized
|
|
33
|
+
|
|
34
|
+
def split?
|
|
35
|
+
doc && doc["type"] == "split"
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def all_component_ids
|
|
39
|
+
return component_ids.to_a unless split?
|
|
40
|
+
left_component_ids.to_a | right_component_ids.to_a
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def component?(id)
|
|
44
|
+
all_component_ids.include?(id)
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
def components
|
|
48
|
+
fld_ids = all_component_ids
|
|
49
|
+
root.components.values_at(*fld_ids).select.with_index do |fld, i|
|
|
50
|
+
puts "Warning: field #{id} points to missing field #{fld_ids[i]}" if !fld
|
|
51
|
+
fld && (!block_given? || yield(fld))
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class V2
|
|
4
|
+
class Page
|
|
5
|
+
class Sections < Common::Content::CollectionModel
|
|
6
|
+
class_resolver :section_class, "Ecoportal::API::V2::Page::Section"
|
|
7
|
+
|
|
8
|
+
self.klass = :section_class
|
|
9
|
+
|
|
10
|
+
def add(name: nil, split: false, pos: NOT_USED, before: NOT_USED, after: NOT_USED)
|
|
11
|
+
sec_doc = section_class.new_doc(split: split)
|
|
12
|
+
upsert!(sec_doc, pos: pos, before: before, after: after) do |section|
|
|
13
|
+
section.heading = name
|
|
14
|
+
if prev = previous_section(section)
|
|
15
|
+
section.weight = prev.weight
|
|
16
|
+
end
|
|
17
|
+
yield(section) if block_given?
|
|
18
|
+
#fix_weights! # a server bug prevents to set the weight of existing sections
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
def ordered
|
|
23
|
+
each_with_index.sort_by do |section, index|
|
|
24
|
+
(section.weight >= 9999) ? [index, index] : [section.weight, index]
|
|
25
|
+
end.map(&:first)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
private
|
|
29
|
+
|
|
30
|
+
def fix_weights!
|
|
31
|
+
ordered.each_with_index do |section, index|
|
|
32
|
+
section.weight = index
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def previous_section(value)
|
|
37
|
+
secs = ordered
|
|
38
|
+
pos = secs.index(value) - 1
|
|
39
|
+
return if pos < 0
|
|
40
|
+
secs[pos]
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
end
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class V2
|
|
4
|
+
class Page
|
|
5
|
+
class Stage < Common::Content::DoubleModel
|
|
6
|
+
passkey :id
|
|
7
|
+
passthrough :patch_ver
|
|
8
|
+
passthrough :name
|
|
9
|
+
passarray :subtags, order_matters: false
|
|
10
|
+
passarray :section_ids
|
|
11
|
+
passthrough :can
|
|
12
|
+
|
|
13
|
+
def sections
|
|
14
|
+
sec_ids = section_ids.to_a
|
|
15
|
+
root.sections.values_at(*sec_ids).select.with_index do |sec, i|
|
|
16
|
+
puts "Warning: section #{id} points to missing section #{sec_ids[i]}" if !sec
|
|
17
|
+
fld && (!block_given? || yield(sec))
|
|
18
|
+
end.sort_by {|sec| sec.weight}
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def attach_section(section)
|
|
22
|
+
section_ids.insert_one(section.id)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class V2
|
|
4
|
+
class Page
|
|
5
|
+
class Stages < Common::Content::CollectionModel
|
|
6
|
+
class_resolver :stage_class, "Ecoportal::API::V2::Page::Stage"
|
|
7
|
+
|
|
8
|
+
self.klass = :stage_class
|
|
9
|
+
|
|
10
|
+
def get_by_name(name)
|
|
11
|
+
find do |stage|
|
|
12
|
+
stage.name.strip.downcase == name.to_s.strip.downcase
|
|
13
|
+
end
|
|
14
|
+
end
|
|
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
|
|
21
|
+
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class V2
|
|
4
|
+
# @attr_reader client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
|
|
5
|
+
class Pages
|
|
6
|
+
STAGE_REX = /stages\/(?<sid>.*)/
|
|
7
|
+
extend Common::BaseClass
|
|
8
|
+
include Common::Content::DocHelpers
|
|
9
|
+
|
|
10
|
+
class_resolver :stages_class, "Ecoportal::API::V2::Pages::Stages"
|
|
11
|
+
class_resolver :page_class, "Ecoportal::API::V2::Page"
|
|
12
|
+
|
|
13
|
+
attr_reader :client
|
|
14
|
+
|
|
15
|
+
# @param client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
|
|
16
|
+
# @return [Schemas] an instance object ready to make schema api requests.
|
|
17
|
+
def initialize(client)
|
|
18
|
+
@client = client
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
# Obtain specific object for pages api requests.
|
|
22
|
+
# @return [V2::Pages::Stages] an instance object ready to make pages api requests.
|
|
23
|
+
def stages
|
|
24
|
+
stages_class.new(client)
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
# Gets a page via api.
|
|
28
|
+
# @note
|
|
29
|
+
# - if the request has `success?` the returned `object.result` gives an object with that `Page`.
|
|
30
|
+
# - if it failed to obtain the full page, it returns a `PageStage` with the active stage data.
|
|
31
|
+
# @param id [String, Hash, Stage] the `id` of the target **page**.
|
|
32
|
+
# @param stage_id [String] the `id` of the target **stage**.
|
|
33
|
+
# @return [Ecoportal::API::V2::Page, Ecoportal::API::V2::Pages::PageStage] the target page.
|
|
34
|
+
def get(id, stage_id: nil)
|
|
35
|
+
return stages.get(id: id, stage_id: stage_id) if stage_id
|
|
36
|
+
id = get_id(id)
|
|
37
|
+
response = client.get("/pages/#{CGI.escape(id)}")
|
|
38
|
+
wrapped = Common::Content::WrappedResponse.new(response, page_class)
|
|
39
|
+
|
|
40
|
+
return wrapped.result if wrapped.success?
|
|
41
|
+
if (response.status == 302) && (url = response.body["data"])
|
|
42
|
+
if stage_id = url_to_stage_id(url)
|
|
43
|
+
return stages.get(id: id, stage_id: stage_id)
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
raise "Could not get page #{id} - Error #{response.status}: #{response.body}"
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Requests to update an existing page via api.
|
|
50
|
+
# @param doc [Hash, Page] data that at least contains an `id` (internal or external) of the target page.
|
|
51
|
+
# @return [Response] an object with the api response.
|
|
52
|
+
def update(doc)
|
|
53
|
+
body = get_body(doc) # , level: "page"
|
|
54
|
+
id = get_id(doc)
|
|
55
|
+
client.patch("/pages/#{CGI.escape(id)}", data: body)
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
# Gets a `new` non-existing page via api with all the ids initialized.
|
|
59
|
+
# @param from [String, Hash, Page] template or `id` of the template
|
|
60
|
+
# @return [Ecoportal::API::V2::Page] the new page object.
|
|
61
|
+
def get_new(from)
|
|
62
|
+
id = get_id(from)
|
|
63
|
+
response = client.get("/pages/new", params: {template_id: id})
|
|
64
|
+
wrapped = Common::Content::WrappedResponse.new(response, page_class)
|
|
65
|
+
|
|
66
|
+
return wrapped.result if wrapped.success?
|
|
67
|
+
raise "Could not get new page from template #{id} - Error #{response.status}: #{response.body}"
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
# Requests a creation of a page via api.
|
|
71
|
+
# @param doc [Hash, Page] data that at least contains an `id` (internal or external) of the target page.
|
|
72
|
+
# @param from [String, Hash, Page] template or `id` of the template
|
|
73
|
+
# @return [Response] an object with the api response.
|
|
74
|
+
def create(doc, from:)
|
|
75
|
+
body = get_body(doc)
|
|
76
|
+
id = get_id(from)
|
|
77
|
+
client.post("/pages", data: body, params: {template_id: id})
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
private
|
|
81
|
+
|
|
82
|
+
def url_to_stage_id(url)
|
|
83
|
+
(matches = url.match(STAGE_REX)) && matches[:sid]
|
|
84
|
+
end
|
|
85
|
+
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
require 'ecoportal/api/v2/page'
|
|
92
|
+
require 'ecoportal/api/v2/pages/stages'
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class V2
|
|
4
|
+
class Pages
|
|
5
|
+
class PageStage < V2::Page
|
|
6
|
+
passthrough :mould_counter, :archive
|
|
7
|
+
passthrough :task_priority, :state
|
|
8
|
+
passthrough :votes_enabled, :upvotes, :downvotes
|
|
9
|
+
|
|
10
|
+
passarray :force_errors, :subtags, :permits, order_matters: false
|
|
11
|
+
passthrough :evolution
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class V2
|
|
4
|
+
class Pages
|
|
5
|
+
# This API Integration level has been added due to relative permissions
|
|
6
|
+
# - a **user** with api access may have access to a specific `stage` but not to the full `page`
|
|
7
|
+
#
|
|
8
|
+
# @attr_reader client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
|
|
9
|
+
class Stages
|
|
10
|
+
extend Common::BaseClass
|
|
11
|
+
include Common::Content::DocHelpers
|
|
12
|
+
|
|
13
|
+
class_resolver :page_stage_class, "Ecoportal::API::V2::Pages::PageStage"
|
|
14
|
+
|
|
15
|
+
attr_reader :client
|
|
16
|
+
|
|
17
|
+
# @param client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
|
|
18
|
+
# @return [Schemas] an instance object ready to make schema api requests.
|
|
19
|
+
def initialize(client)
|
|
20
|
+
@client = client
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Gets a stage via api.
|
|
24
|
+
# @note if the request has `success?` the returned `object.result` gives an object with that `Stage`.
|
|
25
|
+
# @param id [String, Hash, Stage] the `id` of the target **page**.
|
|
26
|
+
# @param stage_id [String] the `id` of the target **stage**.
|
|
27
|
+
# @return [Ecoportal::API::V2::Stage, Ecoportal::API::V2::Pages::PageStage] the target stage.
|
|
28
|
+
def get(id:, stage_id:)
|
|
29
|
+
id = get_id(id)
|
|
30
|
+
response = client.get("/pages/#{CGI.escape(id)}/stages/#{CGI.escape(stage_id)}/")
|
|
31
|
+
wrapped = Common::Content::WrappedResponse.new(response, page_stage_class)
|
|
32
|
+
|
|
33
|
+
return wrapped.result if wrapped.success?
|
|
34
|
+
raise "Could not get stage {#{id}} of page #{stage_id} - Error #{response.status}: #{response.body}"
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
# Requests to update an existing stage via api.
|
|
38
|
+
# @param doc [Hash, Stage] data that at least contains an `id` (internal or external) of the target stage.
|
|
39
|
+
# @param id [String, nil] the `id` of the target **page**.
|
|
40
|
+
# @param stage_id [String] the `id` of the target **stage**.
|
|
41
|
+
# @return [Response] an object with the api response.
|
|
42
|
+
def update(doc, id: nil, stage_id:)
|
|
43
|
+
body = get_body(doc)
|
|
44
|
+
id = id || get_id(doc)
|
|
45
|
+
path = "/pages/#{CGI.escape(id)}/stages/#{CGI.escape(stage_id)}/"
|
|
46
|
+
client.patch(path, data: body)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
require 'ecoportal/api/v2/pages/page_stage'
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
module Ecoportal
|
|
2
|
+
module API
|
|
3
|
+
class V2
|
|
4
|
+
# @attr_reader client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
|
|
5
|
+
class People < API::Internal::People
|
|
6
|
+
|
|
7
|
+
def batch
|
|
8
|
+
unavailable_method!(__method__)
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def job
|
|
12
|
+
unavailable_method!(__method__)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
# Re-using hook to obtain the raw data response
|
|
18
|
+
def body_data(body)
|
|
19
|
+
return body unless body.is_a?(Hash)
|
|
20
|
+
return body unless body.key?("data")
|
|
21
|
+
body["data"]
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def unavailable_method!(str)
|
|
25
|
+
raise "Unavailable method '#{str}' for api '#{VERSION}'"
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|