ecoportal-api-graphql 0.3.14 → 0.3.15

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: da17c7fff2d84fe5564911fe5a9be5af6200fdd085e681e4547ce900f44315bd
4
- data.tar.gz: 622ced495fa4873f4ca3ea72596865c2db9bb78172f80253e0f90e5167b2e89a
3
+ metadata.gz: 2c155d6c7fa282ad8cf9ccae9682cec2ce1560b1716802cf6dabfbdd20d84587
4
+ data.tar.gz: 39d410c6e6082e3cb36e86739bcd3c04e45c3d8e56b0905a97ecb6839160cde7
5
5
  SHA512:
6
- metadata.gz: 796f9be5a3c4edd8f400675e45c3138370fe98106d8045f30084b9e39b98264ff939b4152ee05908d987518a04d9989d2131b62655dfac2e2fab45940da560e6
7
- data.tar.gz: 444a2be4a632b01ac2c949279fd42ad1a5420f0a14d32f72746ebcd726521ea09da8b6bd16ac30409cef2c8550d368187f6be554b67850426a369a4f57db7ab3
6
+ metadata.gz: 9c48ec8bbe4f40597e59fa6463a9244e350e6bbe4a7558dcb8cad79e35c8fab0bcde02c0e09a8a4e66ac7bc7f504a0bad0ac1a260edda8775565014cfa080cf6
7
+ data.tar.gz: 40f80dd98b63c3a8c83073d30037bf080e3fa282096c9f435b84dabe663ad578d0dd92acafeaed4856531dc64abbd75fc9b4cb434b7adad9536bd5f5ef632024
data/CHANGELOG.md CHANGED
@@ -8,8 +8,18 @@ All notable changes to this project will be documented in this file.
8
8
  - Analyse how to "DSL" currentOrganization.action.activities
9
9
  - review `path` tracking
10
10
 
11
+ ## [0.3.15] - 2024-04-xx
11
12
 
12
- ## [0.3.14] - 2024-02-xx
13
+ ### Added
14
+ - `Ecoportal::API::GraphQL::Logic::BaseQuery`
15
+ - `::base_path` class instance var.
16
+ - query to retrieve `currentOrganization.classifications`
17
+
18
+ ### Changed
19
+ ### Fixed
20
+ - upgraded `ecoportal-api-v2` gem
21
+
22
+ ## [0.3.14] - 2024-03-13
13
23
 
14
24
  ### Added
15
25
  - some benchmarking on
@@ -29,6 +29,6 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency "redcarpet", ">= 3.6.0", "< 4"
30
30
  spec.add_development_dependency "pry" , ">= 0.14"
31
31
 
32
- spec.add_dependency 'ecoportal-api-v2', '>= 1.1.7', '< 1.2'
32
+ spec.add_dependency 'ecoportal-api-v2', '>= 1.1.8', '< 1.2'
33
33
  spec.add_dependency 'graphlient', '>= 0.8.0', '< 0.9'
34
34
  end
@@ -3,6 +3,8 @@ module Ecoportal
3
3
  class GraphQL
4
4
  module Base
5
5
  class LocationClassificationType < Ecoportal::API::GraphQL::Base::Model
6
+ read_only!
7
+
6
8
  passkey :id
7
9
  passthrough :name
8
10
  passboolean :active
@@ -9,7 +9,7 @@ module Ecoportal
9
9
  embeds_one :parent, klass: Base::LocationNode, nullable: true
10
10
  passboolean :archived
11
11
  passthrough :archivedToken
12
- embeds_many :classifications, klass: Base::LocationClassificationType
12
+ embeds_many :classifications, klass: Base::LocationClassificationType
13
13
 
14
14
  def parentId
15
15
  parent&.id
@@ -9,6 +9,11 @@ module Ecoportal
9
9
  @client = client
10
10
  end
11
11
 
12
+ def nodeClassifications(**kargs, &block)
13
+ query_model = Ecoportal::API::GraphQL::Query::LocationClassifications.new(client)
14
+ query_model.query(**kargs, &block)
15
+ end
16
+
12
17
  def applyCommandsInput
13
18
  Ecoportal::API::GraphQL::Input::LocationStructure::ApplyCommands.new
14
19
  end
@@ -11,7 +11,7 @@ module Ecoportal
11
11
  passboolean :preview
12
12
 
13
13
  def add(type, **kargs)
14
- if command = new_command(type)
14
+ if (command = new_command(type))
15
15
  command.set_values(**kargs) unless kargs.empty?
