Class: Geostats::Log
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Geostats::Log
- Defined in:
- lib/geostats/models/log.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.create_from_website(uuid) ⇒ Object
8 9 10 11 12 |
# File 'lib/geostats/models/log.rb', line 8 def self.create_from_website(uuid) log = Log.new(:uuid => uuid) log.update_from_website log end |
Instance Method Details
#set_type_from_icon(icon) ⇒ Object
27 28 29 30 31 |
# File 'lib/geostats/models/log.rb', line 27 def set_type_from_icon(icon) if icon and index = LogType::ICON_MAPPING.index(icon) self.log_type = LogType.where(:id => index + 1).first end end |
#update_from_website ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/geostats/models/log.rb', line 14 def update_from_website info = Grabber::Log.new(self.uuid) [:logged_at, :message].each do |attribute| if value = info.send(attribute) self.attributes = { attribute => value } end end set_type_from_icon(info.icon) self.synced_at = Time.now end |