Class: KakaxiParse::IntervalPhoto

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/kakaxi_parse/interval_photo.rb

Constant Summary collapse

@@belongs_to =
[KakaxiDevice]

Constants inherited from BaseModel

BaseModel::DEFUALT_LIMIT

Instance Attribute Summary collapse

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, url: nil, device_id: nil, taken_at: nil, updated_at: nil, created_at: nil) ⇒ IntervalPhoto

Returns a new instance of IntervalPhoto.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/kakaxi_parse/interval_photo.rb', line 14

def initialize(
      id: nil,
      name: nil,
      url: nil,
      device_id: nil,
      taken_at: nil,
      updated_at: nil,
      created_at: nil
    )
  @url = url
  @device_id = Datatype::Pointer.new(KakaxiDevice, device_id)
  @taken_at = DateTime.strptime(taken_at, '%Y-%m-%dT%H:%M:%S.%LZ')
  super(id, name, updated_at, created_at)
end

Instance Attribute Details

#device_idObject

Returns the value of attribute device_id.



11
12
13
# File 'lib/kakaxi_parse/interval_photo.rb', line 11

def device_id
  @device_id
end

#taken_atObject

Returns the value of attribute taken_at.



11
12
13
# File 'lib/kakaxi_parse/interval_photo.rb', line 11

def taken_at
  @taken_at
end

#urlObject

Returns the value of attribute url.



11
12
13
# File 'lib/kakaxi_parse/interval_photo.rb', line 11

def url
  @url
end

Class Method Details

.short_nameObject



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

def self.short_name
  'photo'
end

.where(hash, limit: DEFUALT_LIMIT) ⇒ Object



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

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