16
16
  yield(command) if block_given?
17
17
  end
@@ -14,7 +14,7 @@ module Ecoportal
14
14
 
15
15
  def set_values(**kargs)
16
16
  kargs.each do |key, value|
17
- self.send(key, value) if self.respond_to?(key, true)
17
+ send(key, value) if respond_to?(key, true)
18
18
  end
19
19
  self
20
20
  end
@@ -39,6 +39,14 @@ module Ecoportal
39
39
  @field_name = nil
40
40
  @field_name = str.to_s if str
41
41
  end
42
+
43
+ def base_path(path = :unused)
44
+ return @base_path if path == :unused
45
+ path ||= []
46
+ path = path.to_s.split('.') if path.is_a?(String)
47
+ path = path.map(&:to_s).compact
48
+ @base_path = path
49
+ end
42
50
  end
43
51
 
44
52
  include Ecoportal::API::Common::Concerns::Benchmarkable
@@ -46,7 +54,7 @@ module Ecoportal
46
54
  attr_reader :client
47
55
  attr_reader :base_path
48
56
 
49
- def initialize(client, path: nil, base_path: [])
57
+ def initialize(client, path: nil, base_path: self.class.base_path)
50
58
  @path = path
51
59
  @base_path = base_path
52
60
  @client = client
@@ -3,7 +3,7 @@ module Ecoportal
3
3
  class GraphQL
4
4
  module Model
5
5
  class Organization < Ecoportal::API::GraphQL::Base::Organization
6
- DEFAULT_PATH = ["currentOrganization"]
6
+ DEFAULT_PATH = ["currentOrganization"].freeze
7
7
 
8
8
  class << self
9
9
  extend Ecoportal::API::Common::GraphQL::QueryIntegration
@@ -0,0 +1,39 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Query
5
+ class LocationClassifications < Ecoportal::API::GraphQL::Logic::QueryArray
6
+ accepted_params :active, default: true
7
+
8
+ base_path 'currentOrganization.locations'
9
+ field_name :classifications
10
+
11
+ class_resolver :item_class, Ecoportal::API::GraphQL::Base::LocationClassificationType
12
+
13
+ private
14
+
15
+ def basic_block(&block)
16
+ final_block = block || default_query_block
17
+ proc {
18
+ query(active: :boolean) {
19
+ currentOrganization {
20
+ locations {
21
+ classifications(active: :active, &final_block)
22
+ }
23
+ }
24
+ }
25
+ }
26
+ end
27
+
28
+ def default_query_block
29
+ proc {
30
+ id
31
+ name
32
+ active
33
+ }
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -7,6 +7,7 @@ module Ecoportal
7
7
  end
8
8
  end
9
9
 
10
+ require 'ecoportal/api/graphql/query/location_classifications'
10
11
  require 'ecoportal/api/graphql/query/location_structure'
11
12
  require 'ecoportal/api/graphql/query/location_structures'
12
13
  require 'ecoportal/api/graphql/query/action'
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- GRAPQL_VERSION = "0.3.14"
3
+ GRAPQL_VERSION = "0.3.15"
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.14
4
+ version: 0.3.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oscar Segura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-03-12 00:00:00.000000000 Z
11
+ date: 2024-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -130,7 +130,7 @@ dependencies:
130
130
  requirements:
131
131
  - - ">="
132
132
  - !ruby/object:Gem::Version
133
- version: 1.1.7
133
+ version: 1.1.8
134
134
  - - "<"
135
135
  - !ruby/object:Gem::Version
136
136
  version: '1.2'
@@ -140,7 +140,7 @@ dependencies:
140
140
  requirements:
141
141
  - - ">="
142
142
  - !ruby/object:Gem::Version
143
- version: 1.1.7
143
+ version: 1.1.8
144
144
  - - "<"
145
145
  - !ruby/object:Gem::Version
146
146
  version: '1.2'
@@ -301,6 +301,7 @@ files:
301
301
  - lib/ecoportal/api/graphql/query/action.rb
302
302
  - lib/ecoportal/api/graphql/query/actions.rb
303
303
  - lib/ecoportal/api/graphql/query/contractor_entities.rb
304
+ - lib/ecoportal/api/graphql/query/location_classifications.rb
304
305
  - lib/ecoportal/api/graphql/query/location_structure.rb
305
306
  - lib/ecoportal/api/graphql/query/location_structures.rb
306
307
  - lib/ecoportal/api/graphql_version.rb