ecoportal-api-graphql 0.3.10 → 0.3.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +14 -1
- data/lib/ecoportal/api/graphql/base/action.rb +4 -0
- data/lib/ecoportal/api/graphql/builder/action.rb +8 -0
- data/lib/ecoportal/api/graphql/builder/contractor_entity.rb +33 -0
- data/lib/ecoportal/api/graphql/builder.rb +1 -0
- data/lib/ecoportal/api/graphql/fragment/action.rb +1 -0
- data/lib/ecoportal/api/graphql/input/action/update.rb +14 -0
- data/lib/ecoportal/api/graphql/input/action.rb +1 -0
- data/lib/ecoportal/api/graphql/logic/base_query.rb +2 -2
- data/lib/ecoportal/api/graphql/logic/mutation.rb +1 -1
- data/lib/ecoportal/api/graphql/model/action.rb +2 -1
- data/lib/ecoportal/api/graphql/model/organization.rb +1 -0
- data/lib/ecoportal/api/graphql/mutation/action/update.rb +40 -0
- data/lib/ecoportal/api/graphql/mutation/action.rb +1 -0
- data/lib/ecoportal/api/graphql/mutation/contractor_entity/update.rb +40 -0
- data/lib/ecoportal/api/graphql/mutation/contractor_entity.rb +1 -1
- data/lib/ecoportal/api/graphql/payload/action/update.rb +13 -0
- data/lib/ecoportal/api/graphql/payload/action.rb +1 -0
- data/lib/ecoportal/api/graphql/query/action.rb +33 -0
- data/lib/ecoportal/api/graphql/query.rb +1 -0
- data/lib/ecoportal/api/graphql.rb +4 -0
- data/lib/ecoportal/api/graphql_version.rb +1 -1
- data/tests/contractor_entity_udpate.rb +20 -0
- metadata +9 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b12afa3ea1f58d4473aa457bfb151284e2d4dcf1d5204c4fa659582a7232866
|
4
|
+
data.tar.gz: 62e2fd87c77816df9e4cb34c8f73c11fb07fd6099efa745c156544547671f89a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c7fa3eea6fa7122aa8109f6937a7de14142894a076f8b2a5f12836a3648e096a8d736ea766fb88d569d0cd34ecaad7844a3d516a37552f140be59eb63127e18
|
7
|
+
data.tar.gz: cebe218279a8a77a10af2cc21edddb7da52b68fb0c64c5529e3dc659eb5f44db32b4ed3973d4619d8689a190aa63a19ee7b5bbdf64fa4bfa81fe9336f5514d83
|
data/CHANGELOG.md
CHANGED
@@ -9,12 +9,25 @@ All notable changes to this project will be documented in this file.
|
|
9
9
|
- review `path` tracking
|
10
10
|
|
11
11
|
|
12
|
-
## [0.3.
|
12
|
+
## [0.3.12] - 2023-09-xx
|
13
13
|
|
14
14
|
### Added
|
15
15
|
### Changed
|
16
16
|
### Fixed
|
17
17
|
|
18
|
+
## [0.3.12] - 2024-01-27
|
19
|
+
|
20
|
+
### Added
|
21
|
+
- Exposed `graphql` `Action` `update` and get a single `action`
|
22
|
+
|
23
|
+
### Changed
|
24
|
+
### Fixed
|
25
|
+
|
26
|
+
## [0.3.11] - 2023-09-19
|
27
|
+
|
28
|
+
### Added
|
29
|
+
- Exposed `graphql` `ContractorEntity` `create` and `update`
|
30
|
+
|
18
31
|
## [0.3.10] - 2023-08-12
|
19
32
|
|
20
33
|
### Fixed
|
@@ -30,6 +30,10 @@ module Ecoportal
|
|
30
30
|
embeds_one :openededAt, klass: Base::DateTime
|
31
31
|
embeds_one :closedAt, klass: Base::DateTime
|
32
32
|
embeds_one :dueOrClosedDate, klass: Base::DateTime
|
33
|
+
|
34
|
+
passboolean :completed
|
35
|
+
passthrough :closeDetail
|
36
|
+
#passthrough :dueIn # only for templates
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
@@ -13,11 +13,19 @@ module Ecoportal
|
|
13
13
|
archiveMutation.query(**kargs, &block)
|
14
14
|
end
|
15
15
|
|
16
|
+
def update(**kargs, &block)
|
17
|
+
updateMutation.query(**kargs, &block)
|
18
|
+
end
|
19
|
+
|
16
20
|
private
|
17
21
|
|
18
22
|
def archiveMutation
|
19
23
|
Ecoportal::API::GraphQL::Mutation::Action::Archive.new(client)
|
20
24
|
end
|
25
|
+
|
26
|
+
def updateMutation
|
27
|
+
Ecoportal::API::GraphQL::Mutation::Action::Update.new(client)
|
28
|
+
end
|
21
29
|
end
|
22
30
|
end
|
23
31
|
end
|
@@ -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
|
@@ -78,11 +78,11 @@ module Ecoportal
|
|
78
78
|
raise "This method should be implemented in the child class #{self.class}"
|
79
79
|
end
|
80
80
|
|
81
|
-
def graphql_query(path: self.path, **kargs, &block)
|
81
|
+
def graphql_query(path: self.path, raw_response: {}, **kargs, &block)
|
82
82
|
default_params = self.class.param_defaults.dup
|
83
83
|
query_params = self.class.slice_params(default_params.merge(kargs))
|
84
84
|
request(*path) do
|
85
|
-
client.query(query_params, &block)
|
85
|
+
raw_response[:data] = client.query(query_params, &block)
|
86
86
|
end
|
87
87
|
rescue Faraday::ParsingError, Graphlient::Errors::GraphQLError => e
|
88
88
|
puts "Internal Error with these params:"
|
@@ -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
|
@@ -12,7 +12,8 @@ module Ecoportal
|
|
12
12
|
embeds_one :completer, klass: Model::PersonMember
|
13
13
|
embeds_many :fileContainers, klass: Model::FileContainer
|
14
14
|
embeds_many :linkedResources, klass: Model::Resource
|
15
|
-
#embeds_many :activities, klass: GraphQL::
|
15
|
+
#embeds_many :activities, klass: GraphQL::Model::Action::Activity
|
16
|
+
#embeds_one :recurrence, klass: GraphQL::Model::Action::Recurrence
|
16
17
|
end
|
17
18
|
end
|
18
19
|
end
|
@@ -16,6 +16,7 @@ module Ecoportal
|
|
16
16
|
query :locationStructures, subpath: "locations", query_klass: "Ecoportal::API::GraphQL::Query::LocationStructures"
|
17
17
|
query :contractorEntities, query_klass: "Ecoportal::API::GraphQL::Query::ContractorEntities"
|
18
18
|
#contractorEntity,
|
19
|
+
query :action, query_klass: "Ecoportal::API::GraphQL::Query::Action"
|
19
20
|
query :actions, query_klass: "Ecoportal::API::GraphQL::Query::Actions"
|
20
21
|
query :archiveAction, query_klass: "Ecoportal::API::GraphQL::Mutation::Action::Archive"
|
21
22
|
#action, actionsByPage, actionsCounter
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Mutation
|
5
|
+
module Action
|
6
|
+
class Update < Ecoportal::API::GraphQL::Logic::Mutation
|
7
|
+
field_name :updateAction
|
8
|
+
|
9
|
+
class_resolver :payload_class, Ecoportal::API::GraphQL::Payload::Action::Update
|
10
|
+
class_resolver :input_class, Ecoportal::API::GraphQL::Input::Action::Update
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def basic_block(&block)
|
15
|
+
payload_block = block || default_payload_block
|
16
|
+
Proc.new {
|
17
|
+
mutation(input: :UpdateActionInput!) {
|
18
|
+
updateAction(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__Action
|
32
|
+
}
|
33
|
+
}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -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
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Ecoportal
|
2
|
+
module API
|
3
|
+
class GraphQL
|
4
|
+
module Query
|
5
|
+
class Action < Ecoportal::API::GraphQL::Logic::Query
|
6
|
+
field_name :action
|
7
|
+
|
8
|
+
accepted_params :id
|
9
|
+
class_resolver :item_class, Ecoportal::API::GraphQL::Model::Action
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def basic_block(&block)
|
14
|
+
action_block = block || default_block
|
15
|
+
Proc.new {
|
16
|
+
query(id: :id!) {
|
17
|
+
currentOrganization {
|
18
|
+
action(id: :id, &action_block)
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
def default_block
|
25
|
+
Proc.new {
|
26
|
+
___Ecoportal__API__GraphQL__Fragment__Action
|
27
|
+
}
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -9,5 +9,6 @@ end
|
|
9
9
|
|
10
10
|
require 'ecoportal/api/graphql/query/location_structure'
|
11
11
|
require 'ecoportal/api/graphql/query/location_structures'
|
12
|
+
require 'ecoportal/api/graphql/query/action'
|
12
13
|
require 'ecoportal/api/graphql/query/actions'
|
13
14
|
require 'ecoportal/api/graphql/query/contractor_entities'
|
@@ -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)
|
@@ -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.
|
4
|
+
version: 0.3.12
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oscar Segura
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-01-26 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
|
@@ -235,6 +236,7 @@ files:
|
|
235
236
|
- lib/ecoportal/api/graphql/input.rb
|
236
237
|
- lib/ecoportal/api/graphql/input/action.rb
|
237
238
|
- lib/ecoportal/api/graphql/input/action/archive.rb
|
239
|
+
- lib/ecoportal/api/graphql/input/action/update.rb
|
238
240
|
- lib/ecoportal/api/graphql/input/contractor_entity.rb
|
239
241
|
- lib/ecoportal/api/graphql/input/contractor_entity/create.rb
|
240
242
|
- lib/ecoportal/api/graphql/input/contractor_entity/destroy.rb
|
@@ -278,13 +280,16 @@ files:
|
|
278
280
|
- lib/ecoportal/api/graphql/mutation.rb
|
279
281
|
- lib/ecoportal/api/graphql/mutation/action.rb
|
280
282
|
- lib/ecoportal/api/graphql/mutation/action/archive.rb
|
283
|
+
- lib/ecoportal/api/graphql/mutation/action/update.rb
|
281
284
|
- lib/ecoportal/api/graphql/mutation/contractor_entity.rb
|
282
285
|
- lib/ecoportal/api/graphql/mutation/contractor_entity/create.rb
|
286
|
+
- lib/ecoportal/api/graphql/mutation/contractor_entity/update.rb
|
283
287
|
- lib/ecoportal/api/graphql/mutation/location_structure.rb
|
284
288
|
- lib/ecoportal/api/graphql/mutation/location_structure/apply_commands.rb
|
285
289
|
- lib/ecoportal/api/graphql/payload.rb
|
286
290
|
- lib/ecoportal/api/graphql/payload/action.rb
|
287
291
|
- lib/ecoportal/api/graphql/payload/action/archive.rb
|
292
|
+
- lib/ecoportal/api/graphql/payload/action/update.rb
|
288
293
|
- lib/ecoportal/api/graphql/payload/contractor_entity.rb
|
289
294
|
- lib/ecoportal/api/graphql/payload/contractor_entity/create.rb
|
290
295
|
- lib/ecoportal/api/graphql/payload/contractor_entity/destroy.rb
|
@@ -294,6 +299,7 @@ files:
|
|
294
299
|
- lib/ecoportal/api/graphql/payload/location_structure/command_execution_result.rb
|
295
300
|
- lib/ecoportal/api/graphql/payload/location_structure/command_interface.rb
|
296
301
|
- lib/ecoportal/api/graphql/query.rb
|
302
|
+
- lib/ecoportal/api/graphql/query/action.rb
|
297
303
|
- lib/ecoportal/api/graphql/query/actions.rb
|
298
304
|
- lib/ecoportal/api/graphql/query/contractor_entities.rb
|
299
305
|
- lib/ecoportal/api/graphql/query/location_structure.rb
|
@@ -302,6 +308,7 @@ files:
|
|
302
308
|
- tests/actions_get.rb
|
303
309
|
- tests/contractor_entities_get.rb
|
304
310
|
- tests/contractor_entity_create.rb
|
311
|
+
- tests/contractor_entity_udpate.rb
|
305
312
|
- tests/loc_structure_get.rb
|
306
313
|
- tests/loc_structure_update.rb
|
307
314
|
- tests/loc_structures_get.rb
|