Class: Iknow::User::Study::Result

Inherits:
Base
  • Object
show all
Defined in:
lib/iknow/model/user.rb

Constant Summary collapse

ATTRIBUTES =
[:timestamp, :seconds, :totals, :seen, :completed, :date]

Instance Method Summary collapse

Methods inherited from Base

attributes, #attributes, deserialize, #deserialize

Constructor Details

#initialize(params = {}) ⇒ Result

Returns a new instance of Result.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/iknow/model/user.rb', line 29

def initialize(params = {})
  @timestamp = (params[:timestamp].to_i   rescue nil)
  @seconds   = (params[:seconds].to_i     rescue nil)
  @totals    = {
    :seconds   => (params[:totals][:seconds].to_i   rescue nil),
    :seen      => (params[:totals][:seen].to_i      rescue nil),
    :completed => (params[:totals][:completed].to_i rescue nil)
  }
  @seen      = (params[:seen].to_i        rescue nil)
  @completed = (params[:completed].to_i   rescue nil)
  @date      = (Date.parse(params[:date]) rescue nil)
end