ecoportal-api-v2 2.0.5 → 2.0.8

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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +21 -1
  3. data/ecoportal-api-v2.gemspec +1 -1
  4. data/lib/ecoportal/api/common/content/class_helpers.rb +1 -1
  5. data/lib/ecoportal/api/common/content/client.rb +1 -1
  6. data/lib/ecoportal/api/common/content/doc_helpers.rb +2 -2
  7. data/lib/ecoportal/api/common/content/double_model.rb +8 -8
  8. data/lib/ecoportal/api/common/content/hash_diff_patch.rb +2 -1
  9. data/lib/ecoportal/api/common/content/wrapped_response.rb +1 -1
  10. data/lib/ecoportal/api/common.v2.rb +4 -0
  11. data/lib/ecoportal/api/v2/page/component/action.rb +1 -1
  12. data/lib/ecoportal/api/v2/page/component/chart_field/config.rb +1 -1
  13. data/lib/ecoportal/api/v2/page/component/checklist_item.rb +1 -1
  14. data/lib/ecoportal/api/v2/page/component/file.rb +1 -1
  15. data/lib/ecoportal/api/v2/page/component/gauge_stop.rb +1 -1
  16. data/lib/ecoportal/api/v2/page/component/geo_coordinates.rb +2 -2
  17. data/lib/ecoportal/api/v2/page/component/image.rb +2 -2
  18. data/lib/ecoportal/api/v2/page/component/law.rb +1 -1
  19. data/lib/ecoportal/api/v2/page/component/people_viewable_field.rb +1 -1
  20. data/lib/ecoportal/api/v2/page/component/selection_option.rb +1 -1
  21. data/lib/ecoportal/api/v2/page/component/selection_options.rb +1 -1
  22. data/lib/ecoportal/api/v2/page/component.rb +1 -1
  23. data/lib/ecoportal/api/v2/page/components.rb +1 -1
  24. data/lib/ecoportal/api/v2/page/force/binding.rb +1 -1
  25. data/lib/ecoportal/api/v2/page/force/bindings.rb +3 -3
  26. data/lib/ecoportal/api/v2/page/force/helper.rb +1 -1
  27. data/lib/ecoportal/api/v2/page/force.rb +1 -1
  28. data/lib/ecoportal/api/v2/page/forces.rb +4 -4
  29. data/lib/ecoportal/api/v2/page/mould_counter.rb +1 -1
  30. data/lib/ecoportal/api/v2/page/permission_flags.rb +1 -1
  31. data/lib/ecoportal/api/v2/page/permit.rb +1 -1
  32. data/lib/ecoportal/api/v2/page/section.rb +1 -1
  33. data/lib/ecoportal/api/v2/page/sections.rb +2 -2
  34. data/lib/ecoportal/api/v2/page/stage.rb +1 -1
  35. data/lib/ecoportal/api/v2/page/stages.rb +1 -1
  36. data/lib/ecoportal/api/v2/page.rb +1 -1
  37. data/lib/ecoportal/api/v2/pages/page_create_response.rb +1 -1
  38. data/lib/ecoportal/api/v2/pages/page_stage/task.rb +1 -1
  39. data/lib/ecoportal/api/v2/pages/page_stage/tasks.rb +1 -1
  40. data/lib/ecoportal/api/v2/pages/stages.rb +2 -2
  41. data/lib/ecoportal/api/v2/pages.rb +19 -9
  42. data/lib/ecoportal/api/v2/people.rb +1 -1
  43. data/lib/ecoportal/api/v2/registers/page_result/membrane_droplet.rb +1 -1
  44. data/lib/ecoportal/api/v2/registers/page_result.rb +2 -2
  45. data/lib/ecoportal/api/v2/registers/register.rb +1 -1
  46. data/lib/ecoportal/api/v2/registers/search_results.rb +1 -1
  47. data/lib/ecoportal/api/v2/registers/stage_result.rb +1 -1
  48. data/lib/ecoportal/api/v2/registers/template.rb +1 -1
  49. data/lib/ecoportal/api/v2/registers.rb +5 -5
  50. data/lib/ecoportal/api/v2/s3/files/poll.rb +1 -1
  51. data/lib/ecoportal/api/v2/s3/files/poll_status.rb +2 -2
  52. data/lib/ecoportal/api/v2/s3/files.rb +4 -3
  53. data/lib/ecoportal/api/v2/s3.rb +4 -3
  54. data/lib/ecoportal/api/v2.rb +7 -2
  55. data/lib/ecoportal/api/v2_version.rb +1 -1
  56. data/lib/ecoportal/api-v2.rb +3 -2
  57. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 97b022ff724f1d1d3f80b357d482e54ebba3750751de3771097840c1a9a1e697
