ecoportal-api-graphql 0.3.14 → 0.3.16

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -1
  3. data/ecoportal-api-graphql.gemspec +1 -1
  4. data/lib/ecoportal/api/graphql/base/location_classification_type.rb +2 -0
  5. data/lib/ecoportal/api/graphql/base/location_node.rb +1 -1
  6. data/lib/ecoportal/api/graphql/builder/contractor_entity.rb +8 -0
  7. data/lib/ecoportal/api/graphql/builder/location_structure.rb +5 -0
  8. data/lib/ecoportal/api/graphql/input/contractor_entity/create.rb +1 -3
  9. data/lib/ecoportal/api/graphql/input/contractor_entity/destroy.rb +1 -0
  10. data/lib/ecoportal/api/graphql/input/contractor_entity/update.rb +7 -1
  11. data/lib/ecoportal/api/graphql/input/location_structure/apply_commands.rb +1 -1
  12. data/lib/ecoportal/api/graphql/input/location_structure/command_interface.rb +1 -1
  13. data/lib/ecoportal/api/graphql/logic/base_query.rb +9 -1
  14. data/lib/ecoportal/api/graphql/model/organization.rb +1 -1
  15. data/lib/ecoportal/api/graphql/mutation/action/archive.rb +2 -2
  16. data/lib/ecoportal/api/graphql/mutation/action/update.rb +2 -2
  17. data/lib/ecoportal/api/graphql/mutation/contractor_entity/create.rb +3 -3
  18. data/lib/ecoportal/api/graphql/mutation/contractor_entity/destroy.rb +40 -0
  19. data/lib/ecoportal/api/graphql/mutation/contractor_entity/update.rb +3 -3
  20. data/lib/ecoportal/api/graphql/mutation/contractor_entity.rb +1 -1
  21. data/lib/ecoportal/api/graphql/query/action.rb +2 -2
  22. data/lib/ecoportal/api/graphql/query/actions.rb +2 -2
  23. data/lib/ecoportal/api/graphql/query/contractor_entities.rb +2 -2
  24. data/lib/ecoportal/api/graphql/query/location_classifications.rb +39 -0
  25. data/lib/ecoportal/api/graphql/query.rb +1 -0
  26. data/lib/ecoportal/api/graphql_version.rb +1 -1
  27. metadata +6 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da17c7fff2d84fe5564911fe5a9be5af6200fdd085e681e4547ce900f44315bd
4
- data.tar.gz: 622ced495fa4873f4ca3ea72596865c2db9bb78172f80253e0f90e5167b2e89a
3
+ metadata.gz: 7d3550f5f5777e78de779031a4037935cc6ec9d461993ca642f7da06b6e96fa6
4
+ data.tar.gz: 61e4eeedf713fa389aa8bf3a73093daa5f8400a5517c7cf15d9264055f9ecd01
5
5
  SHA512:
6
- metadata.gz: 796f9be5a3c4edd8f400675e45c3138370fe98106d8045f30084b9e39b98264ff939b4152ee05908d987518a04d9989d2131b62655dfac2e2fab45940da560e6
7
- data.tar.gz: 444a2be4a632b01ac2c949279fd42ad1a5420f0a14d32f72746ebcd726521ea09da8b6bd16ac30409cef2c8550d368187f6be554b67850426a369a4f57db7ab3
6
+ metadata.gz: '0286bc0b8a40a283772b70fc484b0f08ad8dab5026f0db553ff936b137783f7d10e0ceae53148090194df97aea722763a2765c744eb8ce6bb93e0ce9ff1e93be'
7
+ data.tar.gz: 9bfa704f8104dd98c3d22eb9867ee902bf115a595479bf8cace89d06b12c1ebf0a614be03103d92dc73410e7ccf978c06a259d677d85cc8d4dd047455ae47e49
data/CHANGELOG.md CHANGED
@@ -8,8 +8,33 @@ 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.17] - 2024-05-xx
11
12
 
