Sha256: 9bb21cbbc2fc27ced02b681f2827e0764f5e168f20e4a0b8a896dc1b42986f8c

Contents?: true

Size: 731 Bytes

Versions: 2

Compression:

Stored size: 731 Bytes

Contents

class Hooloo::Show < Hooloo::MozartHash
  def self.popular_today(args={})
    Hooloo.paginated_request('shows', {
      sort: 'popular_today'
    }.merge(args), 30) { |g, x| g << Hooloo::Show.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, args={})
    Hooloo.paginated_request("shows/#{id}/episodes", {
      season_number: season
    }.merge(args), 30) { |g, x| g << 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

2 entries across 2 versions & 1 rubygems

Version Path
hooloo-0.3.2 lib/hooloo/show.rb
hooloo-0.3.1 lib/hooloo/show.rb