4
- data.tar.gz: f587813ad0917441c55c1a5dde359ca5e12070ee22d899f5a41646fa63af40dc
3
+ metadata.gz: 56339cf5002076d4308e6948c31a5f580eea1e6ebe526df75b8b419d4c405ed1
4
+ data.tar.gz: 9d55dc7bea7782bb0edd9aedbae6c42d36844c09f5acc0136c43ea090cb63a9c
5
5
  SHA512:
6
- metadata.gz: 8d4e4f6c25ab85c7c8c0a119fdab33b107b519022c66ce57c2159e1de89cb73e200243e59105adc7c50d0dd3a718367ecbc9d47e8fda5766d6ab33c3a09ed3cd
7
- data.tar.gz: d8230c7c42ff3f358d9b33a8a81d194f8aba30149089c5201f5bf21a905028195503e8a0530a6a99e4c1ce4f828f4ea5e4b691b4528a569e20fb362c6884f84e
6
+ metadata.gz: 623cae68b91271a72b7375aca1987d87b05a3393721a6322b8aead8f28973bc39f5bd99cc2a7d1eb4f3bcdfb78031b99158f99efad1f4f1b12a9ddaf65448e9e
7
+ data.tar.gz: 292fba88900b90ea513271253b3d066297f0bd3e8f07e4ca23f2092067b9457f9608bec8574620356cef8cf9ed16d7657c137f985eb0f5206038c02f39a7b7c8
data/CHANGELOG.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
- ## [2.0.6] - 2024-08-xx
5
+ ## [2.0.9] - 2024-08-xx
6
6
 
7
7
  ### Added
8
8
 
@@ -10,6 +10,26 @@ All notable changes to this project will be documented in this file.
10
10
 
11
11
  ### Fixed
12
12
 
13
+ - Force to load via `ecoportal/api-v2`
14
+
15
+ ## [2.0.8] - 2024-08-08
16
+
17
+ ### Fixed
18
+
19
+ - Force to load via `ecoportal/api-v2`
20
+
21
+ ## [2.0.7] - 2024-08-08
22
+
23
+ ### Fixed
24
+
25
+ - Get `Common` namespaced all over the code
26
+
27
+ ## [2.0.6] - 2024-08-08
28
+
29
+ ### Fixed
30
+
31
+ - use full path and `require` only
32
+
13
33
  ## [2.0.5] - 2024-08-07
14
34
 
15
35
  ### Fixed
@@ -23,7 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  spec.require_paths = ["lib"]
25
25
 
26
- spec.add_development_dependency "pry" , '>= 0.14'
26
+ spec.add_development_dependency "pry" , '~> 0.14'
27
27
  spec.add_development_dependency "rake", '>= 13.0.3', "< 14"
28
28
  spec.add_development_dependency "redcarpet", '>= 3.6.0', "< 4"
29
29
  spec.add_development_dependency "rspec", '>= 3.12.0', "< 4"
@@ -4,7 +4,7 @@ module Ecoportal
4
4
  module Common
5
5
  module Content
6
6
  module ClassHelpers
7
- include Common::BaseClass
7
+ include Ecoportal::API::Common::BaseClass
8
8
  NOT_USED = "no_used!".freeze
9
9
 
10
10
  # Class resolver
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  module Common
4
4
  module Content
5
5
  # @see Ecoportal::API::Common::Client
6
- class Client < Common::Client
6
+ class Client < Ecoportal::API::Common::Client
7
7
  attr_accessor :logger
8
8
 
9
9
  # @note the `api_key` will be automatically added as parameter `X-ECOPORTAL-API-KEY` in the header of the http requests.
@@ -13,9 +13,9 @@ module Ecoportal
13
13
  when doc.respond_to?(:as_update)
14
14
  doc.as_update
15
15
  when doc.respond_to?(:as_json)
16
- Common::Content::HashDiffPatch.patch_diff(doc.as_json, nil)
16
+ HashDiffPatch.patch_diff(doc.as_json, nil)
17
17
  when doc.is_a?(Hash)
