Module: PigMediaServer::API

Extended by:
ActiveSupport::Concern
Included in:
Web
Defined in:
lib/pig-media-server/api.rb

Instance Method Summary collapse

Instance Method Details

#list_to_json(list) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/pig-media-server/api.rb', line 14

def list_to_json list
  list.map{|x|
    hash = x.to_hash
    hash['custom_links'] = partial :_custom_links, locals: {record: x}
    hash['metadata'] = !!x. and x. != ''
    hash['srt'] = !!x. and x. != ''
    hash
  }.to_json
end

#pageObject



6
7
8
# File 'lib/pig-media-server/api.rb', line 6

def page
  params[:page].to_i < 1 ? 1 : params[:page].to_i
end

#sizeObject



10
11
12
# File 'lib/pig-media-server/api.rb', line 10

def size
  params[:size] ? params[:size].to_i : 50
end