Class: Zenaton::Services::GraphQL::CreateWorkflowScheduleMutation

Inherits:
BaseOperation
  • Object
show all
Includes:
Concerns::Workflow
Defined in:
lib/zenaton/services/graph_ql/create_workflow_schedule_mutation.rb

Overview

Mutation parameters for scheduling a Task

Constant Summary

Constants included from Concerns::Workflow

Concerns::Workflow::MAX_ID_SIZE

Instance Method Summary collapse

Methods inherited from BaseOperation

#intent_id, #query, #result

Constructor Details

#initialize(workflow, cron, app_env) ⇒ CreateWorkflowScheduleMutation

Returns a new instance of CreateWorkflowScheduleMutation.

Raises:



14
15
16
17
18
19
20
# File 'lib/zenaton/services/graph_ql/create_workflow_schedule_mutation.rb', line 14

def initialize(workflow, cron, app_env)
  super
  @workflow = workflow
  @cron = cron
  @app_env = app_env
  validate_custom_id
end

Instance Method Details

#bodyObject

The body of the GraphQL request



23
24
25
# File 'lib/zenaton/services/graph_ql/create_workflow_schedule_mutation.rb', line 23

def body
  { 'query' => query, 'variables' => variables }
end

#raw_queryObject

The query to be executed



28
29
30
31
32
33
34
35
36
37
38
# File 'lib/zenaton/services/graph_ql/create_workflow_schedule_mutation.rb', line 28

def raw_query
  <<~GQL
    mutation ($input: CreateWorkflowScheduleInput!) {
      createWorkflowSchedule(input: $input) {
        schedule {
          id
        }
      }
    }
  GQL
end

#variablesObject

The variables used in the query



41
42
43
# File 'lib/zenaton/services/graph_ql/create_workflow_schedule_mutation.rb', line 41

def variables
  { 'input' => input }
end