12
- ## [0.3.14] - 2024-02-xx
13
+ ### Added
14
+ ### Changed
15
+ ### Fixed
16
+
17
+ ## [0.3.16] - 2024-04-29
18
+
19
+ ### Added
20
+ - Exposed `graphql` `ContractorEntity` `destroy`
21
+ ### Fixed
22
+ - incorrect loading
23
+
24
+ ### Changed
25
+ - Input for ContractorEntity create moved as `update` (as it wasn't correct)
26
+
27
+ ## [0.3.15] - 2024-04-13
28
+
29
+ ### Added
30
+ - `Ecoportal::API::GraphQL::Logic::BaseQuery`
31
+ - `::base_path` class instance var.
32
+ - query to retrieve `currentOrganization.classifications`
33
+
34
+ ### Fixed
35
+ - upgraded `ecoportal-api-v2` gem
36
+
37
+ ## [0.3.14] - 2024-03-13
13
38
 
14
39
  ### Added
15
40
  - 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
@@ -17,6 +17,10 @@ module Ecoportal
17
17
  updateMutation.query(**kargs, &block)
18
18
  end
19
19
 
20
+ def destroy(**kargs, &block)
21
+ destroyMutation.query(**kargs, &block)
22
+ end
23
+
20
24
  private
21
25
 
22
26
  def createMutation
@@ -26,6 +30,10 @@ module Ecoportal
26
30
  def updateMutation
27
31
  Ecoportal::API::GraphQL::Mutation::ContractorEntity::Update.new(client)
28
32
  end
33
+
34
+ def destroyMutation
35
+ Ecoportal::API::GraphQL::Mutation::ContractorEntity::Destroy.new(client)
36
+ end
29
37
  end
30
38
  end
31
39
  end
@@ -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
@@ -5,9 +5,7 @@ module Ecoportal
5
5
  module ContractorEntity
6
6
  class Create < Ecoportal::API::GraphQL::Base::ContractorEntity
7
7
  passthrough :clientMutationId
8
- class_resolver :id_diff_input, "Ecoportal::API::GraphQL::Input::IdDiff"
9
- embeds_one :associatedPeopleIds, klass: :id_diff_input
10
- embeds_one :leadContractorIds, klass: :id_diff_input
8
+ passboolean :overrideAutoApproval
11
9
  end
12
10
  end
13
11
  end
@@ -4,6 +4,7 @@ module Ecoportal
4
4
  module Input
5
5
  module ContractorEntity
6
6
  class Destroy < Ecoportal::API::GraphQL::Base::Model
7
+ passthrough :clientMutationId
7
8
  passkey :id
8
9
  end
9
10
  end
@@ -2,7 +2,13 @@ module Ecoportal
2
2
  module API
3
3
  class GraphQL
4
4
  module Input
5
- class Update < Ecoportal::API::GraphQL::Input::ContractorEntity::Create
5
+ module ContractorEntity
6
+ class Update < Ecoportal::API::GraphQL::Input::ContractorEntity::Create
7
+ passthrough :clientMutationId
8
+ class_resolver :id_diff_input, "Ecoportal::API::GraphQL::Input::IdDiff"
9
+ embeds_one :associatedPeopleIds, klass: :id_diff_input
10
+ embeds_one :leadContractorIds, klass: :id_diff_input
11
+ end
6
12
  end
7
13
  end
8
14
  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
@@ -14,7 +14,7 @@ module Ecoportal
14
14
 
15
15
  def basic_block(&block)
16
16
  payload_block = block || default_payload_block
17
- Proc.new {
17
+ proc {
18
18
  mutation(input: :ArchiveActionInput!) {
19
19
  archiveAction(input: :input, &payload_block)
20
20
  }
@@ -22,7 +22,7 @@ module Ecoportal
22
22
  end
23
23
 
24
24
  def default_payload_block
25
- Proc.new {
25
+ proc {
26
26
  clientMutationId
27
27
  errors {
28
28
  details
@@ -13,7 +13,7 @@ module Ecoportal
13
13
 
14
14
  def basic_block(&block)
15
15
  payload_block = block || default_payload_block
16
- Proc.new {
16
+ proc {
17
17
  mutation(input: :UpdateActionInput!) {
18
18
  updateAction(input: :input, &payload_block)
19
19
  }
@@ -21,7 +21,7 @@ module Ecoportal
21
21
  end
22
22
 
23
23
  def default_payload_block
24
- Proc.new {
24
+ proc {
25
25
  clientMutationId
26
26
  errors {
27
27
  details
@@ -7,13 +7,13 @@ module Ecoportal
7
7
  field_name :createContractorEntity
8
8
 
9
9
  class_resolver :payload_class, Ecoportal::API::GraphQL::Payload::ContractorEntity::Create
10
- class_resolver :input_class, Ecoportal::API::GraphQL::Model::ContractorEntity
10
+ class_resolver :input_class, Ecoportal::API::GraphQL::Input::ContractorEntity::Create
11
11
 
12
12
  private
13
13
 
14
14
  def basic_block(&block)
15
15
  payload_block = block || default_payload_block
16
- Proc.new {
16
+ proc {
17
17
  mutation(input: :CreateContractorEntityInput!) {
18
18
  createContractorEntity(input: :input, &payload_block)
19
19
  }
@@ -21,7 +21,7 @@ module Ecoportal
21
21
  end
22
22
 
23
23
  def default_payload_block
24
- Proc.new {
24
+ proc {
25
25
  clientMutationId
26
26
  errors {
27
27
  details
@@ -0,0 +1,40 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Mutation
5
+ module ContractorEntity
6
+ class Destroy < Ecoportal::API::GraphQL::Logic::Mutation
7
+ field_name :destroyContractorEntity
8
+
9
+ class_resolver :payload_class, Ecoportal::API::GraphQL::Payload::ContractorEntity::Destroy
10
+ class_resolver :input_class, Ecoportal::API::GraphQL::Input::ContractorEntity::Destroy
11
+
12
+ private
13
+
14
+ def basic_block(&block)
15
+ payload_block = block || default_payload_block
16
+ proc {
17
+ mutation(input: :DestroyContractorEntityInput!) {
18
+ destroyContractorEntity(input: :input, &payload_block)
19
+ }
20
+ }
21
+ end
22
+
23
+ def default_payload_block
24
+ proc {
25
+ clientMutationId
26
+ errors {
27
+ details
28
+ fullMessages
29
+ }
30
+ item {
31
+ ___Fragment__ContractorEntity
32
+ }
33
+ }
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -7,13 +7,13 @@ module Ecoportal
7
7
  field_name :updateContractorEntity
8
8
 
9
9
  class_resolver :payload_class, Ecoportal::API::GraphQL::Payload::ContractorEntity::Update
10
- class_resolver :input_class, Ecoportal::API::GraphQL::Model::ContractorEntity
10
+ class_resolver :input_class, Ecoportal::API::GraphQL::Input::ContractorEntity::Update
11
11
 
12
12
  private
13
13
 
14
14
  def basic_block(&block)
15
15
  payload_block = block || default_payload_block
16
- Proc.new {
16
+ proc {
17
17
  mutation(input: :UpdateContractorEntityInput!) {
18
18
  updateContractorEntity(input: :input, &payload_block)
19
19
  }
@@ -21,7 +21,7 @@ module Ecoportal
21
21
  end
22
22
 
23
23
  def default_payload_block
24
- Proc.new {
24
+ proc {
25
25
  clientMutationId
26
26
  errors {
27
27
  details
@@ -10,5 +10,5 @@ module Ecoportal
10
10
  end
11
11
 
12
12
  require_relative 'contractor_entity/create'
13
- # require_relative 'contractor_entity/destroy'
13
+ require_relative 'contractor_entity/destroy'
14
14
  require_relative 'contractor_entity/update'
@@ -12,7 +12,7 @@ module Ecoportal
12
12
 
13
13
  def basic_block(&block)
14
14
  action_block = block || default_block
15
- Proc.new {
15
+ proc {
16
16
  query(id: :id!) {
17
17
  currentOrganization {
18
18
  action(id: :id, &action_block)
@@ -22,7 +22,7 @@ module Ecoportal
22
22
  end
23
23
 
24
24
  def default_block
25
- Proc.new {
25
+ proc {
26
26
  ___Ecoportal__API__GraphQL__Fragment__Action
27
27
  }
28
28
  end
@@ -12,7 +12,7 @@ module Ecoportal
12
12
 
13
13
  def basic_block(&block)
14
14
  connection_block = block || default_connection_block
15
- Proc.new {
15
+ proc {
16
16
  query(searchConf: :Search, after: :string, before: :string, first: :int, last: :int) {
17
17
  currentOrganization {
18
18
  actions(
@@ -29,7 +29,7 @@ module Ecoportal
29
29
  end
30
30
 
31
31
  def default_connection_block
32
- Proc.new {
32
+ proc {
33
33
  ___Ecoportal__API__GraphQL__Fragment__Pagination
34
34
  nodes {
35
35
  ___Ecoportal__API__GraphQL__Fragment__Action
@@ -12,7 +12,7 @@ module Ecoportal
12
12
 
13
13
  def basic_block(&block)
14
14
  connection_block = block || default_connection_block
15
- Proc.new {
15
+ proc {
16
16
  query(searchConf: :Search, after: :string, before: :string, first: :int, last: :int) {
17
17
  currentOrganization {
18
18
  contractorEntities(
@@ -29,7 +29,7 @@ module Ecoportal
29
29
  end
30
30
 
31
31
  def default_connection_block
32
- Proc.new {
32
+ proc {
33
33
  totalCount
34
34
  pageInfo {
35
35
  endCursor
@@ -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.16'.freeze
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.16
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-05-06 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'
@@ -282,6 +282,7 @@ files:
282
282
  - lib/ecoportal/api/graphql/mutation/action/update.rb
283
283
  - lib/ecoportal/api/graphql/mutation/contractor_entity.rb
284
284
  - lib/ecoportal/api/graphql/mutation/contractor_entity/create.rb
285
+ - lib/ecoportal/api/graphql/mutation/contractor_entity/destroy.rb
285
286
  - lib/ecoportal/api/graphql/mutation/contractor_entity/update.rb
286
287
  - lib/ecoportal/api/graphql/mutation/location_structure.rb
287
288
  - lib/ecoportal/api/graphql/mutation/location_structure/apply_commands.rb
@@ -301,6 +302,7 @@ files:
301
302
  - lib/ecoportal/api/graphql/query/action.rb
302
303
  - lib/ecoportal/api/graphql/query/actions.rb
303
304
  - lib/ecoportal/api/graphql/query/contractor_entities.rb
305
+ - lib/ecoportal/api/graphql/query/location_classifications.rb
304
306
  - lib/ecoportal/api/graphql/query/location_structure.rb
305
307
  - lib/ecoportal/api/graphql/query/location_structures.rb
306
308
  - lib/ecoportal/api/graphql_version.rb