class SalsaLabs::SaveResponse
Public Class Methods
new(xml)
click to toggle source
@param [String] an xml string of the response body
# File lib/salsa_labs/save_response.rb, line 4 def initialize(xml) @doc = Nokogiri::XML(xml) raise APIResponseError, 'Save request failed' unless successful? end
Public Instance Methods
key()
click to toggle source
@return [String] the key of the object that was saved
# File lib/salsa_labs/save_response.rb, line 15 def key @doc.xpath('/success').attr('key').to_s end
successful?()
click to toggle source
@return [Boolean] true if request was successful
# File lib/salsa_labs/save_response.rb, line 10 def successful? success_object? && key_returned? end
Private Instance Methods
key_returned?()
click to toggle source
# File lib/salsa_labs/save_response.rb, line 25 def key_returned? !key.blank? end
success_object?()
click to toggle source
# File lib/salsa_labs/save_response.rb, line 21 def success_object? @doc.xpath('/success').length > 0 end