class Markety::Response::GenericResponse
Parent class for all response types.
SOAP requests sent by Markety
result in either a Savon::Response
or a Savon::SOAPFault
. This class hides those boring details from you, unless you want to use its methods to see them.
Attributes
error_message[R]
if the response is a Savon::SOAPFault
, this is its error message
Public Class Methods
new(cmd_type,response)
click to toggle source
-
cmd_type
- a symbol -
response
- aSavon::Response
or aSavon::SOAPFault
# File lib/markety/response/generic_response.rb, line 16 def initialize(cmd_type,response) @response = response @success = response.is_a? Savon::Response @error_message = @success ? nil : response.to_s end
Public Instance Methods
success?()
click to toggle source
True if Marketo's response indicates that the SOAP request was successful.
Note: This is not the same as the a result from a Marketo command itself! To see the command's result, consult the command-specific Response
class.
# File lib/markety/response/generic_response.rb, line 28 def success? @success end
to_hash()
click to toggle source
The underlying Savon::Response
or Savon::SOAPFault
's content as a hash
# File lib/markety/response/generic_response.rb, line 40 def to_hash @response.to_hash end
to_xml()
click to toggle source
Return the xml from the underlying Savon::Response
or Savon::SOAPFault
# File lib/markety/response/generic_response.rb, line 34 def to_xml @success ? @response.to_xml : @response.http.raw_body end