class ExpertSenderApi::Result
Attributes
error_code[R]
error_message[R]
parsed_response[R]
response[R]
Public Class Methods
new(response)
click to toggle source
# File lib/expertsender_api/result.rb, line 5 def initialize(response) @response = response if (@response.body) @parsed_response = Nokogiri::XML(@response.body) if @parsed_response.xpath('//ErrorMessage').any? @error_message = @parsed_response.xpath('//ErrorMessage/Message').text @error_code = @parsed_response.xpath('//ErrorMessage/Code').text end end freeze end
Public Instance Methods
failed?()
click to toggle source
# File lib/expertsender_api/result.rb, line 26 def failed? not success? end
status_success?()
click to toggle source
# File lib/expertsender_api/result.rb, line 30 def status_success? response.code == 200 or response.code == 201 or response.code == 202 end
success?()
click to toggle source
# File lib/expertsender_api/result.rb, line 20 def success? status_success? and error_code.nil? and error_message.nil? end