ecoportal-api-graphql 0.3.9 → 0.3.11

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: b9ee1a2e7ea100fbb03bd2c617e771dafccf7bd443ded39285f230fb68790498
4
- data.tar.gz: 9139ed6d2a6adf21990beeb7ffea0ad9dd03a1b80ff924e50249ba904cfa979f
3
+ metadata.gz: c31b307b4e634acc84a797d2ea1183f791934519b5214962ea7d6a667860fbcf
4
+ data.tar.gz: a0eb29b51239c318861d7942b08eecfa1ab9ac2a6ee6e61cea6b5f9759231667
5
5
  SHA512:
6
- metadata.gz: 18c0055c77d55072ab9dfadb521e5a740fae4e79e3eed45148c248f887d5ae5ae8f85f2460e788e3529e9274859f76ae3125775a8fbee66de9daf1d4bfe0f242
7
- data.tar.gz: 0d8bb739aa1625bf87021160523d42fd885d1537239fbefa4edff0ce0cd2142ebd9488a4411703fba4cdd109bc0be3dc7d0c01f15927f83213e5701c9575e9c6
6
+ metadata.gz: 1688117838024607d34e53c19a07e92aa9eb16edd6e78ed92c65caa4c6f094efa50aa48d8909db7c5e99631d7377137ddeb4e1803d3955a3cc11f800f5ca0c30
7
+ data.tar.gz: 1b44a7ff1469a8548fc1f05f5b5b6fc496a81552a66eac17abe120b995381e87f7b4e2abd194f5ed2417a6d923372c2c5268c0703132e85dea07de371af72d18
data/CHANGELOG.md CHANGED
@@ -9,15 +9,29 @@ All notable changes to this project will be documented in this file.
9
9
  - review `path` tracking
10
10
 
11
11
 
12
- ## [0.3.9] - 2023-06-xx
12
+ ## [0.3.12] - 2023-09-xx
13
13
 
14
14
  ### Added
15
- - `Ecoportal::API::GraphQL::Logic::BaseQuery`
16
- - Added support for **default** values.
17
-
18
15
  ### Changed
19
16
  ### Fixed
20
17
 
18
+ ## [0.3.11] - 2023-09-19
19
+
20
+ ### Added
21
+ - Exposed `graphql` `ContractorEntity` `create` and `update`
22
+
23
+ ## [0.3.10] - 2023-08-12
24
+
25
+ ### Fixed
26
+ - `Ecopotal::API::GraphQL::Query::LocationStructure`
27
+ - `query` in basic_block missed an explicitly declared parameter.
28
+
29
+ ## [0.3.9] - 2023-08-03
30
+
31
+ ### Added
32
+ - `Ecoportal::API::GraphQL::Logic::BaseQuery`
33
+ - Added support for **default** values.
34
+
21
35
  ## [0.3.8] - 2023-07-18
22
36
 
23
37
  ### Added
@@ -0,0 +1,33 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Builder
5
+ class ContractorEntity
6
+ attr_reader :client
7
+
8
+ def initialize(client)
9
+ @client = client
10
+ end
11
+
12
+ def create(**kargs, &block)
13
+ createMutation.query(**kargs, &block)
14
+ end
15
+
16
+ def update(**kargs, &block)
17
+ updateMutation.query(**kargs, &block)
18
+ end
19
+
20
+ private
21
+
22
+ def createMutation
23
+ Ecoportal::API::GraphQL::Mutation::ContractorEntity::Create.new(client)
24
+ end
25
+
26
+ def updateMutation
27
+ Ecoportal::API::GraphQL::Mutation::ContractorEntity::Update.new(client)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -9,3 +9,4 @@ end
9
9
 
10
10
  require 'ecoportal/api/graphql/builder/location_structure'
11
11
  require 'ecoportal/api/graphql/builder/action'
12
+ require 'ecoportal/api/graphql/builder/contractor_entity'
@@ -23,7 +23,7 @@ module Ecoportal
23
23
  request(*path) do
24
24
  client.query(input: as_input(input), &basic_block(&block))
25
25
  end
26
- rescue Faraday::ParsingError => e
26
+ rescue Faraday::ParsingError, Graphlient::Errors::FaradayServerError => e
27
27
  puts "Internal Error with these input ('#{input.class}'):"
28
28
  pp input
29
29
  raise
