Class: ActiveWorkflowAgent::ParsedRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/active_workflow_agent/parsed_request.rb

Overview

Helper class to parse the content of a request from the Agent API.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ ParsedRequest

Returns a new instance of ParsedRequest.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/active_workflow_agent/parsed_request.rb', line 8

def initialize(request)
  @method = request["method"].to_sym
  # Set to empty for 'register' method.
  @options = {}
  @memory = {}
  @credentials = []
  @message = {}

  if i[check receive].include? @method
    @options = request["params"]["options"]
    @memory = request["params"]["memory"]
    @credentials = request["params"]["credentials"]
  end
  @message = request["params"]["message"]["payload"] if @method == :receive
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



6
7
8
# File 'lib/active_workflow_agent/parsed_request.rb', line 6

def credentials
  @credentials
end

#memoryObject (readonly)

Returns the value of attribute memory.



6
7
8
# File 'lib/active_workflow_agent/parsed_request.rb', line 6

def memory
  @memory
end

#messageObject (readonly)

Returns the value of attribute message.



6
7
8
# File 'lib/active_workflow_agent/parsed_request.rb', line 6

def message
  @message
end

#methodObject (readonly)

Returns the value of attribute method.



6
7
8
# File 'lib/active_workflow_agent/parsed_request.rb', line 6

def method
  @method
end

#optionsObject (readonly)

Returns the value of attribute options.



6
7
8
# File 'lib/active_workflow_agent/parsed_request.rb', line 6

def options
  @options
end