ecoportal-api-graphql 0.3.8 → 0.3.10

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: 954a7b6f24cb89c28f8a6b02503353e9bc9453e07ca862a3862a9b2c371c9f07
4
- data.tar.gz: 6ef1faafa1dc3d93752c4c241d362266c7314a2db1ea3ab03b7aad8f81fef4d7
3
+ metadata.gz: b5e8efdf475cb3aeaf0ab102675bbfc20ebae438fccbf05d07f5d650deffbd3e
4
+ data.tar.gz: a46e510f42b77e8b83739b66ef4e6a563c4251835c3aa843d9a4623fa80e3b56
5
5
  SHA512:
6
- metadata.gz: a22aad41024397365cccf44321c72bfdf702e56729691b5d7e4a7169e076c1b1ed11ab5c14f0e379fff65d35ff35220c34d2238db5ec47ad01a4f7c553767901
7
- data.tar.gz: afd2b3bbeabcafcba32ad6769fa5551c463689e0a5e0d9d0f34b3684eca5732f300c7300b935c70e7e490e2b960b6dd848e87cf3b1f9bf27058e723fa52de9eb
6
+ metadata.gz: 70936ba8c2442dd8250565c9fc73be01403ed3f043cb8ec9c0058576ab48f557132145a55bb71b8a1be53c1818e8b9ced8e1cb2739e73edb785ba3af8c8ee7c5
7
+ data.tar.gz: e9708d5c7cf2e5366dd426e0cab18b6811241da023b471f93887f3cda41300ee7bd2115427d62441e7b95c8a8321b528e213014a8bcfa8cfcf69171ce8fc95d7
data/CHANGELOG.md CHANGED
@@ -1,11 +1,6 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
- ## [0.3.9] - 2023-06-xx
5
-
6
- ### Added
7
- ### Changed
8
- ### Fixed
9
4
 
10
5
  ### ToDo
11
6
  - Add update operation for `ContractorEntity`
@@ -13,7 +8,26 @@ All notable changes to this project will be documented in this file.
13
8
  - Analyse how to "DSL" currentOrganization.action.activities
14
9
  - review `path` tracking
15
10
 
16
- ## [0.3.8] - 2023-07-xx
11
+
12
+ ## [0.3.11] - 2023-08-xx
13
+
14
+ ### Added
15
+ ### Changed
16
+ ### Fixed
17
+
18
+ ## [0.3.10] - 2023-08-12
19
+
20
+ ### Fixed
21
+ - `Ecopotal::API::GraphQL::Query::LocationStructure`
22
+ - `query` in basic_block missed an explicitly declared parameter.
23
+
24
+ ## [0.3.9] - 2023-08-03
25
+
26
+ ### Added
27
+ - `Ecoportal::API::GraphQL::Logic::BaseQuery`
28
+ - Added support for **default** values.
29
+
30
+ ## [0.3.8] - 2023-07-18
17
31
 
18
32
  ### Added
19
33
  - Integration for archiving actions.
@@ -4,16 +4,27 @@ module Ecoportal
4
4
  module Logic
5
5
  class BaseQuery
6
6
  include Ecoportal::API::Common::GraphQL::ClassHelpers
7
- inheritable_attrs :accepted_params
7
+ inheritable_attrs :accepted_params, :param_defaults
8
8
 
9
9
  class << self
10
- def accepted_params(*keys)
10
+ def param_defaults
11
+ @param_defaults ||= {}
12
+ end
13
+
14
+ def accepted_params(*keys, default: :unused)
11
15
  @accepted_params ||= []
12
16
  return @accepted_params if keys.empty?
17
+ keys.map(&:to_sym).uniq.each do |key|
18
+ @accepted_params |= [key]
19
+ param_defaults[key] = default unless default == :unused
20
+ end
21
+
13
22
  @accepted_params.push(*keys).tap {|ks| ks.uniq!}
23
+ @accepted_params
14
24
  end
15
25
 
16
26
  def clear_accepted_params
27
+ @param_defaults = {}
17
28
  @accepted_params = []
18
29
  end
19
30
 
@@ -68,7 +79,8 @@ module Ecoportal
68
79
  end
69
80
 
70
81
  def graphql_query(path: self.path, **kargs, &block)
71
- query_params = self.class.slice_params(kargs)
82
+ default_params = self.class.param_defaults.dup
83
+ query_params = self.class.slice_params(default_params.merge(kargs))
72
84
  request(*path) do
73
85
  client.query(query_params, &block)
74
86
  end
@@ -21,12 +21,6 @@ module Ecoportal
21
21
  klass.klass = item_class
22
22
  end
23
23
  end
24
-
25
- private
26
-
27
- def basic_block
28
- raise "Missuse. You have to implement 'basic_block' private method in the child class"
29
- end
30
24
  end
31
25
  end
32
26
  end
@@ -4,6 +4,8 @@ module Ecoportal
4
4
  module Query
5
5
  class LocationStructure < Ecoportal::API::GraphQL::Logic::Query
6
6
  accepted_params :id
7
+ accepted_params :includeArchivedNodes, default: true
8
+
7
9
  field_name :structure
8
10
 
9
11
  class_resolver :item_class, Ecoportal::API::GraphQL::Model::LocationStructure
@@ -13,7 +15,7 @@ module Ecoportal
13
15
  def basic_block(&block)
14
16
  final_block = block || default_query_block
15
17
  Proc.new {
16
- query(id: :id!) {
18
+ query(id: :id!, includeArchivedNodes: :boolean) {
17
19
  currentOrganization {
18
20
  locations {
19
21
  structure(id: :id, &final_block)
@@ -34,7 +36,7 @@ module Ecoportal
34
36
  weight
35
37
  updatedAt
36
38
  visitorManagementEnabled
37
- nodes(includeArchived: true) {
39
+ nodes(includeArchived: :includeArchivedNodes) {
38
40
  ___Ecoportal__API__GraphQL__Fragment__LocationNode
39
41
  }
40
42
  }
@@ -3,7 +3,9 @@ module Ecoportal
3
3
  class GraphQL
4
4
  module Query
5
5
  class LocationStructures < Ecoportal::API::GraphQL::Logic::QueryArray
6
- accepted_params :includeArchived, :includeUnpublished
6
+ accepted_params :includeArchived, :includeUnpublished, default: false
7
+ accepted_params :includeArchivedNodes, default: true
8
+
7
9
  field_name :structures
8
10
 
9
11
  class_resolver :item_class, Ecoportal::API::GraphQL::Model::LocationStructure
@@ -13,7 +15,10 @@ module Ecoportal
13
15
  def basic_block(&block)
14
16
  final_block = block || default_query_block
15
17
  Proc.new {
16
- query(includeArchived: :boolean, includeUnpublished: :boolean) {
18
+ query(includeArchived: :boolean,
19
+ includeUnpublished: :boolean,
20
+ includeArchivedNodes: :boolean
21
+ ) {
17
22
  currentOrganization {
18
23
  locations {
19
24
  structures(
@@ -37,7 +42,7 @@ module Ecoportal
37
42
  archived
38
43
  weight
39
44
  visitorManagementEnabled
40
- nodes(includeArchived: true) {
45
+ nodes(includeArchived: :includeArchivedNodes) {
41
46
  ___Ecoportal__API__GraphQL__Fragment__LocationNode
42
47
  }
43
48
  }
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- GRAPQL_VERSION = "0.3.8"
3
+ GRAPQL_VERSION = "0.3.10"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ecoportal-api-graphql
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.8
4
+ version: 0.3.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-17 00:00:00.000000000 Z
11
+ date: 2023-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler