Class: DutwsFoo::ServicesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/dutws_foo/services_controller.rb

Instance Method Summary collapse

Instance Method Details

#workspaceObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/controllers/dutws_foo/services_controller.rb', line 3

def workspace
  parsed_json = JSON.parse(ActiveSupport::JSON.encode(params))
  if parsed_json['Message']

    operation = parsed_json['Message']['Body'].keys.first
    data = parsed_json['Message']['Body'][operation]
    logger.debug(data)

    @output = WebService.handle_request(parsed_json['Message'])
  else
    @output = {:error => 'Invalid Request Format'}
  end

  respond_to do |format|
    format.json { render :json => @output.to_json }
  end

end