@@ -0,0 +1,40 @@
1
+ module Ecoportal
2
+ module API
3
+ class GraphQL
4
+ module Mutation
5
+ module ContractorEntity
6
+ class Update < Ecoportal::API::GraphQL::Logic::Mutation
7
+ field_name :updateContractorEntity
8
+
9
+ class_resolver :payload_class, Ecoportal::API::GraphQL::Payload::ContractorEntity::Update
10
+ class_resolver :input_class, Ecoportal::API::GraphQL::Model::ContractorEntity
11
+
12
+ private
13
+
14
+ def basic_block(&block)
15
+ payload_block = block || default_payload_block
16
+ Proc.new {
17
+ mutation(input: :UpdateContractorEntityInput!) {
18
+ updateContractorEntity(input: :input, &payload_block)
19
+ }
20
+ }
21
+ end
22
+
23
+ def default_payload_block
24
+ Proc.new {
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
@@ -11,4 +11,4 @@ end
11
11
 
12
12
  require_relative 'contractor_entity/create'
13
13
  # require_relative 'contractor_entity/destroy'
14
- # require_relative 'contractor_entity/update'
14
+ require_relative 'contractor_entity/update'
@@ -15,7 +15,7 @@ module Ecoportal
15
15
  def basic_block(&block)
16
16
  final_block = block || default_query_block
17
17
  Proc.new {
18
- query(id: :id!) {
18
+ query(id: :id!, includeArchivedNodes: :boolean) {
19
19
  currentOrganization {
20
20
  locations {
21
21
  structure(id: :id, &final_block)
@@ -31,6 +31,10 @@ module Ecoportal
31
31
  createContractorEntityMutation.query(input: input, &block)
32
32
  end
33
33
 
34
+ def contractorEntity
35
+ Ecoportal::API::GraphQL::Builder::ContractorEntity.new(client)
36
+ end
37
+
34
38
  # Gives a builder to use different options to modify a reporting structure
35
39
  def locationStructure
36
40
  Ecoportal::API::GraphQL::Builder::LocationStructure.new(client)
@@ -1,5 +1,5 @@
1
1
  module Ecoportal
2
2
  module API
3
- GRAPQL_VERSION = "0.3.9"
3
+ GRAPQL_VERSION = "0.3.11"
4
4
  end
5
5
  end
@@ -0,0 +1,20 @@
1
+ require_relative 'local_libs'
2
+
3
+ api = Ecoportal::API::GraphQL.new
4
+ response = api.contractorEntity.update(input: {
5
+ id: "62b04d83fa9170001d3d303f",
6
+ name: "Caras Galathon",
7
+ active: true,
8
+ approved: true,
9
+ # associatedPeopleIds: [
10
+ # "5adfbef76fb80400047535b3"
11
+ # ],
12
+ leadContractorIds: {
13
+ additions: ["5adfbef76fb80400047535b3"]
14
+ },
15
+ clientMutationId: ""
16
+ })
17
+
18
+ if response.success? && entity = response.item
19
+ puts "Updated contractor entity '#{entity.name}' (approved? #{entity.approved})"
20
+ 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.9
4
+ version: 0.3.11
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-08-03 00:00:00.000000000 Z
11
+ date: 2023-09-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -216,6 +216,7 @@ files:
216
216
  - lib/ecoportal/api/graphql/base/resource.rb
217
217
  - lib/ecoportal/api/graphql/builder.rb
218
218
  - lib/ecoportal/api/graphql/builder/action.rb
219
+ - lib/ecoportal/api/graphql/builder/contractor_entity.rb
219
220
  - lib/ecoportal/api/graphql/builder/location_structure.rb
220
221
  - lib/ecoportal/api/graphql/connection.rb
221
222
  - lib/ecoportal/api/graphql/connection/action.rb
@@ -280,6 +281,7 @@ files:
280
281
  - lib/ecoportal/api/graphql/mutation/action/archive.rb
281
282
  - lib/ecoportal/api/graphql/mutation/contractor_entity.rb
282
283
  - lib/ecoportal/api/graphql/mutation/contractor_entity/create.rb
284
+ - lib/ecoportal/api/graphql/mutation/contractor_entity/update.rb
283
285
  - lib/ecoportal/api/graphql/mutation/location_structure.rb
284
286
  - lib/ecoportal/api/graphql/mutation/location_structure/apply_commands.rb
285
287
  - lib/ecoportal/api/graphql/payload.rb
@@ -302,6 +304,7 @@ files:
302
304
  - tests/actions_get.rb
303
305
  - tests/contractor_entities_get.rb
304
306
  - tests/contractor_entity_create.rb
307
+ - tests/contractor_entity_udpate.rb
305
308
  - tests/loc_structure_get.rb
306
309
  - tests/loc_structure_update.rb
307
310
  - tests/loc_structures_get.rb