Class: KakaxiParse::Timelapse

Inherits:
BaseModel show all
Defined in:
lib/kakaxi_parse/timelapse.rb

Constant Summary collapse

COLUMNS =
[:start_datetime, :end_datetime, :thumbnail_url, :url, :device_id]
@@belongs_to =
[KakaxiDevice]

Constants inherited from BaseModel

BaseModel::DEFUALT_LIMIT

Instance Attribute Summary

Attributes inherited from BaseModel

#created_at, #id, #name, #updated_at

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

all, #delete, demodulize, find, order, #save, #update

Constructor Details

#initialize(id: nil, name: nil, created_at: nil, updated_at: nil, start_datetime: nil, end_datetime: nil, thumbnail_url: nil, url: nil, device_id: nil) ⇒ Timelapse

Returns a new instance of Timelapse.



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/kakaxi_parse/timelapse.rb', line 8

def initialize(
  id: nil,
  name: nil,
  created_at: nil,
  updated_at: nil,
  start_datetime: nil,
  end_datetime: nil,
  thumbnail_url: nil,
  url: nil,
  device_id: nil
  )

  @start_datetime = DateTime.iso8601(start_datetime)
  @end_datetime   = DateTime.iso8601(end_datetime)
  @thumbnail_url  = thumbnail_url
  @url            = url
  @device_id      = device_id

  super(id, name, updated_at, created_at)
end

Class Method Details

.short_nameObject



33
34
35
# File 'lib/kakaxi_parse/timelapse.rb', line 33

def self.short_name
  'timelapse'
end

.where(hash, limit: DEFUALT_LIMIT) ⇒ Object



29
30
31
# File 'lib/kakaxi_parse/timelapse.rb', line 29

def self.where(hash, limit: DEFUALT_LIMIT)
  to_objects(super(self, hash, limit, @@belongs_to)) if valid_key?(hash)
end