Sha256: 1e69c70bf405149a0862b1c68a228224aaef602254d375dbf66e9a13750ca1c9
Contents?: true
Size: 886 Bytes
Versions: 23
Compression:
Stored size: 886 Bytes
Contents
class Ey::Core::Client::Log < Ey::Core::Model extend Ey::Core::Associations identity :id attribute :created_at, type: :time attribute :filename attribute :mime_type attribute :download_url attribute :upload_url has_one :component_action attr_accessor :file, :component_action_id 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 def contents body = Faraday.get(download_url).body if filename.match(/\.gz$/) Zlib::GzipReader.new(StringIO.new(body, "rb")).read else body end end end
Version data entries
23 entries across 23 versions & 2 rubygems