class SalsaLabs::AuthenticationResponse
Public Class Methods
new(faraday_response)
click to toggle source
@param [Faraday::Response] faraday_response
# File lib/salsa_labs/authentication_response.rb, line 7 def initialize(faraday_response) @response = faraday_response end
Public Instance Methods
body()
click to toggle source
@return [Nokogiri::XML] the full xml returned by the API,
parsed by +Nokogiri+ (memoized)
# File lib/salsa_labs/authentication_response.rb, line 23 def body @body ||= ::Nokogiri::XML(@response.body) end
error_message()
click to toggle source
@return [String] the error message returned by the API @return [nil] if there was no error message returned by the API
# File lib/salsa_labs/authentication_response.rb, line 29 def error_message err = body.xpath('//data/error').text err == '' ? nil : err end
successful?()
click to toggle source
@return [Boolean] true if no error message was returned
# File lib/salsa_labs/authentication_response.rb, line 17 def successful? !error_message && session_cookie_exists? end