Class: Hivehook::Resources::TransformationService
- Inherits:
-
BaseService
- Object
- BaseService
- Hivehook::Resources::TransformationService
show all
- Defined in:
- lib/hivehook/resources/transformation_service.rb
Constant Summary
collapse
- FRAGMENT =
"id name description code enabled failOpen timeoutMs createdAt updatedAt"
Instance Method Summary
collapse
Methods inherited from BaseService
#initialize
Instance Method Details
#create(input) ⇒ Object
23
24
25
26
|
# File 'lib/hivehook/resources/transformation_service.rb', line 23
def create(input)
query = "mutation($input: CreateTransformationInput!) { createTransformation(input: $input) { #{FRAGMENT} } }"
@transport.execute(query, { "input" => input })["createTransformation"]
end
|
#delete(id) ⇒ Object
33
34
35
36
|
# File 'lib/hivehook/resources/transformation_service.rb', line 33
def delete(id)
query = "mutation($id: UUID!) { deleteTransformation(id: $id) }"
@transport.execute(query, { "id" => id })["deleteTransformation"]
end
|
#get(id) ⇒ Object
18
19
20
21
|
# File 'lib/hivehook/resources/transformation_service.rb', line 18
def get(id)
query = "query($id: UUID!) { transformation(id: $id) { #{FRAGMENT} } }"
@transport.execute(query, { "id" => id })["transformation"]
end
|
#list(options = {}) ⇒ Object
8
9
10
11
12
13
14
15
16
|
# File 'lib/hivehook/resources/transformation_service.rb', line 8
def list(options = {})
query = "query($enabled: Boolean, $search: String, $limit: Int, $offset: Int, $after: String, $first: Int) {
transformations(enabled: $enabled, search: $search, limit: $limit, offset: $offset, after: $after, first: $first) {
nodes { #{FRAGMENT} }
pageInfo { total limit offset endCursor hasNextPage }
}
}"
@transport.execute(query, build_variables(options, %w[enabled search limit offset after first]))["transformations"]
end
|
#test(input) ⇒ Object
38
39
40
41
|
# File 'lib/hivehook/resources/transformation_service.rb', line 38
def test(input)
query = "mutation($input: TestTransformationInput!) { testTransformation(input: $input) { success output error durationMs } }"
@transport.execute(query, { "input" => input })["testTransformation"]
end
|
#update(id, input) ⇒ Object
28
29
30
31
|
# File 'lib/hivehook/resources/transformation_service.rb', line 28
def update(id, input)
query = "mutation($id: UUID!, $input: UpdateTransformationInput!) { updateTransformation(id: $id, input: $input) { #{FRAGMENT} } }"
@transport.execute(query, { "id" => id, "input" => input })["updateTransformation"]
end
|