Class: Markety::Response::ResponseFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/markety/response/response_factory.rb

Overview

Factory that creates the appropriate Response object depending on the command type

Class Method Summary collapse

Class Method Details

.create_response(cmd_type, savon_response) ⇒ Object

Create the appropriate Response object depending on the command type



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/markety/response/response_factory.rb', line 12

def self.create_response(cmd_type,savon_response)
  case cmd_type
    when :get_lead
      GetLeadResponse.new(savon_response)
    when :sync_lead
      SyncLeadResponse.new(savon_response)
    when :list_operation
      ListOperationResponse.new(savon_response)
    when :get_custom_objects
      GetCustomObjectResponse.new(savon_response)
    when :sync_custom_objects
      SyncCustomObjectResponse.new(savon_response)
    else
      GenericResponse.new(cmd_type,savon_response)
  end
end