18
- Common::Content::HashDiffPatch.patch_diff(doc, nil)
18
+ HashDiffPatch.patch_diff(doc, nil)
19
19
  else
20
20
  raise "Could not get body for doc: #{doc}"
21
21
  end
@@ -5,7 +5,7 @@ module Ecoportal
5
5
  # Basic model class, to **build _get_ / _set_ `methods`** for a given property
6
6
  # which differs of `attr_*` ruby native class methods because `pass*`
7
7
  # completelly **links** the methods **to a subjacent `Hash` model**
8
- class DoubleModel < Common::BaseModel
8
+ class DoubleModel < Ecoportal::API::Common::BaseModel
9
9
  class UnlinkedModel < StandardError
10
10
  def initialize(msg = "Something went wrong when linking the document.", from: nil, key: nil)
11
11
  msg += " From: #{from}." if from
@@ -17,9 +17,9 @@ module Ecoportal
17
17
  class NoKeyMethod < StandardError
18
18
  end
19
19
 
20
- NOT_USED = Common::Content::ClassHelpers::NOT_USED
21
- extend Common::Content::ClassHelpers
22
- include Common::Content::ModelHelpers
20
+ NOT_USED = ClassHelpers::NOT_USED
21
+ extend ClassHelpers
22
+ include ModelHelpers
23
23
 
24
24
  class << self
25
25
  attr_reader :key
@@ -176,7 +176,7 @@ module Ecoportal
176
176
  method = method.to_s.freeze
177
177
  var = instance_variable_name(method)
178
178
 
179
- dim_class = new_class(method, inherits: Common::Content::ArrayModel) do |klass|
179
+ dim_class = new_class(method, inherits: ArrayModel) do |klass|
180
180
  klass.order_matters = order_matters
181
181
  klass.uniq = uniq
182
182
  end
@@ -213,7 +213,7 @@ module Ecoportal
213
213
  if enum_class
214
214
  eclass = enum_class
215
215
  elsif klass
216
- eclass = new_class("#{method}::#{klass}", inherits: Common::Content::CollectionModel) do |dim_class|
216
+ eclass = new_class("#{method}::#{klass}", inherits: CollectionModel) do |dim_class|
217
217
  # NOTE: new_class may resolve the namespace of the class to an already existing class
218
218
  dim_class.klass ||= klass
219
219
  dim_class.order_matters = order_matters
@@ -378,7 +378,7 @@ module Ecoportal
378
378
  # `original_doc` and `doc`
379
379
  def as_update
380
380
  new_doc = as_json
381
- Common::Content::HashDiffPatch.patch_diff(new_doc, original_doc)
381
+ HashDiffPatch.patch_diff(new_doc, original_doc)
382
382
  end
383
383
 
384
384
  # @return [Boolean] stating if there are changes
@@ -509,7 +509,7 @@ module Ecoportal
509
509
  # It allows to work-around missing item_key
510
510
  def setup_items_key(embedded_class, obj_doc)
511
511
  # only if is going to be a collection
512
- return unless obj_doc.is_a?(Array) && embedded_class < Common::Content::CollectionModel
512
+ return unless obj_doc.is_a?(Array) && embedded_class < CollectionModel
513
513
  return unless (item_class = embedded_class.klass)
514
514
  # if already has key don't need to work around
515
515
  return if item_class&.key
@@ -3,10 +3,11 @@ module Ecoportal
3
3
  module Common
4
4
  module Content
5
5
  module HashDiffPatch
6
+ extend DocHelpers
7
+
6
8
  ID_KEYS = %w[id]
7
9
  META_KEYS = %w[id patch_ver]
8
10
  NO_CHANGES = "%not-changed!%"
9
- extend Content::DocHelpers
10
11
 
11
12
  class << self
12
13
  # The `patch data` is built as follows:
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  module Common
4
4
  module Content
5
- class WrappedResponse < Common::WrappedResponse
5
+ class WrappedResponse < Ecoportal::API::Common::WrappedResponse
6
6
  include Enumerable
7
7
 
8
8
  attr_reader :response, :result
@@ -1,6 +1,10 @@
1
1
  module Ecoportal
2
2
  module API
3
3
  module Common
4
+ unless Ecoportal::API.const_defined?(:GEM2_VERSION)
5
+ msg = "Correct way to require this gem is `require 'ecoportal/api-v2`"
6
+ raise LoadError, msg
7
+ end
4
8
  end
