lib/travis/client/artifact.rb in travis-1.6.15.travis.558.6 vs lib/travis/client/artifact.rb in travis-1.6.15.travis.559.6

- old
+ new

@@ -11,10 +11,19 @@ attributes :job_id, :type, :body # @!parse attr_reader :job has :job + def delete_body(reason = {}) + reason = { reason: reason } unless reason.is_a? Hash + session.patch_raw("jobs/#{job_id}/log", reason) + reload + rescue Travis::Client::Error => error + raise unless error.message == '409' + self + end + def encoded_body Tools::SafeString.encoded(body) end def colorized_body @@ -26,10 +35,14 @@ end def current_body attributes['current_body'] ||= begin body = load_attribute('body') - body.to_s.empty? ? session.get_raw("jobs/#{job_id}/log") : body + if body.to_s.empty? + log = session.get_raw("jobs/#{job_id}/log") + body = String === log ? log : log['log']['body'] + end + body end end def body(stream = block_given?) return current_body unless block_given? or stream