Class: Rack::Newsstand::Issue

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/rack/newsstand/models/issue.rb

Instance Method Summary collapse

Instance Method Details

#to_plist_nodeObject



16
17
18
19
20
21
22
23
# File 'lib/rack/newsstand/models/issue.rb', line 16

def to_plist_node
  {
    name: self.name,
    date: self.published_at,
    covers: (self.cover_urls || {}).to_hash,
    assets: (self.asset_urls || []).to_a
  }.to_plist(false)
end

#validateObject



25
26
27
28
29
30
# File 'lib/rack/newsstand/models/issue.rb', line 25

def validate
  super

  validates_presence [:name, :published_at]
  validates_unique :name
end