ecoportal-api-graphql 0.3.10 → 0.3.11

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: b5e8efdf475cb3aeaf0ab102675bbfc20ebae438fccbf05d07f5d650deffbd3e
4
- data.tar.gz: a46e510f42b77e8b83739b66ef4e6a563c4251835c3aa843d9a4623fa80e3b56
3
+ metadata.gz: c31b307b4e634acc84a797d2ea1183f791934519b5214962ea7d6a667860fbcf
4
+ data.tar.gz: a0eb29b51239c318861d7942b08eecfa1ab9ac2a6ee6e61cea6b5f9759231667
5
5
  SHA512:
6
- metadata.gz: 70936ba8c2442dd8250565c9fc73be01403ed3f043cb8ec9c0058576ab48f557132145a55bb71b8a1be53c1818e8b9ced8e1cb2739e73edb785ba3af8c8ee7c5
7
- data.tar.gz: e9708d5c7cf2e5366dd426e0cab18b6811241da023b471f93887f3cda41300ee7bd2115427d62441e7b95c8a8321b528e213014a8bcfa8cfcf69171ce8fc95d7
6
+ metadata.gz: 1688117838024607d34e53c19a07e92aa9eb16edd6e78ed92c65caa4c6f094efa50aa48d8909db7c5e99631d7377137ddeb4e1803d3955a3cc11f800f5ca0c30
7
+ data.tar.gz: 1b44a7ff1469a8548fc1f05f5b5b6fc496a81552a66eac17abe120b995381e87f7b4e2abd194f5ed2417a6d923372c2c5268c0703132e85dea07de371af72d18
data/CHANGELOG.md CHANGED
@@ -9,12 +9,17 @@ All notable changes to this project will be documented in this file.
9
9
  - review `path` tracking
10
10
 
11
11
 
12
- ## [0.3.11] - 2023-08-xx
12
+ ## [0.3.12] - 2023-09-xx
13
13
 
14
14
  ### Added
15
15
  ### Changed
16
16
  ### Fixed
17
17
 
18
+ ## [0.3.11] - 2023-09-19
19
+
20
+ ### Added
21
+ - Exposed `graphql` `ContractorEntity` `create` and `update`
22
+
18
23
  ## [0.3.10] - 2023-08-12
19
24
 
20
25
  ### Fixed
@@ -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'
@@ -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.10"
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.10
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-12 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