Class: Zenaton::Services::GraphQL::DispatchTaskMutation
- Inherits:
-
BaseOperation
- Object
- BaseOperation
- Zenaton::Services::GraphQL::DispatchTaskMutation
- Defined in:
- lib/zenaton/services/graph_ql/dispatch_task_mutation.rb
Overview
Mutation parameters for executing a single task
Instance Method Summary collapse
-
#body ⇒ Object
The body of the GraphQL request.
-
#initialize(task, app_env) ⇒ DispatchTaskMutation
constructor
A new instance of DispatchTaskMutation.
-
#raw_query ⇒ Object
The query to be executed.
-
#variables ⇒ Object
The variables used in the query.
Methods inherited from BaseOperation
Constructor Details
#initialize(task, app_env) ⇒ DispatchTaskMutation
Returns a new instance of DispatchTaskMutation.
10 11 12 13 14 |
# File 'lib/zenaton/services/graph_ql/dispatch_task_mutation.rb', line 10 def initialize(task, app_env) super @task = task @app_env = app_env end |
Instance Method Details
#body ⇒ Object
The body of the GraphQL request
17 18 19 |
# File 'lib/zenaton/services/graph_ql/dispatch_task_mutation.rb', line 17 def body { 'query' => query, 'variables' => variables } end |
#raw_query ⇒ Object
The query to be executed
22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/zenaton/services/graph_ql/dispatch_task_mutation.rb', line 22 def raw_query <<~GQL mutation dispatchTask($input: DispatchTaskInput!) { dispatchTask(input: $input) { task { intentId } } } GQL end |
#variables ⇒ Object
The variables used in the query
35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/zenaton/services/graph_ql/dispatch_task_mutation.rb', line 35 def variables { 'input' => { 'environmentName' => @app_env, 'intentId' => intent_id, 'name' => @task.class.name, 'maxProcessingTime' => @task.try(:max_processing_time), 'programmingLanguage' => 'RUBY', 'data' => @serializer.encode(@properties.from(@task)) } } end |