ecoportal-api-graphql 0.3.8 → 0.3.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 954a7b6f24cb89c28f8a6b02503353e9bc9453e07ca862a3862a9b2c371c9f07
4
- data.tar.gz: 6ef1faafa1dc3d93752c4c241d362266c7314a2db1ea3ab03b7aad8f81fef4d7
3
+ metadata.gz: b9ee1a2e7ea100fbb03bd2c617e771dafccf7bd443ded39285f230fb68790498
4
+ data.tar.gz: 9139ed6d2a6adf21990beeb7ffea0ad9dd03a1b80ff924e50249ba904cfa979f
5
5
  SHA512:
6
- metadata.gz: a22aad41024397365cccf44321c72bfdf702e56729691b5d7e4a7169e076c1b1ed11ab5c14f0e379fff65d35ff35220c34d2238db5ec47ad01a4f7c553767901
7
- data.tar.gz: afd2b3bbeabcafcba32ad6769fa5551c463689e0a5e0d9d0f34b3684eca5732f300c7300b935c70e7e490e2b960b6dd848e87cf3b1f9bf27058e723fa52de9eb
6
+ metadata.gz: 18c0055c77d55072ab9dfadb521e5a740fae4e79e3eed45148c248f887d5ae5ae8f85f2460e788e3529e9274859f76ae3125775a8fbee66de9daf1d4bfe0f242
7
+ data.tar.gz: 0d8bb739aa1625bf87021160523d42fd885d1537239fbefa4edff0ce0cd2142ebd9488a4411703fba4cdd109bc0be3dc7d0c01f15927f83213e5701c9575e9c6
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,17 @@ 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.9] - 2023-06-xx
13
+
14
+ ### Added
15
+ - `Ecoportal::API::GraphQL::Logic::BaseQuery`
16
+ - Added support for **default** values.
17
+
18
+ ### Changed
19
+ ### Fixed
20
+
21
+ ## [0.3.8] - 2023-07-18
17
22
 
18
23
  ### Added
19
24
  - 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
@@ -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.9"
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.9
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-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler