Sha256: 8b5e9d2ab8f9904fa393f4da5ad5d5f0fc832b5340069e36801c80d4dc55c4d7

Contents?: true

Size: 722 Bytes

Versions: 4

Compression:

Stored size: 722 Bytes

Contents

class Hooloo::Show < Hooloo::MozartHash
  def self.popular_today(args={limit: 10, position: 0})
    args.merge!({sort: 'popular_today'})
    Hooloo.request('shows', args)['data'].map { |x| new x['show'] }
  end
  def initialize(id)
    super
    if id.is_a? Fixnum
      @obj = Hooloo.request("shows/#{id}")['data'][0]['show']
    elsif id.is_a? Hash
      @obj = id
    end
  end
  def videos(season=1)
    Hooloo.request("shows/#{id}/episodes", {
      items_per_page: 128,
      season_number: season
    })['data'].map { |x| Hooloo::Video.new x['video'] }
  end
  bool :embed_permitted, :has_captions
  date :cache_time
  cast Hooloo::Company, :company
  cast Hooloo::Rollup, {rollups: :show_rollups}, {map: true}
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hooloo-0.2.1 lib/hooloo/show.rb
hooloo-0.2.0 lib/hooloo/show.rb
hooloo-0.1.1 lib/hooloo/show.rb
hooloo-0.1.0 lib/hooloo/show.rb