Class: Ey::Core::Client::Log
- Extended by:
- Associations
- Defined in:
- lib/ey-core/models/log.rb
Instance Attribute Summary collapse
-
#component_action_id ⇒ Object
Returns the value of attribute component_action_id.
-
#file ⇒ Object
Returns the value of attribute file.
Instance Method Summary collapse
Methods included from Associations
assoc_accessor, assoc_coverage, assoc_reader, assoc_writer, associations, collection_reader
Methods inherited from Model
#destroy, range_parser, #save, #to_s, #update!, #url
Instance Attribute Details
#component_action_id ⇒ Object
Returns the value of attribute component_action_id.
14 15 16 |
# File 'lib/ey-core/models/log.rb', line 14 def component_action_id @component_action_id end |
#file ⇒ Object
Returns the value of attribute file.
14 15 16 |
# File 'lib/ey-core/models/log.rb', line 14 def file @file end |
Instance Method Details
#contents ⇒ Object
35 36 37 38 39 40 41 42 |
# 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! ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# 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 |