class Zenaton::Services::GraphQL::CreateTaskScheduleMutation

Mutation parameters for scheduling a Task

Public Class Methods

new(task, cron, app_env) click to toggle source
# File lib/zenaton/services/graph_ql/create_task_schedule_mutation.rb, line 10
def initialize(task, cron, app_env)
  super
  @task = task
  @cron = cron
  @app_env = app_env
end

Public Instance Methods

body() click to toggle source

The body of the GraphQL request

# File lib/zenaton/services/graph_ql/create_task_schedule_mutation.rb, line 18
def body
  { 'query' => query, 'variables' => variables }
end
raw_query() click to toggle source

The query to be executed

# File lib/zenaton/services/graph_ql/create_task_schedule_mutation.rb, line 23
        def raw_query
          <<~GQL
            mutation ($input: CreateTaskScheduleInput!) {
              createTaskSchedule(input: $input) {
                schedule {
                  id
                }
              }
            }
          GQL
        end
variables() click to toggle source

The variables used in the query

# File lib/zenaton/services/graph_ql/create_task_schedule_mutation.rb, line 36
def variables
  {
    'input' => {
      'intentId' => intent_id,
      'environmentName' => @app_env,
      'cron' => @cron,
      'taskName' => @task.class.name,
      'programmingLanguage' => 'RUBY',
      'properties' => @serializer.encode(@properties.from(@task))
    }
  }
end