class Ey::Core::Client::Log

Attributes

component_action_id[RW]
file[RW]

Public Instance Methods

contents() click to toggle source
# File lib/ey-core/models/log.rb, line 35
def contents
  body = Faraday.get(download_url).body
  if filename.match(/\.gz$/)
    Zlib::GzipReader.new(StringIO.new(body, "rb")).read
  else
    body
  end
end
save!() click to toggle source
# File lib/ey-core/models/log.rb, line 16
def save!
  if self.file.kind_of?(File)
    body = File.read(self.file)
  else
    body = self.file
  end

  params = {
    "component_action_id" => component_action_id,
    "log" => {
      "file"      => body,
      "filename"  => filename || "log",
      "mime_type" => mime_type,
    }
  }

  merge_attributes(self.connection.create_log(params).body["log"])
end