Class: Zenaton::Services::GraphQL::SendEventMutation

Inherits:
BaseOperation
  • Object
show all
Defined in:
lib/zenaton/services/graph_ql/send_event_mutation.rb

Overview

Mutation parameters for sending an Event to a Workflow

Instance Method Summary collapse

Methods inherited from BaseOperation

#intent_id, #query, #result

Constructor Details

#initialize(name, custom_id, event, app_env) ⇒ SendEventMutation

Returns a new instance of SendEventMutation.



10
11
12
13
14
15
16
# File 'lib/zenaton/services/graph_ql/send_event_mutation.rb', line 10

def initialize(name, custom_id, event, app_env)
  super
  @workflow_name = name
  @custom_id = custom_id
  @event = event
  @app_env = app_env
end

Instance Method Details

#bodyObject

The body of the GraphQL request



19
20
21
# File 'lib/zenaton/services/graph_ql/send_event_mutation.rb', line 19

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

#raw_queryObject

The query to be executed



24
25
26
27
28
29
30
31
32
33
34
# File 'lib/zenaton/services/graph_ql/send_event_mutation.rb', line 24

def raw_query
  <<~GQL
    mutation sendEventToWorkflowByNameAndCustomId($input: SendEventToWorkflowByNameAndCustomIdInput!) {
      sendEventToWorkflowByNameAndCustomId(input: $input) {
        event {
          intentId
        }
      }
    }
  GQL
end

#variablesObject

The variables used in the query



37
38
39
# File 'lib/zenaton/services/graph_ql/send_event_mutation.rb', line 37

def variables
  { 'input' => input }
end