class KayakoClient::TroubleshooterAttachment

Public Instance Methods

contents() click to toggle source
# File lib/kayako_client/troubleshooter_attachment.rb, line 43
def contents
    if instance_variable_defined?(:@contents)
        instance_variable_get(:@contents)
    else
        if !new? && id && id > 0
            if troubleshooter_step_id.nil? && !link.nil? && link.match(%r{/[0-9]+/([0-9]+)/([0-9]+)/?$}) && $2.to_i == id
                troubleshooter_step_id = $1.to_i
            end
            if troubleshooter_step_id && troubleshooter_step_id > 0
                logger.debug "contents are missing - trying to reload" if logger
                if reload!(:e => "#{self.class.path}/#{troubleshooter_step_id.to_i}/#{id.to_i}") && instance_variable_defined?(:@contents)
                    instance_variable_get(:@contents)
                else
                    instance_variable_set(:@contents, nil)
                end
            else
                nil
            end
        else
            nil
        end
    end
end