class Zenaton::Services::GraphQL::SendEventMutation

Mutation parameters for sending an Event to a Workflow

Public Class Methods

new(name, custom_id, event, app_env) click to toggle source
# 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

Public Instance Methods

body() click to toggle source

The body of the GraphQL request

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

The query to be executed

# 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
variables() click to toggle source

The variables used in the query

# File lib/zenaton/services/graph_ql/send_event_mutation.rb, line 37
def variables
  { 'input' => input }
end

Private Instance Methods

input() click to toggle source
# File lib/zenaton/services/graph_ql/send_event_mutation.rb, line 43
def input
  {
    'customId' => @custom_id,
    'workflowName' => @workflow_name,
    'name' => @event.class.name,
    'environmentName' => @app_env,
    'intentId' => intent_id,
    'programmingLanguage' => 'RUBY',
    'input' => @serializer.encode(@properties.from(@event)),
    'data' => @serializer.encode(@event)
  }
end