5
9
  end
6
10
  end
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Page
5
5
  class Component
6
- class Action < Common::Content::DoubleModel
6
+ class Action < Ecoportal::API::Common::Content::DoubleModel
7
7
  class << self
8
8
  def new_doc
9
9
  {
@@ -4,7 +4,7 @@ module Ecoportal
4
4
  class Page
5
5
  class Component
6
6
  class ChartField
7
- class Config < Common::Content::DoubleModel
7
+ class Config < Ecoportal::API::Common::Content::DoubleModel
8
8
 
9
9
  class << self
10
10
  def new_doc
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Page
5
5
  class Component
6
- class ChecklistItem < Common::Content::DoubleModel
6
+ class ChecklistItem < Ecoportal::API::Common::Content::DoubleModel
7
7
 
8
8
  class << self
9
9
  def new_doc
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Page
5
5
  class Component
6
- class File < Common::Content::DoubleModel
6
+ class File < Ecoportal::API::Common::Content::DoubleModel
7
7
  class << self
8
8
  def new_doc
9
9
  {
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Page
5
5
  class Component
6
- class GaugeStop < Common::Content::DoubleModel
6
+ class GaugeStop < Ecoportal::API::Common::Content::DoubleModel
7
7
 
8
8
  class << self
9
9
  def new_doc
@@ -3,13 +3,13 @@ module Ecoportal
3
3
  class V2
4
4
  class Page
5
5
  class Component
6
- class GeoCoordinates < Common::Content::DoubleModel
6
+ class GeoCoordinates < Ecoportal::API::Common::Content::DoubleModel
7
7
  passthrough :lat, :lon
8
8
 
9
9
  def empty?
10
10
  !lat || !lon
11
11
  end
12
-
12
+
13
13
  def to_s
14
14
  "#{lat},#{lon}" if lat & lon
15
15
  end
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Page
5
5
  class Component
6
- class Image < Common::Content::DoubleModel
6
+ class Image < Ecoportal::API::Common::Content::DoubleModel
7
7
  class << self
8
8
  def new_doc
9
9
  {
@@ -12,7 +12,7 @@ module Ecoportal
12
12
  }
13
13
  end
14
14
  end
15
-
15
+
16
16
  passkey :id
17
17
  passforced :patch_ver, default: 1
18
18
  passthrough :weight
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Page
5
5
  class Component
6
- class Law < Common::Content::DoubleModel
6
+ class Law < Ecoportal::API::Common::Content::DoubleModel
7
7
 
8
8
  class << self
9
9
  def new_doc
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Page
5
5
  class Component
6
- class PeopleViewableField < Common::Content::DoubleModel
6
+ class PeopleViewableField < Ecoportal::API::Common::Content::DoubleModel
7
7
  passkey :id
8
8
  passthrough :type, read_only: true
9
9
  end
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Page
5
5
  class Component
6
- class SelectionOption < Common::Content::DoubleModel
6
+ class SelectionOption < Ecoportal::API::Common::Content::DoubleModel
7
7
  class << self
8
8
  def new_doc
9
9
  {
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Page
5
5
  class Component
6
- class SelectionOptions < Common::Content::CollectionModel
6
+ class SelectionOptions < Ecoportal::API::Common::Content::CollectionModel
7
7
  class_resolver :option_class, "Ecoportal::API::V2::Page::Component::SelectionOption"
8
8
 
9
9
  self.klass = :option_class
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Page
5
- class Component < Common::Content::DoubleModel
5
+ class Component < Ecoportal::API::Common::Content::DoubleModel
6
6
  extend Ecoportal::API::Common::Content::StringDigest
7
7
 
8
8
  class_resolver :tag_field_class, "Ecoportal::API::V2::Page::Component::TagField"
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Page
5
- class Components < Common::Content::CollectionModel
5
+ class Components < Ecoportal::API::Common::Content::CollectionModel
6
6
  class_resolver :component_class, "Ecoportal::API::V2::Page::Component"
7
7
 
8
8
  klass do |doc|
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Page
5
5
  class Force
6
- class Binding < Common::Content::DoubleModel
6
+ class Binding < Ecoportal::API::Common::Content::DoubleModel
7
7
  class << self
8
8
  def new_doc
9
9
  {
@@ -3,11 +3,11 @@ module Ecoportal
3
3
  class V2
4
4
  class Page
5
5
  class Force
6
- class Bindings < Common::Content::CollectionModel
6
+ class Bindings < Ecoportal::API::Common::Content::CollectionModel
7
7
  class_resolver :binding_class, "Ecoportal::API::V2::Page::Force::Binding"
8
8
 
9
- self.klass = :binding_class
10
- order_matters = true
9
+ self.klass = :binding_class
10
+ self.order_matters = true
11
11
 
12
12
  def ooze
13
13
  self._parent.ooze
@@ -4,7 +4,7 @@ module Ecoportal
4
4
  class V2
5
5
  class Page
6
6
  class Force
7
- class Helper < Common::Content::DoubleModel
7
+ class Helper < Ecoportal::API::Common::Content::DoubleModel
8
8
  class << self
9
9
  def new_doc
10
10
  {
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Page
5
- class Force < Common::Content::DoubleModel
5
+ class Force < Ecoportal::API::Common::Content::DoubleModel
6
6
  INITIAL_WEIGHT = 9999
7
7
 
8
8
  class << self
@@ -2,12 +2,12 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Page
5
- class Forces < Common::Content::CollectionModel
5
+ class Forces < Ecoportal::API::Common::Content::CollectionModel
6
6
  class_resolver :force_class, "Ecoportal::API::V2::Page::Force"
7
7
 
8
- self.klass = :force_class
9
- order_matters = true
10
- self.order_key = :weight
8
+ self.klass = :force_class
9
+ self.order_matters = true
10
+ self.order_key = :weight
11
11
 
12
12
  def ooze
13
13
  self._parent.ooze
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Page
5
- class MouldCounter < Common::Content::DoubleModel
5
+ class MouldCounter < Ecoportal::API::Common::Content::DoubleModel
6
6
  UID_REGEX = /^(?<prefix>.*?)(?<counter>\d+)(?<postfix>.*)$/i
7
7
  STR_LEN = 5
8
8
  BASE_NUM_STR = "0" * STR_LEN
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Page
5
- class PermissionFlags < Common::Content::DoubleModel
5
+ class PermissionFlags < Ecoportal::API::Common::Content::DoubleModel
6
6
  class << self
7
7
  def new_doc
8
8
  {
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Page
5
- class Permit < Common::Content::DoubleModel
5
+ class Permit < Ecoportal::API::Common::Content::DoubleModel
6
6
  class << self
7
7
  def new_doc
8
8
  {
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Page
5
- class Section < Common::Content::DoubleModel
5
+ class Section < Ecoportal::API::Common::Content::DoubleModel
6
6
  INITIAL_WEIGHT = 9999
7
7
 
8
8
  class << self
@@ -2,12 +2,12 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Page
5
- class Sections < Common::Content::CollectionModel
5
+ class Sections < Ecoportal::API::Common::Content::CollectionModel
6
6
  class_resolver :section_class, "Ecoportal::API::V2::Page::Section"
7
7
 
8
8
  self.klass = :section_class
9
9
  self.order_key = :weight
10
-
10
+
11
11
  def ooze
12
12
  self._parent.ooze
13
13
  end
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Page
5
- class Stage < Common::Content::DoubleModel
5
+ class Stage < Ecoportal::API::Common::Content::DoubleModel
6
6
  passkey :id
7
7
  passforced :patch_ver, default: 1
8
8
  passthrough :name, :ordering
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Page
5
- class Stages < Common::Content::CollectionModel
5
+ class Stages < Ecoportal::API::Common::Content::CollectionModel
6
6
  class_resolver :stage_class, "Ecoportal::API::V2::Page::Stage"
7
7
 
8
8
  self.klass = :stage_class
@@ -1,7 +1,7 @@
1
1
  module Ecoportal
2
2
  module API
3
3
  class V2
4
- class Page < Common::Content::DoubleModel
4
+ class Page < Ecoportal::API::Common::Content::DoubleModel
5
5
  ALLOWED_KEYS = %w[
6
6
  id external_id patch_ver name template_id
7
7
  base_tags tags
@@ -4,7 +4,7 @@ module Ecoportal
4
4
  class Pages
5
5
  # @attr_reader page_id [String] the `id` of the new ooze.
6
6
  # @attr_reader active_stage_id [String] the active stage `id` of the new ooze.
7
- class PageCreateResponse < Common::Content::DoubleModel
7
+ class PageCreateResponse < Ecoportal::API::Common::Content::DoubleModel
8
8
  passthrough :page_id, :active_stage_id
9
9
  end
10
10
  end
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Pages
5
5
  class PageStage
6
- class Task < Common::Content::DoubleModel
6
+ class Task < Ecoportal::API::Common::Content::DoubleModel
7
7
  passkey :id
8
8
  passforced :patch_ver, default: 0
9
9
 
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Pages
5
5
  class PageStage
6
- class Tasks < Common::Content::CollectionModel
6
+ class Tasks < Ecoportal::API::Common::Content::CollectionModel
7
7
  class_resolver :task_class, "Ecoportal::API::V2::Pages::PageStage::Task"
8
8
 
9
9
  self.klass = :task_class
@@ -7,8 +7,8 @@ module Ecoportal
7
7
  #
8
8
  # @attr_reader client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
9
9
  class Stages
10
- extend Common::BaseClass
11
- include Common::Content::DocHelpers
10
+ extend Ecoportal::API::Common::BaseClass
11
+ include Ecoportal::API::Common::Content::DocHelpers
12
12
 
13
13
  class_resolver :page_stage_class, "Ecoportal::API::V2::Pages::PageStage"
14
14
 
@@ -1,12 +1,12 @@
1
1
  module Ecoportal
2
2
  module API
3
3
  class V2
4
- # @attr_reader client [Common::Client] a `Common::Client` object that
5
- # holds the configuration of the api connection.
4
+ # @attr_reader client [Ecoportal::API::Common::Client] a `Ecoportal::API::Common::Client`
5
+ # object that holds the configuration of the api connection.
6
6
  class Pages
7
7
  STAGE_REX = /stages\/(?<sid>.*)/.freeze
8
- extend Common::BaseClass
9
- include Common::Content::DocHelpers
8
+ extend Ecoportal::API::Common::BaseClass
9
+ include Ecoportal::API::Common::Content::DocHelpers
10
10
 
11
11
  class_resolver :stages_class, "Ecoportal::API::V2::Pages::Stages"
12
12
  class_resolver :page_class, "Ecoportal::API::V2::Page"
@@ -15,7 +15,8 @@ module Ecoportal
15
15
 
16
16
  attr_reader :client
17
17
 
18
- # @param client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
18
+ # @param client [Ecoportal::API::Common::Client] a `Ecoportal::API::Common::Client` object that holds
19
+ # the configuration of the api connection.
19
20
  # @return [Schemas] an instance object ready to make schema api requests.
20
21
  def initialize(client)
21
22
  @client = client
@@ -39,7 +40,7 @@ module Ecoportal
39
40
 
40
41
  id = get_id(id)
41
42
  response = client.get("/pages/#{CGI.escape(id)}")
42
- wrapped = Common::Content::WrappedResponse.new(response, page_class)
43
+ wrapped = Ecoportal::API::Common::Content::WrappedResponse.new(response, page_class)
43
44
 
44
45
  return wrapped.result if wrapped.success?
45
46
 
@@ -77,7 +78,10 @@ module Ecoportal
77
78
  def get_new(from)
78
79
  id = get_id(from)
79
80
  response = client.get("/pages/new", params: {template_id: id})
80
- wrapped = Common::Content::WrappedResponse.new(response, page_stage_class)
81
+ wrapped = Ecoportal::API::Common::Content::WrappedResponse.new(
82
+ response,
83
+ page_stage_class
84
+ )
81
85
 
82
86
  return wrapped.result if wrapped.success?
83
87
  raise "Could not get new page from template #{id} - Error #{response.status}: #{response.body}"
@@ -99,9 +103,15 @@ module Ecoportal
99
103
  end
100
104
  end
101
105
  response = client.post("/pages", data: body, params: {template_id: id})
102
- wrapped = Common::Content::WrappedResponse.new(response, create_page_response_class)
106
+ wrapped = Ecoportal::API::Common::Content::WrappedResponse.new(
107
+ response,
108
+ create_page_response_class
109
+ )
103
110
  return wrapped.result if wrapped.success?
104
- raise "Could not create page from template #{id} - Error #{response.status}: #{response.body}"
111
+
112
+ msg = "Could not create page from template #{id} "
113
+ msg << "- Error #{response.status}: #{response.body}"
114
+ raise msg
105
115
  end
106
116
 
107
117
  private
@@ -1,7 +1,7 @@
1
1
  module Ecoportal
2
2
  module API
3
3
  class V2
4
- # @attr_reader client [Common::Client] a `Common::Client` object that
4
+ # @attr_reader client [Ecoportal::API::Common::Client] a `Ecoportal::API::Common::Client` object that
5
5
  # holds the configuration of the api connection.
6
6
  class People < API::Internal::People
7
7
  def batch
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class Registers
5
5
  class PageResult
6
- class MembraneDroplet < Common::Content::DoubleModel
6
+ class MembraneDroplet < Ecoportal::API::Common::Content::DoubleModel
7
7
  passkey :ref
8
8
  passthrough :label, :type, :value
9
9
  passthrough :field_configuration_id
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Registers
5
- class PageResult < Common::Content::DoubleModel
5
+ class PageResult < Ecoportal::API::Common::Content::DoubleModel
6
6
  passkey :id
7
7
  passthrough :template_id
8
8
  passthrough :name, :state
@@ -22,4 +22,4 @@ module Ecoportal
22
22
  end
23
23
  end
24
24
 
25
- require_relative 'page_result/membrane_droplet'
25
+ require 'ecoportal/api/v2/registers/page_result/membrane_droplet'
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Registers
5
- class Register < Common::Content::DoubleModel
5
+ class Register < Ecoportal::API::Common::Content::DoubleModel
6
6
  passkey :id
7
7
  passthrough :name
8
8
 
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Registers
5
- class SearchResults < Common::Content::DoubleModel
5
+ class SearchResults < Ecoportal::API::Common::Content::DoubleModel
6
6
  passthrough :total, :total_before_filtering
7
7
  passarray :tags, order_matters: false
8
8
  embeds_many :results, klass: "Ecoportal::API::V2::Registers::PageResult"
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Registers
5
- class StageResult < Common::Content::DoubleModel
5
+ class StageResult < Ecoportal::API::Common::Content::DoubleModel
6
6
  passkey :id
7
7
  passthrough :name, :state, :complete, :ordering
8
8
  passarray :tags, order_matters: false
@@ -2,7 +2,7 @@ module Ecoportal
2
2
  module API
3
3
  class V2
4
4
  class Registers
5
- class Template < Common::Content::DoubleModel
5
+ class Template < Ecoportal::API::Common::Content::DoubleModel
6
6
  passkey :id
7
7
  passthrough :name
8
8
  end
@@ -2,12 +2,12 @@ require 'base64'
2
2
  module Ecoportal
3
3
  module API
4
4
  class V2
5
- # @attr_reader client [Common::Client] a `Common::Client` object that
5
+ # @attr_reader client [Ecoportal::API::Common::Client] a `Ecoportal::API::Common::Client` object that
6
6
  # holds the configuration of the api connection.
7
7
  class Registers
8
- extend Common::BaseClass
8
+ extend Ecoportal::API::Common::BaseClass
9
+ include Ecoportal::API::Common::Content::DocHelpers
9
10
  include Enumerable
10
- include Common::Content::DocHelpers
11
11
 
12
12
  class_resolver :register_class, "Ecoportal::API::V2::Registers::Register"
13
13
  class_resolver :register_search_result_class, "Ecoportal::API::V2::Registers::PageResult"
@@ -15,7 +15,7 @@ module Ecoportal
15
15
 
16
16
  attr_reader :client
17
17
 
18
- # @param client [Common::Client] a `Common::Client` object that
18
+ # @param client [Ecoportal::API::Common::Client] a `Ecoportal::API::Common::Client` object that
19
19
  # holds the configuration of the api connection.
20
20
  # @return [Registers] an instance object ready to make registers api requests.
21
21
  def initialize(client)
@@ -32,7 +32,7 @@ module Ecoportal
32
32
  # @return [Enumerable<Register>] an `Enumerable` with all schemas already wrapped as `Register` objects.
33
33
  def get
34
34
  response = client.get("/templates")
35
- Common::Content::WrappedResponse.new(
35
+ Ecoportal::API::Common::Content::WrappedResponse.new(
36
36
  response,
37
37
  register_class,
38
38
  key: "registers"
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class V2
4
4
  class S3
5
5
  class Files
6
- class Poll < Common::Content::DoubleModel
6
+ class Poll < Ecoportal::API::Common::Content::DoubleModel
7
7
  passthrough :poll_url
8
8
  embeds_one :status, nullable: true, klass: "Ecoportal::API::V2::S3::Files::PollStatus"
9
9
 
@@ -3,8 +3,8 @@ module Ecoportal
3
3
  class V2
4
4
  class S3
5
5
  class Files
6
- class PollStatus < Common::Content::DoubleModel
7
- class FileContainer < Common::Content::DoubleModel
6
+ class PollStatus < Ecoportal::API::Common::Content::DoubleModel
7
+ class FileContainer < Ecoportal::API::Common::Content::DoubleModel
8
8
  passkey :id
9
9
  passthrough :file_container_id # same as :id :)
10
10
  passthrough :name, :label
@@ -1,14 +1,14 @@
1
1
  module Ecoportal
2
2
  module API
3
3
  class V2
4
- # @attr_reader client [Common::Client] a `Common::Client` object that
4
+ # @attr_reader client [Ecoportal::API::Common::Client] a `Ecoportal::API::Common::Client` object that
5
5
  # holds the configuration of the api connection.
6
6
  class S3
7
7
  class Files
8
8
  class FailedPollRequest < StandardError; end
9
9
  class CantCheckStatus < StandardError; end
10
10
 
11
- extend Common::BaseClass
11
+ extend Ecoportal::API::Common::BaseClass
12
12
 
13
13
  POLL_TIMEOUT = 240
14
14
  DELAY_STATUS_CHECK = 5
@@ -18,7 +18,8 @@ module Ecoportal
18
18
 
19
19
  attr_reader :client, :s3_api
20
20
 
21
- # @param client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
21
+ # @param client [Ecoportal::API::Common::Client] a `Ecoportal::API::Common::Client`
22
+ # object that holds the configuration of the api connection.
22
23
  # @param s3_api [V2::S3] the parent S3 api object.
23
24
  # @return [Schemas] an instance object ready to make schema api requests.
24
25
  def initialize(client, s3_api:)
@@ -1,19 +1,20 @@
1
1
  module Ecoportal
2
2
  module API
3
3
  class V2
4
- # @attr_reader client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
4
+ # @attr_reader client [Ecoportal::API::Common::Client] a `Ecoportal::API::Common::Client` object that holds the configuration of the api connection.
5
5
  class S3
6
6
  class MissingLocalFile < ArgumentError; end
7
7
  class CredentialsGetFailed < StandardError; end
8
8
 
9
- extend Common::BaseClass
9
+ extend Ecoportal::API::Common::BaseClass
10
10
 
11
11
  class_resolver :data_class, "Ecoportal::API::V2::S3::Data"
12
12
  class_resolver :files_class, "Ecoportal::API::V2::S3::Files"
13
13
 
14
14
  attr_reader :client
15
15
 
16
- # @param client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
16
+ # @param client [Ecoportal::API::Common::Client] a `Ecoportal::API::Common::Client`
17
+ # object that holds the configuration of the api connection.
17
18
  # @return [Schemas] an instance object ready to make schema api requests.
18
19
  def initialize(client)
19
20
  @client = client
@@ -5,8 +5,13 @@ module Ecoportal
5
5
  # @attr_reader client [Common::Client] a `Common::Client` object that holds the configuration of the api connection.
6
6
  # @attr_reader logger [Logger] the logger.
7
7
  class V2
8
- extend Common::BaseClass
9
- include Common::Logging
8
+ unless Ecoportal::API.const_defined?(:GEM2_VERSION)
9
+ msg = "Correct way to require this gem is `require 'ecoportal/api-v2`"
10
+ raise LoadError, msg
11
+ end
12
+
13
+ extend Ecoportal::API::Common::BaseClass
14
+ include Ecoportal::API::Common::Logging
10
15
 
11
16
  VERSION = "v2".freeze
12
17
 
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- GEM2_VERSION = '2.0.5'.freeze
3
+ GEM2_VERSION = '2.0.8'.freeze
4
4
  end
5
5
  end
@@ -6,5 +6,6 @@ module Ecoportal
6
6
  end
7
7
  end
8
8
 
9
- require_relative "api/common.v2"
10
- require_relative "api/v2"
9
+ require 'ecoportal/api/v2_version'
10
+ require 'ecoportal/api/common.v2'
11
+ require 'ecoportal/api/v2'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecoportal-api-v2
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.5
4
+ version: 2.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
@@ -14,14 +14,14 @@ dependencies:
14
14
  name: pry
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.14'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.14'
27
27
  - !ruby/object:Gem::Dependency